diff --git a/VERSIONS_WIP/57952 b/VERSIONS_WIP/57952 new file mode 100644 index 0000000000000000000000000000000000000000..7d8e6e6b2bbcfb7353cb2d83e4e23d615b12f64d --- /dev/null +++ b/VERSIONS_WIP/57952 @@ -0,0 +1,2 @@ + - ticket #57952 : Administration : refonte de la gestion des menus et des popups de configuration des boites + \ No newline at end of file diff --git a/application/modules/admin/controllers/AccueilController.php b/application/modules/admin/controllers/AccueilController.php deleted file mode 100644 index ea98d74b59cd4c03dd8c5949f26e2c616592a999..0000000000000000000000000000000000000000 --- a/application/modules/admin/controllers/AccueilController.php +++ /dev/null @@ -1,526 +0,0 @@ -<?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 Admin_AccueilController extends ZendAfi_Controller_Action { - private $id_profil; // Profil a modifier - private $config; // Qui a appelé la config : "admin" ou "accueil" - private $id_module; // Identifiant unique du module a traiter - private $type_module; // Identifiant du module à traiter - - /** @var Class_Systeme_ModulesAccueil */ - private $_systemeModulesAccueil; - - - public function preDispatch() { - parent::preDispatch(); - - // Changer le layout - if ($this->isPopupRequest()) { - $viewRenderer = $this->getHelper('ViewRenderer'); - $viewRenderer->setLayoutScript('subModal.phtml'); - } - - // Recup des parametres - $this->id_module = $this->_request->getParam("id_module"); - $this->id_profil = $this->_request->getParam("id_profil"); - $this->config = $this->_request->getParam("config"); - - // On initalise les proprietes - if (!$this->profil = Class_Profil::find($this->id_profil)) { - $this->profil = Class_Profil::getCurrentProfil(); - $this->id_profil = $this->profil->getId(); - } - - $this->type_module = $this->_getParam('type_module'); - - $user = Class_Users::getIdentity(); - - if ((!$user->isAdminBib() && !$user->hasRightConfigFront()) - || ($user->isAdminBib() && ($user->getIdSite() !== $this->profil->getIdSite()))) { - $this->_redirect('admin/index'); - return; - } - - $this->preferences = ($this->config == 'admin') - ? $this->_extractProperties() - : $this->profil->getOrCreateConfigAccueil($this->id_module, $this->type_module); - - $boite = isset($this->preferences["boite"]) ? $this->preferences["boite"] : ''; - $this->view->preferences = $this->preferences; - $this->view->url = $this->view->url(); - - $this->view->combo_templates = ZendAfi_View_Helper_Accueil_Base::getComboTemplates($boite, $this->profil); - $this->view->id_profil = $this->profil->getId(); - $this->view->profil = $this->profil; - $this->view->id_bib = $this->profil->getIdSite(); - - $this->_systemeModulesAccueil = new Class_Systeme_ModulesAccueil(); - $this->view->titre = $this->_('Propriétés du module'); - } - - - public function indexAction() { - return $this->_forward('index', 'index'); - } - - - public function addBlockAction() { - if ($this->_request->isPost()) { - $post = $this->_request->getPost(); - $new_id = $this->profil->createNewModuleAccueilId(); - $division = $this->_getParam('division'); - $parent_id = $this->_getParam('id_module'); - $config = ['type_module' => $post['module_type'], - 'preferences' => Class_Systeme_ModulesAccueil::getValeursParDefaut($post['module_type']), - 'division' => $division]; - - $config['preferences']['titre'] = $post['titre']; - $config['preferences']['boite'] = $post['boite']; - - $parent_position = $this->profil->getModulePositionInDiv($parent_id, $division); - - $this->profil->updateModuleConfigAccueil($new_id, $config); - $my_position = $this->profil->getModulePositionInDiv($new_id, $division); - $this->profil - ->moveModuleOldDivPosNewDivPos($division, $my_position, - $division, $parent_position + 1) - ->save(); - - $this->view->reload = 'SITE'; - $viewRenderer = $this->getHelper('ViewRenderer'); - $viewRenderer->renderScript('accueil/_retour.phtml'); - } - } - - - public function deleteBlockAction() { - $this->profil - ->removeBoiteFromDiv($this->_getParam('id_module'), - $this->_getParam('division')) - ->save(); - - $this->_redirect($this->view->url(['id_profil' => $this->profil->getId()], - null, true), - ['prependBase' => false]); - } - - - public function calendrierAction() { - $this->_simpleAction('CALENDAR'); - } - - - public function menuverticalAction() { - $this->_simpleAction('MENU_VERTICAL'); - } - - - public function rechguideeAction() { - $this->_simpleAction('RECH_GUIDEE'); - } - - - public function rechsimpleAction() { - $this->view->getHelper('ComboProfils') - ->setTagId('profil_redirect') - ->setTagName('profil_redirect') - ->addEmptyOption(); - - $this->_simpleAction('RECH_SIMPLE'); - } - - - public function cartezonesAction() { - $this->_simpleAction('CARTE_ZONES'); - } - - - public function preprocessSitoCategories() { - if ((int)$this->_getParam('type_aff',0)!=3) - return; - - if ($categories=explode('-',$this->_getParam('id_categorie'))) - $this->_request->setPost('id_categorie',$categories[0]); - } - - - public function sitothequeAction() { - $this->preprocessSitoCategories(); - $this->_simpleAction('SITO'); - } - - - public function domainBrowserAction() { - $this->view->module_settings = $this->profil - ->getModuleAccueilConfig($this->id_module, 'DOMAIN_BROWSER')['preferences']; - $this->_simpleAction('DOMAIN_BROWSER'); - } - - - public function formationsWidgetAction() { - $this->view->module_settings = $this->profil - ->getModuleAccueilConfig($this->id_module, 'FORMATIONS_WIDGET')['preferences']; - $this->_simpleAction('FORMATIONS_WIDGET'); - } - - - public function newsAction() { - $this->view->titre = $this->view->_('Propriétés du module articles'); - if ('1' === $this->_getParam('styles_reload')) { - $this->view->module_settings = $this->_request->getPost(); - return; - } - $this->view->module_settings = array_merge($this->preferences, - ['id_bib' => $this->view->id_bib]); - $this->_simpleAction('NEWS'); - } - - - public function rssAction() { - $this->_simpleAction('RSS'); - } - - - public function langueAction() { - $this->_simpleAction('LANGUE'); - } - - - public function loginAction() { - $this->view->titre = $this->_('Propriétés de la boite de connexion'); - $type = 'LOGIN'; - $params = $this->profil->getModuleAccueilConfig($this->id_module, $type)['preferences']; - $form = ZendAfi_Form_Configuration_LoginWidget::newWith($params); - $form->setAction($this->view->url); - $this->view->form = $form; - $this->_simpleAction($type); - } - - - public function libraryAction() { - $this->view->module_settings = $this->profil - ->getModuleAccueilConfig($this->id_module, 'LIBRARY')['preferences']; - - $this->_simpleAction('LIBRARY'); - } - - - public function compteursAction() { - $this->_simpleAction('COMPTEURS'); - } - - public function pretsAction() { - $this->_simpleAction('PRETS'); - } - - public function historiqueRecherchesAction() { - $this->_simpleAction('HISTORIQUE_RECHERCHES'); - } - - public function reservationsAction() { - $this->_simpleAction('RESERVATIONS'); - } - - public function multimediaAction() { - $this->_simpleAction('MULTIMEDIA'); - } - - public function newslettersAction() { - $this->_simpleAction('NEWSLETTERS'); - } - - public function panierAction() { - $this->_simpleAction('PANIER'); - } - - - public function bibliothequeNumeriqueAction() { - if (1 == $this->_getParam('styles_reload')) { - $this->view->preferences = $this->_request->getPost(); - return ; - } - - $this->_simpleAction('BIB_NUMERIQUE'); - } - - - public function tagsAction() { - // Retour du formulaire - if ($this->_request->isPost()) { - $enreg = $this->_request->getPost(); - $enreg['nombre'] = (int)$this->_getParam('nombre', 10); - $enreg['limite'] = (int)$this->_getParam('limite', 1000); - $enreg['type_tags'] = $enreg['type_tags_codes']; - $this->_updateEtRetour($enreg, 'TAGS'); - } else { - $this->view->catalogues = Class_Catalogue::getCataloguesForCombo(); - } - } - - - public function critiquesAction() { - if ($this->_request->isPost()) { - $enreg = $this->_request->getPost(); - if ($enreg["id_panier"]) { - $user = ZendAfi_Auth::getInstance()->getIdentity(); - $enreg["id_catalogue"] = 0; - $enreg["id_user"] = $user->ID_USER; - - } else { - $enreg["id_user"] = 0; - } - - $this->_updateEtRetour($enreg, 'CRITIQUES'); - } - - $this->view->catalogues = Class_Catalogue::getCataloguesForCombo(); - $this->view->paniers = Class_PanierNotice::getPaniersForCombo(); - } - - - public function catalogueAction() { - if ($this->_request->isPost()) { - extract($_POST); - $nb_requete = intval($nb_requete); - if (!$nb_requete) - $nb_requete = 200; - - $nb_aff = intval($nb_aff); - if (!$nb_aff) - $nb_aff = 10; - - if ($ordre == "1") - $nb_requete = $nb_aff; // si ordre strict on ne lit pas plus de notices qu'on en affiche - - $enreg["message"] = $message; - $enreg["notices"] = $notices; - $enreg["format"] = $format; - $enreg["ordre"] = $ordre; - $enreg["type_doc"] = $type_doc; - $enreg["section"] = $section; - $enreg["genre"] = $genre; - $enreg["dewey"] = $dewey; - $enreg["pcdm4"] = $pcdm4; - $enreg["matiere"] = $matiere; - $enreg["nb_requete"] = $nb_requete; - $enreg["nb_aff"] = $nb_aff; - - $this->_updateEtRetour($enreg, 'CATALOGUE'); - } - } - - - public function kiosqueAction() { - if ($this->_request->isPost()) { - if (1 == $this->_getParam('styles_reload')) { - $this->view->preferences = $this->_request->getPost(); - } else { - if ($this->isAFlashStyleSelected()) - $_POST['profil_redirect'] = ''; - $this->_updateConfig('KIOSQUE'); - } - } - - $this->view->styles_liste = $this->_getStylesListes(); - $this->view->flash_selected = $this->isAFlashStyleSelected(); - $this->view->catalogues = Class_Catalogue::getCataloguesForCombo(); - $this->view->paniers = Class_PanierNotice::getPaniersForCombo(); - } - - public function premierChapitreAction() { - $this->view->paniers = Class_PanierNotice::getPaniersForCombo(); - $this->_simpleAction('PREMIER-CHAPITRE'); - } - - - protected function isAFlashStyleSelected() { - return Class_Systeme_ModulesAccueil::moduleByCode('KIOSQUE') - ->isAFlashStyle($this->_getParam('style_liste', - $this->view->preferences['style_liste'])); - } - - - protected function _unsetStyleReload(&$enreg) { - if (array_key_exists('styles_reload', $enreg)) { - unset($enreg["styles_reload"]); - } - } - - - protected function _setTypeDAnalyse(&$enreg) { - $enreg = isset($enreg['nb_notices']) ? $enreg : array_merge($enreg,['nb_notices' => 1]) ; - - $enreg['nb_notices'] = (1 < (int)$enreg['nb_notices']) ? - (int)$enreg["nb_notices"] - : 1; - - $enreg = isset($enreg['nb_analyse']) ? $enreg : array_merge($enreg,['nb_analyse' => 10]) ; - - $enreg['nb_analyse'] = (int)$enreg['nb_analyse']; - if ($enreg['nb_analyse'] < $enreg['nb_notices']) - $enreg['nb_analyse'] = $enreg['nb_notices'] + 10; - } - - - protected function _setPanierOrDomaine(&$enreg) { - if ($enreg['id_panier'] > 0) - $enreg['id_catalogue'] = 0; - if ($enreg['id_catalogue'] > 0) - $enreg['id_panier'] = 0; - } - - - protected function _updateConfig($type) { - $enreg = $this->_request->getPost(); - $this->_unsetStyleReload($enreg); - $this->_setTypeDAnalyse($enreg); - $this->_setPanierOrDomaine($enreg); - $this->_updateEtRetour($enreg, $type); - } - - - public function kiosqueChangeSelectionAction() { - $this->getHelper('ViewRenderer')->setNoRender(); - - $module_config = $this->profil - ->getModuleAccueilConfig($this->id_module, 'KIOSQUE'); - $selected_elementId = explode('-', $this->_request->getPost('domaine_panier')); - - if($selected_elementId[0] == 'p') { - $module_config['preferences']['id_catalogue'] = 0; - $module_config['preferences']['id_panier'] = $selected_elementId[1]; - } else if ($selected_elementId[0] == 'c') { - $module_config['preferences']['id_panier'] = 0; - $module_config['preferences']['id_catalogue'] = $selected_elementId[1]; - } else { - $module_config['preferences']['id_catalogue'] = 0; - $module_config['preferences']['id_panier'] = 0; - } - - $this->profil - ->updateModuleConfigAccueil($this->id_module, $module_config) - ->save(); - - $this->_redirect($this->_request->getServer('HTTP_REFERER')); - } - - - public function conteneur2colonnesAction() { - if ($this->_request->isPost()) { - $enreg = $this->_request->getPost(); - - $this->preferences = array_merge($this->preferences, $enreg); - foreach(['gauche', 'droite'] as $colonne) - $enreg['col_' . $colonne .'_module_id'] = $this->createModuleFor($colonne); - - return $this->_updateEtRetour($enreg, 'CONTENEUR_DEUX_COLONNES'); - } - - $modules_accueil = Class_Systeme_ModulesAccueil::getModules(); - $modules = []; - foreach ($modules_accueil as $key => $module) - $modules[$key] = $module->getLibelle(); - - $this->view->modules = $modules; - } - - - protected function createModuleFor($colonne) { - return Class_Systeme_ModulesAccueil_ConteneurDeuxColonnes::createModuleForCol($colonne, - $this->preferences, - $this->id_module); - - } - - - private function _simpleAction($type) { - if ($this->_request->isPost()) - $this->_updateEtRetour($this->_request->getPost(), $type); - } - - - /** - * @param array $datas - * @return string - */ - private function _compactProperties($datas) { - $properties = array(); - foreach ($datas as $k => $v) { - $properties[] = $k . '=' . $v; - } - - return implode(Class_Profil::PROPERTIES_DELIMITER, $properties); - } - - - /** @return array */ - private function _extractProperties() { - if (null != ($props = $this->_getParam("proprietes"))) { - $props = explode(Class_Profil::PROPERTIES_DELIMITER, $props); - foreach ($props as $prop) { - $pos = strpos($prop, '='); - $clef = substr($prop, 0, $pos); - $valeur = substr($prop, ($pos + 1)); - $properties[$clef] = $valeur; - } - } else { - $cls = new Class_Systeme_ModulesAccueil(); - $properties = $cls->getValeursParDefaut($this->type_module); - } - - return $properties; - } - - - /** - * @param array $data - */ - protected function _updateEtRetour($data, $type) { - $enreg = []; - - $viewRenderer = $this->getHelper('ViewRenderer'); - - foreach ($data as $clef => $valeur) - $enreg[$clef] = addslashes($valeur); - - if ($this->config == "admin") { - $this->view->id_module = $this->id_module; - $this->view->properties = $this->_compactProperties($enreg); - return $viewRenderer->renderScript('accueil/_retour.phtml'); - } - - $module_config = $this->profil->getModuleAccueilConfig($this->id_module, $type); - $module_config['preferences'] = array_merge($module_config['preferences'], $enreg); - - $this->profil - ->updateModuleConfigAccueil($this->id_module, $module_config) - ->save(); - - $this->view->reload = 'SITE'; - $viewRenderer->renderScript('accueil/_retour.phtml'); - } - - - protected function _getStylesListes() { - return Class_Systeme_ModulesAccueil::moduleByCode('KIOSQUE') - ->getStylesListes(); - } -} diff --git a/application/modules/admin/controllers/MenusController.php b/application/modules/admin/controllers/MenusController.php deleted file mode 100644 index 683658a2b404d9f06740460f39697d4e7e56a098..0000000000000000000000000000000000000000 --- a/application/modules/admin/controllers/MenusController.php +++ /dev/null @@ -1,265 +0,0 @@ -<?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 - */ - -require_once 'AccueilController.php'; - -class Admin_MenusController extends Admin_AccueilController { - private $id_profil; // Id_profil du menu - private $id_module; // N° d'identifiant unique pour le javascript config_menus - private $type_menu; // Type de menu - - - public function preDispatch() { - parent::preDispatch(); - // Changer le layout - $viewRenderer = $this->getHelper('ViewRenderer'); - $viewRenderer->setLayoutScript('subModal.phtml'); - - // Recup des parametres - $this->id_module=$this->_getParam("id_module"); - $this->type_menu=$this->_getParam("type_menu"); - $this->id_profil=$this->_getParam("id_profil"); - - // On initalise les proprietes - $this->view->id_profil=$this->_getParam("id_profil"); - $this->view->id_profil_maj=$this->_getParam("id_profil"); - $this->view->libelle=$this->_getParam("libelle"); - $this->view->picto=$this->_getParam("picto"); - $this->view->preferences=$this->extractProperties(); - $this->view->url=$this->_request->getRequestUri(); - } - - - public function postDispatch() { - $modules_menu = new Class_Systeme_ModulesMenu(); - - $reload = (1 === (int)$this->_getParam('styles_reload')); - - if (($this->_request->isPost() && !$reload) || !$modules_menu->isModuleAccueil($this->type_menu)) - return; - - $action = $modules_menu->getFonction($this->type_menu)->getAction(); - $this->renderScript('accueil/'.$action.'.phtml'); - } - - - public function indexAction() { - if ($this->_request->isPost()) { - $enreg = $_POST; - $this->_updateEtRetour($enreg); - } - } - - - public function avisAction() { - if ($this->_request->isPost()) { - $enreg = $_POST; - $nb = (int)($enreg['nb']); - ($nb < 1 or $nb > 50) ? - $this->retourErreur("Le nombre d'avis doit être compris entre 1 et 50") : - $this->_updateEtRetour($enreg); - } - } - - - public function newsAction() { - if ($this->_request->isPost()) { - $enreg = $_POST; - $enreg["nb_aff"] = (int)$enreg["nb_aff"]; - $enreg["nb_analyse"] = (int)$enreg["nb_analyse"]; - $this->_updateEtRetour($enreg); - } - } - - - public function lastnewsAction() { - if ($this->_request->isPost()) { - $enreg = $_POST; - $nb = (int)($enreg["nb"]); - ($nb < 1 or $nb > 50) ? - $this->retourErreur("Le nombre d'articles doit être compris entre 1 et 50"): - $this->_updateEtRetour($enreg); - } - } - - - public function rssAction() { - if ($this->_request->isPost()) { - $enreg = $_POST; - $nb = (int)($enreg["nb"]); - ($nb < 1 or $nb > 50) ? - $this->retourErreur("Le nombre à afficher doit être compris entre 1 et 50"): - $this->_updateEtRetour($enreg); - } - } - - - public function sitothequeAction() { - if ($this->_request->isPost()) { - $enreg = $_POST; - $nb = (int)($enreg["nb"]); - ($nb < 1 or $nb > 50) ? - $this->retourErreur("Le nombre à afficher doit être compris entre 1 et 50"): - $this->_updateEtRetour($enreg); - } - } - - - public function liensiteAction() { - if ($this->_request->isPost()) { - $enreg = $_POST; - (trim($enreg["url"])> "" and substr(strtolower($enreg["url"]),0,4) != "http") ? - $this->retourErreur("L'url saisie n'est pas correcte"): - $this->_updateEtRetour($enreg); - } - } - - - public function lienprofilAction() { - if ($this->_request->isPost()) { - $enreg = $_POST; - $this->_updateEtRetour($enreg); - } - } - - - public function googlemapAction() { - if ($this->_request->isPost()) { - $enreg = $_POST; - $enreg["id_bib"] = $enreg["bib"]; - unset($enreg["bib"]); - $this->_updateEtRetour($enreg); - } - - $bib = new Class_Bib(); - $this->view->combo_bibs = $bib->getComboBib($this->view->preferences["id_bib"],false,false); - } - - - public function catalogueAction() { - $selected_panier = null; - if (array_key_exists('id_panier', $this->view->preferences) && - array_key_exists('id_user', $this->view->preferences)) - $selected_panier = Class_PanierNotice::getLoader()->findFirstBy(['id' => $this->view->preferences['id_panier'], - 'id_user' => $this->view->preferences['id_user']]); - - if ($selected_panier !== null) - $this->view->preferences['id_panier'] = $selected_panier->getId(); - - if ($this->_request->isPost()) { - $enreg = $_POST; - if(!$enreg["titre"]) - $enreg["titre"]=$enreg["libelle"]; - - if($enreg["id_panier"]) { - $panier = Class_PanierNotice::getLoader()->find($enreg['id_panier']); - $enreg["id_catalogue"]=0; - $enreg['id_panier'] = $panier->getId(); - $enreg["id_user"] = $panier->getIdUser(); - } else { - $enreg["id_user"]=0; - } - $this->_updateEtRetour($enreg); - } - - $this->view->catalogues=Class_Catalogue::getCataloguesForCombo(); - $this->view->paniers=Class_PanierNotice::getPaniersForCombo(); - } - - - public function etagereAction() { - if ($this->_request->isPost()) { - $enreg = $_POST; - if (!$enreg["titre"]) - $enreg["titre"] = $enreg["libelle"]; - $this->_updateEtRetour($enreg); - } - } - - - public function albumAction() { - if ($this->_request->isPost()) { - $enreg=$_POST; - if(!$enreg["titre"]) $enreg["titre"]=$enreg["libelle"]; - $this->_updateEtRetour($enreg); - return; - } - - $this->view->albums = array(); - foreach(Class_Album::getLoader()->findAll() as $album) - $this->view->albums[$album->getId()] = $album->getAbsolutePath(); - asort($this->view->albums); - } - - - private function retourErreur($erreur) { - $this->view->erreur=$erreur; - $this->view->libelle=$_POST["libelle"]; - $this->view->picto=$_POST["picto"]; - $this->view->preferences=$_POST; - } - - - protected function extractProperties() { - $module = (new Class_Systeme_ModulesMenu())->getFonction($this->type_menu); - return $module->extractPreferences($this->_getParam("preferences")); - } - - - protected function _updateEtRetour($data, $type=null) { - // Filtrage des données - foreach($data as $clef => $valeur) - $enreg[$clef] = addslashes($valeur); - - // Variables de vue - $this->view->libelle = isset($enreg['libelle']) ? $enreg['libelle'] : $enreg['titre']; - unset($enreg["libelle"]); - - $this->view->picto = isset($enreg["picto"]) ? $enreg['picto'] : 'vide.gif'; - unset($enreg["picto"]); - - $this->view->id_module = $this->id_module; - - $module = (new Class_Systeme_ModulesMenu())->getFonction($this->type_menu); - $this->view->properties = $module->compactPreferences($enreg); - - if ($this->_getParam('config') == 'menu') { - $this->_updateMenuHorizontalInProfilAndSave($enreg); - } - - - // Execute le script de retour - $view_renderer = $this->getHelper('ViewRenderer'); - $view_renderer->setLayoutScript('empty.phtml'); - $view_renderer->renderScript('menus/_retour.phtml'); - } - - - protected function _updateMenuHorizontalInProfilAndSave($enreg) { - $profil = Class_Profil::find($this->id_profil); - $menu_horizontal = $profil->getMenuHorizontal(); - $menu_horizontal->updatePreferencesForModule($this->id_module, $enreg); - $profil - ->setCfgMenuHorizontal(['menus' => $menu_horizontal->asCfgProfil()]) - ->save(); - } -} -?> \ No newline at end of file diff --git a/application/modules/admin/controllers/ModulesController.php b/application/modules/admin/controllers/ModulesController.php index a59120c493ff7eb58f8fee7ba97fec825a880e20..a54a769d66ecbabff506930a3c51baa9538cfe3e 100644 --- a/application/modules/admin/controllers/ModulesController.php +++ b/application/modules/admin/controllers/ModulesController.php @@ -189,6 +189,9 @@ class Admin_ModulesController extends ZendAfi_Controller_Action { if ('resultat' == $this->_getParam('action1')) return $this->_forward('search-result'); + if('viewnotice' == $this->_getParam('action1')) + return $this->_forward('record'); + if ($this->isValidPostNotice()) return $this->updateEtRetour($this->getPostNotice()); @@ -208,6 +211,8 @@ class Admin_ModulesController extends ZendAfi_Controller_Action { protected function isValidPostNotice() { + $this->preferences['links_zones_errors'] = ''; + $this->preferences['thumbnail_fields_errors'] = ''; if (!$this->_request->isPost() || 'viewnotice' != $this->_getParam('action1')) return false; @@ -242,7 +247,7 @@ class Admin_ModulesController extends ZendAfi_Controller_Action { $datas[2]); } - $this->view->links_errors = $link_errors; + $this->preferences['links_zones_errors'] = $this->view->links_errors = $link_errors; $this->preferences['thumbnail_fields'] = $this->processZones('thumbnail'); $lines = explode(';', $this->preferences['thumbnail_fields']); @@ -271,7 +276,7 @@ class Admin_ModulesController extends ZendAfi_Controller_Action { $datas[1]); } - $this->view->thumbs_errors = $thumb_errors; + $this->preferences['thumbnail_fields_errors'] = $this->view->thumbs_errors = $thumb_errors; return empty($link_errors) && empty($thumb_errors) ; } @@ -296,6 +301,20 @@ class Admin_ModulesController extends ZendAfi_Controller_Action { } + public function recordAction() { + $codif = Class_Codification::getInstance(); + $this->view->titre = $this->_('Configuration de l\'affichage du type %s', + $codif->getLibelleFacette(Class_CodifTypeDoc::CODE_FACETTE . $this->_getParam('action2'))); + + if ($this->isValidPostNotice()) + return $this->updateEtRetour($this->getPostNotice()); + + $params = array_merge($this->preferences, $this->getPostNotice()); + $this->view->form = ZendAfi_Form_Configuration_Record::newWith($params); + $this->view->form->setAction($this->view->url()); + } + + public function noticeajaxAction() { $this->view->type_doc = $this->action2; $this->noticeConsolidationOnglets(); @@ -334,6 +353,7 @@ class Admin_ModulesController extends ZendAfi_Controller_Action { protected function getPostNotice() { + $enreg = []; foreach($this->_request->getPost() as $clef => $valeur) { if (false === ($pos = strpos($clef, '_'))) { $enreg[$clef] = $valeur; @@ -415,11 +435,12 @@ class Admin_ModulesController extends ZendAfi_Controller_Action { [$this->_getParam('type_module')] [$this->_getParam('action1') . $this->_getParam('action2')] = $enreg; - $this->profil - ->setCfgModules($cfg_modules) - ->save(); - $this->view->reload = 'SITE'; - $this->render->renderScript('modules/_retour.phtml'); + if($this->profil->setCfgModules($cfg_modules)->save()) + $this->_helper->notify($this->_('La configuration a été enregistrée')); + + return ('1' === $this->_getParam('styles_reload')) + ? $this->_redirect(Class_Url::absolute()) + : $this->_redirectClose(Class_Url::absolute()); } diff --git a/application/modules/admin/controllers/ProfilController.php b/application/modules/admin/controllers/ProfilController.php index 32648d44350a57169929b796af29c598405ebe3d..c9fbbeec69fb5689133db5632ca2d6909e3fa51f 100644 --- a/application/modules/admin/controllers/ProfilController.php +++ b/application/modules/admin/controllers/ProfilController.php @@ -127,54 +127,6 @@ class Admin_ProfilController extends ZendAfi_Controller_Action { } - public function menusmajAction() { - $id_menu=$this->_getParam('id_menu'); - $profil = Class_Profil::getLoader()->find($this->id_profil); - $menus = $profil->getCfgMenusAsArray(); - $this->view->path_img = BASE_URL.$profil->getPathTheme()."images/menus/"; - $this->view->browser = $profil->getBrowser(); - - switch($this->_getParam("mode")) { - case "edit": - $this->view->id_profil=$this->id_profil; - $this->view->id_menu=$id_menu; - $this->view->action="Modifier"; - $this->view->menu=$menus[$id_menu]; - $this->view->titre = '['.$this->_profil->getLibelle().'] Modifier le menu: '.$menus[$id_menu]['libelle']; - break; - case "delete": - unset($menus[$id_menu]); - $profil->setCfgMenus($menus)->save(); - $this->_redirect('admin/profil/menusindex/id_profil/'.$this->id_profil); - break; - case "add": - $this->view->id_menu=0; - $this->view->action="Ajouter"; - $this->view->menu=array("libelle" => "** nouveau menu **","picto" => "vide.gif"); - $this->view->titre = '['.$this->_profil->getLibelle().'] Ajouter un menu'; - break; - case "valider": - $menu=$this->_getPostMenu(); - // En creation on attribue un id - if(!$id_menu) - { - $id_max=0; - foreach($menus as $id_menu => $data) - { - $id=intval($id_menu); - if($id > $id_max) $id_max=$id; - } - $id_menu=$id_max +1; - } - $menus[$id_menu]=$menu; - $profil->setCfgMenus($menus)->save(); - $this->_redirect('admin/profil/menusindex/id_profil/'.$this->id_profil); - break; - } - - } - - private function _getPostMenu() { extract($_POST); // Généralités @@ -470,15 +422,13 @@ class Admin_ProfilController extends ZendAfi_Controller_Action { $display="none"; $anchor = $this->view->tagAnchor($this->view->url(['module' => 'admin', - 'controller' => 'accueil', - 'action' => $module->getAction(), - 'id_module' => $id_module, - 'type_module' => $type_module]), - '<img src="'.URL_ADMIN_IMG.'ico/fonctions_admin.png" title="propriétés" style="display:'.$display.'" alt="Propriétés"/>', + 'controller' => 'widget', + 'action' => 'edit-widget', + 'id' => $id_module, + 'id_profil' => $this->_getParam('id_profil')], null, true), + '<img src="'.URL_ADMIN_IMG.'ico/fonctions_admin.png" title="propriétés" style="display:'.$display.'" alt="Propriétés"/>', ['data-popup' => 'true']); - $onclick="majProprietes(this,'".BASE_URL."/admin/accueil/".$module->getAction()."?config=admin&id_profil=".$this->id_profil."',".$module->getPopupWidth().",".$module->getPopupHeight().");"; - $item='<li id="'.$type_module.'" id_module="'.$id_module.'" proprietes="'.$properties.'"><table width="97%"><tr>'; $item.='<td align="left" class="cfg_accueil">'.$module->getLibelle().'</td>'; $item.='<td align="right">' . $anchor . '</td>'; diff --git a/application/modules/admin/controllers/WidgetController.php b/application/modules/admin/controllers/WidgetController.php new file mode 100644 index 0000000000000000000000000000000000000000..e3270a2b0767cc806d924cb4778a17b79bab1be0 --- /dev/null +++ b/application/modules/admin/controllers/WidgetController.php @@ -0,0 +1,172 @@ +<?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 Admin_WidgetController extends ZendAfi_Controller_Action { + + public function preDispatch() { + parent::preDispatch(); + + if(!Class_Users::isCurrentUserAllowedToEditProfile($this->_getParam('id_profil', 1))) + $this->_redirectClose($this->_getReferer()); + } + + + public function indexAction() { + return $this->_forward('index', 'index'); + } + + + public function addAction() { + $this->view->titre = $this->_('Ajouter une boite'); + if((!$division = $this->_getParam('division')) + || (!$sibling = $this->_getParam('after')) + || (!$profil = Class_Profil::find($this->_getParam('id_profil')))) + return $this->_redirectClose($this->_getReferer()); + + if ($this->_request->isPost() && ('' != $this->_getParam('module_type'))) { + $new_id = $profil->createNewModuleAccueilId(); + $profil->updateModuleConfigAccueil($new_id, + ['type_module' => $this->_getParam('module_type'), + 'division' => $division]); + + $profil->moveModuleOldDivPosNewDivPos($division, + $profil->getModulePositionInDiv($new_id, $division), + $division, + $profil->getModulePositionInDiv($sibling, $division) + 1); + $profil->save(); + + $widget = (new Class_Systeme_Widget_Widget()) + ->setId($new_id) + ->setProfileId($this->_getParam('id_profil')) + ->setParent($this->_getParam('parent')) + ->load() + ->setNewDatas($this->_request->getPost()); + + return $this->_update($widget); + } + + $this->view->form = ZendAfi_Form_Configuration_Widget_Add::newWith([]); + $this->view->form->setAction($this->view->url(['styles_reload' => null])); + $this->renderScript('render-form.phtml'); + } + + + public function deleteAction() { + if(!$division = $this->_getParam('division')) + return $this->_redirectClose($this->_getReferer()); + + $widget = new Class_Systeme_Widget_Widget(); + if(!$widget + ->setId($this->_getParam('id')) + ->setProfileId($this->_getParam('id_profil')) + ->load()) + return $this->_redirectClose($this->_getReferer()); + + $this->view->titre = $widget->getTitle(); + $widget->getProfile()->removeBoiteFromDiv($widget->getId(), $division)->save(); + + $this->_helper->notify($this->_('La boite %s a été supprimée', $widget->getTitle())); + return $this->_redirectClose($this->_getReferer()); + } + + + public function addMenuAction() { + (new Class_Systeme_ModulesAccueil_MenuVertical())->addMenu(); + $this->_helper->notify($this->_('Menu ajouté')); + return $this->_redirectCloseWithReload($this->_getReferer()); + } + + + public function deleteMenuAction() { + $id = $this->_getParam('id'); + $profil = Class_Profil::find($this->_getParam('id_profil')); + $menus = $profil->getCfgMenusAsArray(); + unset($menus[$id]); + + $message = $this->_('Une erreur c\'est produite, le menu n\'a pas pu être supprimé'); + if($profil->setCfgMenus($menus)->save()) + $message = $this->_('Menu supprimé'); + $this->_helper->notify($message); + return $this->_redirectClose($this->_getReferer()); + } + + + public function editMenuAction() { + return $this->_edit(new Class_Systeme_Widget_Menu()); + } + + + public function editWidgetAction() { + return $this->_edit(new Class_Systeme_Widget_Widget()); + } + + + protected function _edit($widget) { + if(!$widget + ->setId($this->_getParam('id')) + ->setProfileId($this->_getParam('id_profil')) + ->setParent($this->_getParam('parent')) + ->load()) + return $this->_redirectClose($this->_getReferer()); + + return $this->_render($widget); + } + + + protected function _render($widget) { + $this->view->titre = $widget->getTitle(); + $this->view->form = $form = call_user_func_array([$widget->getForm(), 'newWith'], [$widget->forForm()]); + $form->setAction($this->view->url(['styles_reload' => null])); + + if ($this->_request->isPost() && $form->isValid($this->_getParams($widget))) + return $this->_update($widget->setNewDatas($this->_request->getPost())); + + $this->renderScript('render-form.phtml'); + } + + + protected function _getParams($widget) { + if('add' == $this->_request->getActionName()) + return $widget->forForm(); + + return $this->_request->getPost(); + } + + + protected function _update($widget) { + $widget->updateProfile() + ? $this->_helper->notify($widget->getSuccessSaveMessage()) + : $this->_helper->notify($this->_('Echec de la sauvegarde de la configuration de %s', + $widget->getLabel())); + return $this->_redirectCloseWithReload(); + } + + + protected function _redirectCloseWithReload() { + $url = Class_Url::absolute(['styles_reload' => null]); + if('1' === $this->_getParam('styles_reload')) { + return $this->_redirect($url); + } + + $this->_request->setParam('styles_reload' , null); + return $this->_redirectClose($url); + } +} \ No newline at end of file diff --git a/application/modules/admin/views/scripts/accueil/_options_catalogue_panier.phtml b/application/modules/admin/views/scripts/accueil/_options_catalogue_panier.phtml deleted file mode 100644 index 48cfb11a38c7a6478719eadbacd8675980d8080c..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/_options_catalogue_panier.phtml +++ /dev/null @@ -1,20 +0,0 @@ -<fieldset> - <legend>Sélection</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Vignettes </td> - <td class="gauche"><?php echo $this->formSelect("only_img",$this->preferences["only_img"],"",array("0" => "afficher le titre dans une image","1"=>"Afficher les notices avec vignettes uniquement")) ?></td> - </tr> - <tr> - <td class="droite">Domaine </td> - <td class="gauche"><?php echo $this->formSelect("id_catalogue",$this->preferences["id_catalogue"],array("onchange"=>"$('#id_panier').val('')"),$this->catalogues) ?></td> - </tr> - - <tr> - <td class="droite">Panier </td> - <td class="gauche"><?php echo $this->formSelect("id_panier", $this->preferences["id_panier"],array("onchange"=>"$('#id_catalogue').val('')"),$this->paniers) ?></td> - </tr> - - </table> -</fieldset> diff --git a/application/modules/admin/views/scripts/accueil/_retour.phtml b/application/modules/admin/views/scripts/accueil/_retour.phtml deleted file mode 100644 index f8747b3ddc4512fe8f9f74eabcc4acf0c4bed3fa..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/_retour.phtml +++ /dev/null @@ -1,12 +0,0 @@ -<script> - if (parent.hidePopWin) { - parent.hidePopWin(false); - <?php - echo ($this->reload == "SITE") - ? 'parent.window.location=parent.document.location.href;' - : 'parent.retourMajProprietes('.$this->id_module.',"'.$this->properties.'");opacDialogClose();'; - ?> - } else { - window.close(); - } -</script> diff --git a/application/modules/admin/views/scripts/accueil/add-block.phtml b/application/modules/admin/views/scripts/accueil/add-block.phtml deleted file mode 100644 index bde0df0743f5255ffe5d208b0d50cb59d30ddbfc..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/add-block.phtml +++ /dev/null @@ -1,25 +0,0 @@ -<center> - <h1><?php echo $this->_('Ajouter une boîte');?></h1><br> - <div class="formTable"> - <form method="post" action="<?php echo $this->url ?>"> - <fieldset> - <legend><?php echo $this->_('Généralités');?></legend> - <table cellspacing="2"> - <tr> - <td class="droite"><?php echo $this->_('Type de boîte');?> </td> - <td class="gauche"><?php echo $this->comboModuleAccueil($this->profil); ?></td> - </tr> - <tr> - <td class="droite"><?php echo $this->_('Titre');?> </td> - <td class="gauche"><input type="text" name="titre" size="50" maxlength="60" value="** Nouvelle boîte **"></td> - </tr> - <tr> - <td class="droite"><?php echo $this->_('Style de boite');?> </td> - <td class="gauche"><?php echo $this->combo_templates; ?></td> - </tr> - </table> - </fieldset> - <?php echo $this->formSubmit('', $this->_('Valider'), ["class" => "bouton"]); ?> - </form> - </div> -</center> diff --git a/application/modules/admin/views/scripts/accueil/bibliotheque-numerique.phtml b/application/modules/admin/views/scripts/accueil/bibliotheque-numerique.phtml deleted file mode 100644 index 9cdc9d93699d7af894cf4fce94a838cc5ae9e7c2..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/bibliotheque-numerique.phtml +++ /dev/null @@ -1,11 +0,0 @@ -<center> - <h1><?php echo $this->_('Propriétés de la bibliothèque numérique'); ?></h1><br> - <div class="formTable"> - <?php - $form = ZendAfi_Form_Configuration_BibNumerique::newWith($this->preferences); - $form->setAction($this->url); - - echo $this->renderForm($form); - ?> - </div> -</center> diff --git a/application/modules/admin/views/scripts/accueil/calendrier.phtml b/application/modules/admin/views/scripts/accueil/calendrier.phtml deleted file mode 100644 index d082eb6db12b2dc2c329cd24a7ef5e4d939ca41c..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/calendrier.phtml +++ /dev/null @@ -1,211 +0,0 @@ -<?php -Class_ScriptLoader::getInstance() -->addJQueryReady( - 'formSelectToggleVisibilityForElement("select[name=\'mode-affichage\']", "tr#title_display_mode", ["simple"]);'); -?> - -<center> - <h1>Propriétés du calendrier</h1><br> - <div class="formTable"> - <form method="post" action="<?php echo $this->url ?>"> - - <fieldset> - <legend>Affichage</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Style de boite </td> - <td class="gauche"><?php echo $this->combo_templates ?></td> - </tr> - - - <tr> - <td class="droite">Nombre d'évènements à afficher</td> - <td class="gauche"> - <?php echo $this->formText('nb_events', - $this->preferences['nb_events'], - array('size' => '2', - 'maxlenghth' => '2')) ?> - </td> - </tr> - - </table> - </fieldset> - <br/> - - <fieldset> - <legend>Généralités</legend> - <table cellspacing="2"> - <tr> - <td class="droite">Titre </td> - <td class="gauche"><input type="text" name="titre" size="55" value="<?php print($this->preferences["titre"]); ?>"></td> - </tr> - <tr> - <td class="droite">Proposer un fil Rss </td> - <td class="gauche"> - <?php echo $this->formCheckbox('rss_avis', - $this->preferences['rss_avis'], - null, - array('1', '0')) ?> - </td> - </tr> - </table> - </fieldset> - - <br/> - - <fieldset> - <legend>Affichage de la boite calendrier</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Afficher le calendrier</td> - <td class="gauche"> - <?php echo $this->formSelect('display_calendar', - $this->preferences['display_calendar'], - '', - ['0' => 'Ne pas afficher', - '1' => 'Calendrier', - '2' => 'Liste des mois']); ?> - </td> - </tr> - - <tr> - <td class="droite">Mode d'affichage des évènements</td> - <td class="gauche"> - <?php - echo $this->formSelect('mode-affichage', - $this->preferences['mode-affichage'], - '', - ['simple' => $this->_('mode liste simple'), - 'article' => $this->_('mode résumé d\'article'), - 'wall' => $this->_('mode mur'), - 'diaporama_navigation' => $this->_('Diaporama avec navigation'), - 'none' => $this->_('Ne pas afficher')]); - echo (new ZendAfi_View_Helper_Admin_PropertiesReader()) - ->setView($this) - ->propertiesReader($this->preferences['mode-affichage'], - $this->preferences); - ?> - </td> - </tr> - - <tr> - <td class="droite"><?php echo $this->_('Filtre sur les évènements'); ?></td> - <td class="gauche"> - <?php echo $this->formSelect('event_filter', - $this->preferences['event_filter'], - '', - ['none' => $this->_('aucun'), - 'month' => $this->_('par mois')]); ?> - </td> - </tr> - - <tr id="title_display_mode"> - <td class="droite">Mode d'affichage des titres</td> - <td class="gauche"> - <?php - echo $this->formSelect('display_event_info', - $this->preferences['display_event_info'], - '', - ['bib' => $this->_('Nom de la bibliothèque'), - 'cat' => $this->_('Catégorie de l\'article'), - 'none' => $this->_('Titre seulement')]); - ?> - </td> - </tr> - - <tr> - <td class="droite"><?php echo $this->_('Activer la redirection vers la liste d\'articles'); ?></td> - <td class="gauche"> - <?php echo $this->formCheckbox('display_full_page', - $this->preferences['display_full_page'], - null, - ['1', '0']); ?> - </td> - </tr> - </table> - </fieldset> - - <br/> - - <fieldset> - <legend>Affichage en pleine page</legend> - <table cellspacing="2" width="100%"> - <tr> - <td class="droite">Afficher </td> - <td class="gauche"> - <?php - echo $this->formRadioButtons("display_mode", - $this->preferences["display_mode"], - ["Title" => "Date et titre seulement", - "Summary" =>"Date et résumé de l'article", - "FullArticle" =>"Date et article"]); - ?> - </td> - </tr> - - <tr> - <td class="droite">Ordre </td> - <td class="gauche"> - <?php - echo $this->formRadioButtons("display_order", - $this->preferences["display_order"], - ["EventDebut" => "Par date de début d'événement (plus ancien en premier)", - "DebutPublicationDesc" => "Par date de début de publication (plus récent en premier)", - "DateCreationDesc" => "Par date de création (plus récent en premier)"]); - ?> - </td> - </tr> - </table> - </fieldset> - - <br/> - - <fieldset> - <legend>Affichage des filtres</legend> - <?php - echo $this->formSortableConnectLists( - 'enabled_filters', - $this->preferences['enabled_filters'], - (new Class_Systeme_ModulesAccueil_Calendrier())->getAvailableFilters() - ); - ?> - </fieldset> - - <br> - - <fieldset> - <legend>Filtrage des catégories</legend> - <table cellspacing="2"> - <tr> - <td class="droite">Afficher sélection</td> - <td class="gauche"> - <?php $checked = $this->preferences["display_cat_select"] ? "checked='checked'" : ""; ?> - <input type="checkbox" name="display_cat_select" <?php echo $checked ?> > - </td> - </tr> - </table> - - <div id='table_selection'> - <?php - echo $this->treeSelect( - '', - $this->preferences["id_categorie"], - true, - $this->url(array('module' => 'admin', - 'controller' => 'bib', - 'action' => 'articles', - 'id_bib' => $this->id_bib, - 'categories_only' => 1)), - "form"); - ?> - </div> - - </table> - </fieldset> - - <?php echo $this->formSubmit("Valider","Valider",array("class" => "bouton")) ?> - </form> - </div> -</center> diff --git a/application/modules/admin/views/scripts/accueil/cartezones.phtml b/application/modules/admin/views/scripts/accueil/cartezones.phtml deleted file mode 100644 index 58e2d9ec43efd2f18955a570aab73d192d91dda2..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/cartezones.phtml +++ /dev/null @@ -1,35 +0,0 @@ -<center> -<h1>Propriétés de la carte des zones</h1><br> -<div class="formTable"> - <form method="post" action="<?php echo $this->url ?>"> - - <fieldset> - <legend>Affichage</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Style de boite </td> - <td class="gauche"><?php echo $this->combo_templates ?></td> - </tr> - - </table> - </fieldset> - <br> - - <fieldset> - <legend>Généralités</legend> - <table cellspacing="2"> - <tr> - <td class="droite">Titre </td> - <td class="gauche"><input type="text" name="titre" size="50" value="<?php print($this->preferences["titre"]); ?>"></td> - </tr> - <tr> - <td class="droite">Message sous la carte </td> - <td class="gauche"><input type="text" name="message_carte" size="50" value="<?php print($this->preferences["message_carte"]); ?>"></td> - </tr> - </table> - </fieldset> - - <?php echo $this->formSubmit("Valider","Valider",array("class" => "bouton")) ?> - </form> - </div> diff --git a/application/modules/admin/views/scripts/accueil/catalogue.phtml b/application/modules/admin/views/scripts/accueil/catalogue.phtml deleted file mode 100644 index b07d2b1cd48badab586f3f343ef34b9a76a97cca..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/catalogue.phtml +++ /dev/null @@ -1,94 +0,0 @@ -<center> -<h1>Propriétés d'affichage des catalogues</h1><br> - <div class="formTable"> - <form method="post" action="<?php echo $this->url ?>"> - - <fieldset> - <legend>Généralités</legend> - <table cellspacing="2"> - <tr> - <td class="droite">Message du dessus </td> - <td class="gauche"><input type="text" name="message" size="50" value="<?php print($this->preferences["message"]); ?>"></td> - </tr> - <tr> - <td class="droite" valign="top">Types de notices </td> - <td class="gauche"> - <select name="notices" id="notices"> - <option value="0" <?php if($this->preferences["notices"]==0) print(" selected"); ?>>Toutes</option> - <option value="1" <?php if($this->preferences["notices"]==1) print(" selected"); ?>>Les plus consultées</option> - <option value="2" <?php if($this->preferences["notices"]==2) print(" selected"); ?>>Les nouveautés</option> - </select> - </td> - </tr> - <tr> - <td class="droite" valign="top">Format d'affichage</td> - <td class="gauche"> - <select name="notices" id="format"> - <option value="4" <?php if($this->preferences["format"]==4) print(" selected"); ?>>Images pages tournantes</option> - </select> - </td> - </tr> - <tr> - <td class="droite" valign="top">Notices</td> - <td class="gauche"> - <select name="notices" id="ordre"> - <option value="" <?php if($this->preferences["ordre"]=='') print(" selected"); ?>>Les plus pertinentes</option> - <option value="1" <?php if($this->preferences["ordre"]=='') print(" selected"); ?>>Afficher aléatoirement</option> - </select> - </td> - </tr> - </table> - </fieldset> - - - <br> - <fieldset> - <legend>Critères de sélection</legend> - <table cellspacing="2"> - <tr> - <td class="droite">Type de document </td> - <td class="gauche"><input type="text" name="type_doc" size="40" value="<?php print($this->preferences["type_doc"]); ?>"></td> - </tr> - <tr> - <td class="droite">Section </td> - <td class="gauche"><input type="text" name="section" size="40" value="<?php print($this->preferences["section"]); ?>"></td> - </tr> - <tr> - <td class="droite">Genre </td> - <td class="gauche"><input type="text" name="genre" size="40" value="<?php print($this->preferences["genre"]); ?>"></td> - </tr> - <tr> - <td class="droite">Indices Dewey </td> - <td class="gauche"><input type="text" name="dewey" size="40" value="<?php print($this->preferences["dewey"]); ?>"></td> - </tr> - <tr> - <td class="droite">Indices Pcdm4 </td> - <td class="gauche"><input type="text" name="pcdm4" size="40" value="<?php print($this->preferences["pcdm4"]); ?>"></td> - </tr> - <tr> - <td class="droite">Sujet </td> - <td class="gauche"><input type="text" name="matiere" size="40" value="<?php print($this->preferences["matiere"]); ?>"></td> - </tr> - </table> - </fieldset> - - <br> - <fieldset> - <legend>Limites</legend> - <table cellspacing="2"> - <tr> - <td class="droite">Nombre de notices à analyser (mode aléatoire) </td> - <td class="gauche"><input type="text" name="nb_requete" size="4" value="<?php print($this->preferences["nb_requete"]); ?>"></td> - </tr> - <tr> - <td class="droite">Nombre de notices à afficher dans la liste </td> - <td class="gauche"><input type="text" name="nb_aff" size="4" value="<?php print($this->preferences["nb_aff"]); ?>"></td> - </tr> - </table> - </fieldset> - - - <?php echo $this->formSubmit("Valider","Valider",array("class" => "bouton")) ?> - </form> - </div> - diff --git a/application/modules/admin/views/scripts/accueil/compteurs.phtml b/application/modules/admin/views/scripts/accueil/compteurs.phtml deleted file mode 100644 index 99db4ecee51ebde02e1892a264770e8086154b99..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/compteurs.phtml +++ /dev/null @@ -1,38 +0,0 @@ -<center> -<h1>Propriétés d'affichage des compteurs</h1><br> -<div class="formTable"> - <form method="post" action="<?php echo $this->url ?>"> - - <fieldset> - <legend>Affichage</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Style de boite </td> - <td class="gauche"><?php echo $this->combo_templates ?></td> - </tr> - <tr> - <td class="droite">Titre de la boite </td> - <td class="gauche"><input type="text" name="titre" size="52" value="<?php print($this->preferences["titre"]); ?>"></td> - </tr> - - </table> - </fieldset> - <br> - - <fieldset> - <legend>Compteurs à afficher</legend> - <table cellspacing="2"> - <tr> - <td class="droite">Nombre de notices </td> - <td class="gauche"> - <?php echo $this->formSelect("nb_notices",$this->preferences["nb_notices"],"",array("1" => "oui","0"=>"non")) ?> - </td> - </tr> - - </table> - </fieldset> - - <?php echo $this->formSubmit("Valider","Valider",array("class" => "bouton")) ?> - </form> - </div> diff --git a/application/modules/admin/views/scripts/accueil/conteneur2colonnes.phtml b/application/modules/admin/views/scripts/accueil/conteneur2colonnes.phtml deleted file mode 100644 index f1ec6307bfb25ecb1632eb4f89a5f334d61b30f3..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/conteneur2colonnes.phtml +++ /dev/null @@ -1,58 +0,0 @@ -<center> - <h1>Propriétés du module Deux colonnes</h1><br> - <div class="formTable"> - <form class="news" method="post" action="<?php echo $this->url ?>"> - - <fieldset> - <legend>Affichage</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Style de boite </td> - <td class="gauche"><?php echo $this->combo_templates ?></td> - </tr> - - </table> - </fieldset> - <br> - - <fieldset> - <legend>Généralités</legend> - <table cellspacing="2"> - <tr> - <td class="droite">Titre </td> - <td class="gauche"> - <input type="text" name="titre" size="55" value='<?php print htmlspecialchars($this->preferences["titre"], ENT_QUOTES) ?>' > - </td> - </tr> - </table> - </fieldset> - <br> - - <fieldset> - <legend>Colonnes</legend> - <table cellspacing="2"> - <tr> - <td class="droite">Module à gauche</td> - <td class="gauche"> - <?php echo $this->formSelect("col_gauche_type", - $this->preferences["col_gauche_type"], - "", $this->modules) ?> - </td> - </tr> - <tr> - <td class="droite">Module à droite</td> - <td class="gauche"> - <?php echo $this->formSelect("col_droite_type", - $this->preferences["col_droite_type"], - "", $this->modules) ?> - </td> - </tr> - </table> - </fieldset> - <br> - - <?php echo $this->formSubmit("Valider","Valider",array("class" => "bouton")) ?> - </form> - </div> -</center> diff --git a/application/modules/admin/views/scripts/accueil/critiques.phtml b/application/modules/admin/views/scripts/accueil/critiques.phtml deleted file mode 100644 index 79baf2c42bdc2565db258b18818caa3abaf40bf7..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/critiques.phtml +++ /dev/null @@ -1,109 +0,0 @@ -<?php -Class_ScriptLoader::getInstance() -->addJQueryReady(' -function toggleHierarchical() { - if ($("#hierarchical").is(":checked")) { - $(".non-hierarchical").hide(); - $("#only_img").parents("tr").hide(); - $("#id_panier").parents("tr").hide(); - return; - } - - $(".non-hierarchical").show(); - $("#only_img").parents("tr").show(); - $("#id_panier").parents("tr").show(); -} - - -$("#hierarchical").change(toggleHierarchical); -toggleHierarchical(); -'); -?> -<center> - <h1>Propriétés du module : Critiques</h1><br> - <div class="formTable"> - <form method="post" action="<?php echo $this->url; ?>"> - - <fieldset> - <legend>Affichage</legend> - <table cellspacing="2"> - <tr> - <td class="droite">Titre du bloc </td> - <td class="gauche"><input type="text" name="titre" size="50" maxlength="60" value="<?php print($this->preferences['titre']); ?>"></td> - </tr> - - <tr> - <td class="droite">Style de boite </td> - <td class="gauche"><?php echo $this->combo_templates; ?></td> - </tr> - <tr> - <td class="droite">Proposer un fil Rss </td> - <td class="gauche"> - <?php echo $this->formCheckbox('rss_avis', - $this->preferences['rss_avis'], - null, - ['1', '0']); ?> - </td> - </tr> - </table> - </fieldset> - <br> - - <fieldset> - <legend>Critiques</legend> - <table cellspacing="2"> - <tr> - <td class="droite">Origine des critiques </td> - <td class="gauche"> - <?php echo $this->formSelect('abon_ou_bib', - $this->preferences['abon_ou_bib'], - '', - ['1' => 'Bibliothécaire', - '0' => 'Abonné ou utilisateur du site', - 'all' => 'Tout le monde']); ?> - </td> - </tr> - - <tr> - <td class="droite">Navigation hiérarchique </td> - <td class="gauche"> - <?php echo $this->formCheckbox('hierarchical', - $this->preferences['hierarchical'], - null, - ['1', '0']); ?> - </td> - </tr> - - <tr class="non-hierarchical"> - <td class="droite">Nombre à afficher </td> - <td class="gauche"><input type="text" name="nb_aff_avis" size="2" maxlength="2" value="<?php print($this->preferences['nb_aff_avis']); ?>"></td> - </tr> - <tr class="non-hierarchical"> - <td class="droite">Ordre d'affichage </td> - <td class="gauche"> - <?php - echo $this->formRadioButtons('display_order', - $this->preferences['display_order'], - ['CreationDesc' => 'Par date de création (plus récent en premier)', - 'Random' => 'Aléatoire']); - ?> - </td> - </tr> - <tr> - <td class="droite">Couper les critiques à </td> - <td class="gauche"><input type="text" name="nb_words" size="3" maxlength="3" value="<?php print($this->preferences['nb_words']); ?>">mots</td> - </tr> - </table> - </fieldset> - - <?php - echo $this->partial('accueil/_options_catalogue_panier.phtml', - ['preferences' => $this->preferences, - 'catalogues' => $this->catalogues, - 'paniers' => $this->paniers]); - ?> - - <?php echo $this->formSubmit('Valider', 'Valider', ['class' => 'bouton']); ?> - </form> - </div> -</center> diff --git a/application/modules/admin/views/scripts/accueil/domain-browser.phtml b/application/modules/admin/views/scripts/accueil/domain-browser.phtml deleted file mode 100644 index 29653b2893363c86625cdb7f1b3fc4b7ad7e973a..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/domain-browser.phtml +++ /dev/null @@ -1,5 +0,0 @@ -<?php -$form = ZendAfi_Form_Configuration_DomainWidget::newWith($this->module_settings); -$form->setAction($this->url); -echo $this->renderForm($form); -?> diff --git a/application/modules/admin/views/scripts/accueil/formations-widget.phtml b/application/modules/admin/views/scripts/accueil/formations-widget.phtml deleted file mode 100644 index 5dc149a9912fba7a72c1d86a58de81663609cf46..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/formations-widget.phtml +++ /dev/null @@ -1,5 +0,0 @@ -<?php -$form = ZendAfi_Form_Configuration_FormationsWidget::newWith($this->module_settings); -$form->setAction($this->url); -echo $this->renderForm($form); -?> diff --git a/application/modules/admin/views/scripts/accueil/historique-recherches.phtml b/application/modules/admin/views/scripts/accueil/historique-recherches.phtml deleted file mode 100644 index 3171757c16ce4745fc89426de8fa7de1beb6b2f2..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/historique-recherches.phtml +++ /dev/null @@ -1,23 +0,0 @@ -<center> -<h1>Propriétés du module Historique de recherches</h1><br> -<div class="formTable"> - <form method="post" action="<?php echo $this->url ?>"> - - <fieldset> - <legend>Affichage</legend> - <table cellspacing="2"> - <tr> - <td class="droite">Style de boite </td> - <td class="gauche"><?php echo $this->combo_templates ?></td> - </tr> - <tr> - <td class="droite">Titre de la boite </td> - <td class="gauche"><input type="text" name="titre" size="52" value="<?php print($this->preferences["titre"]); ?>"></td> - </tr> - - </table> - </fieldset> - - <?php echo $this->formSubmit("Valider","Valider",array("class" => "bouton")) ?> - </form> - </div> diff --git a/application/modules/admin/views/scripts/accueil/kiosque.phtml b/application/modules/admin/views/scripts/accueil/kiosque.phtml deleted file mode 100644 index 52e7f2f0a5409e44bd41de67985365bb61f0932a..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/kiosque.phtml +++ /dev/null @@ -1,112 +0,0 @@ -<?php -Class_ScriptLoader::getInstance() -->addJqueryReady('formSelectToggleVisibilityForElement("#aleatoire", "#nb_analyse_option", "1")'); -?> -<center> -<h1><?php echo $this->_('Propriétés du Kiosque de notices');?></h1><br> -<div class="formTable"> - <form class="domaines" method="post" action="<?php echo $this->url ?>"> - - <fieldset> - <legend>Affichage</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Style de boite </td> - <td class="gauche"><?php echo $this->combo_templates ?></td> - </tr> - - <tr> - <td class="droite" valign="top">Style de représentation </td> - <td class="gauche"><?php echo $this->TagObjetsImgProperties($this->styles_liste,$this->preferences)?></td> - </tr> - - <tr <?php echo $this->flash_selected ? 'style="display: none"' : ''; ?>> - <td class="droite">Basculer automatiquement sur le profil: </td> - <td class="gauche"> - <?php - $this->getHelper('ComboProfils') - ->setTagId('profil_redirect') - ->setTagName('profil_redirect') - ->addEmptyOption(); - echo $this->ComboProfils('ALL', 'ALL', $this->preferences['profil_redirect']); - ?> - </td> - </tr> - - <tr> - <td class="droite">Titre de la boite </td> - <td class="gauche"><input type="text" name="titre" size="50" value="<?php print($this->preferences["titre"]); ?>"></td> - </tr> - - <tr> - <td class="droite">Proposer un fil Rss </td> - <td class="gauche"> - <?php echo $this->formCheckbox('rss_avis', - $this->preferences['rss_avis'], - null, - array('1', '0')) ?> - </td> - </tr> - </table> - </fieldset> - <br> - - <fieldset> - <legend>Type d'analyse</legend> - <table cellspacing="2"> - - <tr> - <td class="droite" width="40%">Tirage aléatoire </td> - <td class="gauche"><?php echo $this->formSelect("aleatoire",$this->preferences["aleatoire"],"",array("0" => "non","1"=>"oui")) ?></td> - </tr> - - <tr> - <td class="droite">Tri du résultat </td> - <td class="gauche"> - <?php echo $this->formSelect("tri", - $this->preferences["tri"],"", - ['0' => $this->_('par ordre alphabétique'), - '1' => $this->_('par date de nouveauté'), - '2' => $this->_('par nombre de visualisations'), - '3' => $this->_('par date de publication'), - '4' => $this->_('par l\'ordre du panier')]) ?> - </td> - </tr> - - <tr> - <td class="droite">Nombre à afficher </td> - <td class="gauche"> - <input type="text" name="nb_notices" size="2" maxlength="2" - value="<?php print($this->preferences["nb_notices"]); ?>"> - <span id="nb_analyse_option" style="display:none"> - parmi les - <input type="text" name="nb_analyse" size="2" maxlength="3" - value="<?php print($this->preferences["nb_analyse"]); ?>"> - premières - </span> - </td> - </tr> - - <tr> - <td class="droite">Vignettes </td> - <td class="gauche"><?php echo $this->formSelect("only_img", - $this->preferences["only_img"], - "", - ["0" => "Afficher le titre dans une image", - "1" => "Afficher les notices avec vignettes uniquement"]) ?></td> - </tr> - - </table> - </fieldset> - <br /> - - <?php - echo $this->partial('/modules/_options_domaines_paniers.phtml', - ['preferences' => $this->preferences]); - ?> - - <?php echo $this->formSubmit('', $this->_('Valider'), ['class' => 'bouton']); ?> - </form> - </div> -</center> diff --git a/application/modules/admin/views/scripts/accueil/langue.phtml b/application/modules/admin/views/scripts/accueil/langue.phtml deleted file mode 100644 index 98c5b06091e13136ea330e31cb112a70c00f2a4e..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/langue.phtml +++ /dev/null @@ -1,24 +0,0 @@ -<center> -<h1>Propriétés d'affichage du sélecteur de langue</h1><br> -<div class="formTable"> - <form method="post" action="<?php echo $this->url ?>"> - - <fieldset> - <legend>Affichage</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Style de boite </td> - <td class="gauche"><?php echo $this->combo_templates ?></td> - </tr> - <tr> - <td class="droite">Titre de la boite </td> - <td class="gauche"><input type="text" name="titre" size="52" value="<?php print($this->preferences["titre"]); ?>"></td> - </tr> - - </table> - </fieldset> - - <?php echo $this->formSubmit("Valider","Valider",array("class" => "bouton")) ?> - </form> - </div> diff --git a/application/modules/admin/views/scripts/accueil/library.phtml b/application/modules/admin/views/scripts/accueil/library.phtml deleted file mode 100644 index 0159b33ce9d83a50357363208a0d2f8a369b1bc8..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/library.phtml +++ /dev/null @@ -1,11 +0,0 @@ -<center> - <h1><?php echo $this->_('Propriétés d\'affichage du module bibliothèques');?></h1><br> - <div class="formTable"> - <?php - $form = ZendAfi_Form_Configuration_LibraryWidget::newWith($this->module_settings); - $form->setAction($this->url); - - echo $this->renderForm($form); - ?> - </div> -</center> diff --git a/application/modules/admin/views/scripts/accueil/menuvertical.phtml b/application/modules/admin/views/scripts/accueil/menuvertical.phtml deleted file mode 100644 index a84b4da6f20048cda7de3da30c042ae537be6990..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/menuvertical.phtml +++ /dev/null @@ -1,76 +0,0 @@ -<center> -<h1>Propriétés du menu vertical</h1><br> -<div class="formTable"> - <form method="post" action="<?php echo $this->url ?>"> - - <fieldset> - <legend>Affichage</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Style de boite </td> - <td class="gauche"><?php echo $this->combo_templates ?></td> - </tr> - - </table> - </fieldset> - <br> - - <fieldset> - <legend>Menu</legend> - <table cellspacing="2"> - <tr> - <td class="droite">Afficher le titre du menu </td> - <td> - <?php - echo $this->formCheckbox('afficher_titre', - null, - array('checked' => $this->preferences["afficher_titre"])); - ?> - </tr> - - - <tr> - <td class="droite">Menu deplié par défaut </td> - <td> - <?php - echo $this->formCheckbox('menu_deplie', - null, - array('checked' => $this->preferences["menu_deplie"])); - ?> - </tr> - - - <tr> - <td class="droite"><?php echo $this->_('Menu avec structure HTML simplifiée pour la css');?></td> - <td> - <?php - echo $this->formCheckbox('new_html', - null, - array('checked' => $this->preferences["new_html"])); - ?> - </tr> - - - <tr> - <td class="droite"><?php echo $this->_('Menu avec interrupteur à bascule');?></td> - <td> - <?php - echo $this->formCheckbox('toggle_menu', - null, - ['checked' => $this->preferences["toggle_menu"]]); - ?> - </tr> - - - <tr> - <td class="droite">Menu à afficher </td> - <td><?php echo $this->comboMenus($this->id_profil,$this->preferences["menu"]) ?></td> - </tr> - </table> - </fieldset> - - <?php echo $this->formSubmit("Valider","Valider",array("class" => "bouton")) ?> - </form> - </div> -</center> diff --git a/application/modules/admin/views/scripts/accueil/multimedia.phtml b/application/modules/admin/views/scripts/accueil/multimedia.phtml deleted file mode 100644 index ff2ea6d5c61703c7768dd0a12f1458cd69b6068b..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/multimedia.phtml +++ /dev/null @@ -1,24 +0,0 @@ -<center> -<h1>Propriétés du module Postes Multimédia</h1><br> -<div class="formTable"> - <form method="post" action="<?php echo $this->url ?>"> - - <fieldset> - <legend>Affichage</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Style de boite </td> - <td class="gauche"><?php echo $this->combo_templates ?></td> - </tr> - <tr> - <td class="droite">Titre de la boite </td> - <td class="gauche"><input type="text" name="titre" size="52" value="<?php print($this->preferences["titre"]); ?>"></td> - </tr> - - </table> - </fieldset> - - <?php echo $this->formSubmit("Valider","Valider",array("class" => "bouton")) ?> - </form> - </div> diff --git a/application/modules/admin/views/scripts/accueil/news.phtml b/application/modules/admin/views/scripts/accueil/news.phtml deleted file mode 100644 index 4a1c643595ee6790d29d19e9481cf546d9cb3c2a..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/news.phtml +++ /dev/null @@ -1,6 +0,0 @@ -<?php -$form = ZendAfi_Form_Configuration_ArticleWidget::newWithOptions($this->module_settings); -$form->setAction($this->url); -$form->populate($this->module_settings); -echo $this->renderForm($form); -?> diff --git a/application/modules/admin/views/scripts/accueil/newsletters.phtml b/application/modules/admin/views/scripts/accueil/newsletters.phtml deleted file mode 100644 index 427ce1b88a1111fa997e7a789268740c949584d2..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/newsletters.phtml +++ /dev/null @@ -1,24 +0,0 @@ -<center> -<h1>Propriétés du module Lettres d'informations</h1><br> -<div class="formTable"> - <form method="post" action="<?php echo $this->url ?>"> - - <fieldset> - <legend>Affichage</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Style de boite </td> - <td class="gauche"><?php echo $this->combo_templates ?></td> - </tr> - <tr> - <td class="droite">Titre de la boite </td> - <td class="gauche"><input type="text" name="titre" size="52" value="<?php print($this->preferences["titre"]); ?>"></td> - </tr> - - </table> - </fieldset> - - <?php echo $this->formSubmit("Valider","Valider",array("class" => "bouton")) ?> - </form> - </div> diff --git a/application/modules/admin/views/scripts/accueil/panier.phtml b/application/modules/admin/views/scripts/accueil/panier.phtml deleted file mode 100644 index 0f2078924af588aef46dd7ead13d795d09b3cd19..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/panier.phtml +++ /dev/null @@ -1,24 +0,0 @@ -<center> -<h1>Propriétés du module Panier</h1><br> -<div class="formTable"> - <form method="post" action="<?php echo $this->url ?>"> - - <fieldset> - <legend>Affichage</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Style de boite </td> - <td class="gauche"><?php echo $this->combo_templates ?></td> - </tr> - <tr> - <td class="droite">Titre de la boite </td> - <td class="gauche"><input type="text" name="titre" size="52" value="<?php print($this->preferences["titre"]); ?>"></td> - </tr> - - </table> - </fieldset> - - <?php echo $this->formSubmit("Valider","Valider",array("class" => "bouton")) ?> - </form> - </div> diff --git a/application/modules/admin/views/scripts/accueil/premier-chapitre.phtml b/application/modules/admin/views/scripts/accueil/premier-chapitre.phtml deleted file mode 100644 index 5ee9ef4ecb2b5c30b28340339e2ea7d32d6ea58f..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/premier-chapitre.phtml +++ /dev/null @@ -1,125 +0,0 @@ -<script> - function pc_conf_view(type) { - if (type == 0) { - $("#pc_conf_panier").hide(); - $("#pc_conf_nb_aleat").show(); - $("#pc_conf_format").show(); - } - if (type == 1) { - $("#pc_conf_nb_aleat").hide(); - $("#pc_conf_panier").show(); - $("#pc_conf_format").show(); - } - if (type == 2) { - $("#pc_conf_nb_aleat").hide(); - $("#pc_conf_panier").hide(); - $("#pc_conf_format").hide(); - } - pc_ref_url(); - } - function pc_ref_url() { - var urlref = baseUrl + "/premier-chapitre" - var type = $("#type")[0].value; - var format = $("#format")[0].value; - if (type == 0) { - urlref += "/aleatoire"; - if ($("#nb_aff")[0].value != 8) urlref += "/nb/"+$("#nb_aff")[0].value; - } - if (type == 1) { - urlref += "/panier/"+$("#id_panier")[0].value; - } - if (type == 2) { - urlref += "/liste-complete"; - format = 0; - } - if (format > 0) urlref += "/format/"+format; - $("#pc_ref_url")[0].value = urlref; - } -</script> -<center> - <h1>Propriétés du module Premier-Chapitre</h1><br> - <div class="formTable"> - <form class="news" method="post" action="<?php echo $this->url ?>"> - - <fieldset> - <legend>Affichage</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Style de boite </td> - <td class="gauche"><?php echo $this->combo_templates ?></td> - </tr> - - </table> - </fieldset> - <br /> - - <fieldset> - <legend>Généralités</legend> - <table cellspacing="2"> - <tr> - <td class="droite">Titre </td> - <td class="gauche"> - <input type="text" name="titre" size="50" value='<?php print htmlspecialchars($this->preferences["titre"], ENT_QUOTES) ?>' > - </td> - </tr> - <tr> - <td class="droite">Texte d'introduction </td> - <td class="gauche"> - <input type="text" name="intro" size="50" value='<?php print htmlspecialchars($this->preferences["intro"], ENT_QUOTES) ?>' > - </td> - </tr> - </table> - </fieldset> - - <fieldset> - <legend>Mode d'affichage</legend> - <table cellspacing="2"> - <tr id="pc_conf_type"> - <td class="droite">Type de selection </td> - <td class="gauche"> - <select name="type" id="type" onchange="pc_conf_view(this.value);"> - <option value="0" <?php if($this->preferences["type"]==0) print(" selected"); ?>>Aléatoire</option> - <option value="1" <?php if($this->preferences["type"]==1) print(" selected"); ?>>Panier</option> - <option value="2" <?php if($this->preferences["type"]==2) print(" selected"); ?>>Toutes les notice</option> - </select> - </td> - </tr> - <tr id="pc_conf_nb_aleat"> - <td class="droite">Nombre à afficher<br/>(en mode aléatoire) </td> - <td class="gauche"><input type="text" id="nb_aff" name="nb_aff" size="4" value="<?php print($this->preferences["nb_aff"]); ?>" onchange="pc_ref_url();"></td> - </tr> - <tr id="pc_conf_panier"> - <td class="droite">Panier </td> - <td class="gauche"><?php echo $this->formSelect("id_panier", $this->preferences["id_panier"],['onchange'=>'pc_ref_url();'],$this->paniers) ?></td> - </tr> - <tr id="pc_conf_format"> - <td class="droite" valign="top">Format d'affichage</td> - <td class="gauche"> - <select name="format" id="format" onchange="pc_ref_url();"> - <option value="0" <?php if($this->preferences["format"]==0) print(" selected"); ?>>Vignettes seules</option> - <option value="1" <?php if($this->preferences["format"]==1) print(" selected"); ?>>Vignettes + Frame</option> - <option value="2" <?php if($this->preferences["format"]==2) print(" selected"); ?>>Vignettes + Frame + lien Notice</option> - </select> - </td> - </tr> - </table> - </fieldset> - - <?php echo $this->formSubmit("Valider","Valider",array("class" => "bouton")) ?> - </form><br/> - <fieldset> - <legend>Accès Direct</legend> - <div class="formTable"> - <table cellspacing="2"> - <tr> - <td class="droite">Url accès direct</td> - <td class="gauche"><input readonly id="pc_ref_url" name="pc_ref_url" size="50"></td> - </tr> - <tr><td colspan=2 class="gauche" style="font-weight:normal;">Attention : pour le contenu du bloc uniquement - ne contiendra ni titre, ni introduction</td></tr> - </table></div> - </fieldset> - </div> -<script> - pc_conf_view(<?php print $this->preferences["type"]; ?>); -</script> diff --git a/application/modules/admin/views/scripts/accueil/prets.phtml b/application/modules/admin/views/scripts/accueil/prets.phtml deleted file mode 100644 index 8dfeaf0728224a517d9761175123101103e9011b..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/prets.phtml +++ /dev/null @@ -1,24 +0,0 @@ -<center> -<h1>Propriétés du module Prêts</h1><br> -<div class="formTable"> - <form method="post" action="<?php echo $this->url ?>"> - - <fieldset> - <legend>Affichage</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Style de boite </td> - <td class="gauche"><?php echo $this->combo_templates ?></td> - </tr> - <tr> - <td class="droite">Titre de la boite </td> - <td class="gauche"><input type="text" name="titre" size="52" value="<?php print($this->preferences["titre"]); ?>"></td> - </tr> - - </table> - </fieldset> - - <?php echo $this->formSubmit("Valider","Valider",array("class" => "bouton")) ?> - </form> - </div> diff --git a/application/modules/admin/views/scripts/accueil/rechguidee.phtml b/application/modules/admin/views/scripts/accueil/rechguidee.phtml deleted file mode 100644 index 900a12e5084443539cd09d911408609f061ff97e..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/rechguidee.phtml +++ /dev/null @@ -1,34 +0,0 @@ -<center> -<h1>Propriétés de la recherche guidée</h1><br> -<div class="formTable"> - <form method="post" action="<?php echo $this->url ?>"> - - <fieldset> - <legend>Affichage</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Style de boite </td> - <td class="gauche"><?php echo $this->combo_templates ?></td> - </tr> - - </table> - </fieldset> - <br> - - <fieldset> - <legend>Généralités</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Titre </td> - <td class="gauche"><input type="text" name="titre" size="55" value="<?php print($this->preferences["titre"]); ?>"></td> - </tr> - - </table> - </fieldset> - - <?php echo $this->formSubmit("Valider","Valider",array("class" => "bouton")) ?> - </form> - </div> - diff --git a/application/modules/admin/views/scripts/accueil/rechsimple.phtml b/application/modules/admin/views/scripts/accueil/rechsimple.phtml deleted file mode 100644 index 57f513ed60835eb131b201028638f6756b3a535e..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/rechsimple.phtml +++ /dev/null @@ -1,5 +0,0 @@ -<?php -$form = ZendAfi_Form_Configuration_SearchWidget::newWith($this->preferences); -$form->setAction($this->url); -echo $this->renderForm($form); -?> diff --git a/application/modules/admin/views/scripts/accueil/reservations.phtml b/application/modules/admin/views/scripts/accueil/reservations.phtml deleted file mode 100644 index e4744d14a2d8e5c957fad525d0e8b55a16c0b145..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/reservations.phtml +++ /dev/null @@ -1,24 +0,0 @@ -<center> -<h1>Propriétés du module Réservations</h1><br> -<div class="formTable"> - <form method="post" action="<?php echo $this->url ?>"> - - <fieldset> - <legend>Affichage</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Style de boite </td> - <td class="gauche"><?php echo $this->combo_templates ?></td> - </tr> - <tr> - <td class="droite">Titre de la boite </td> - <td class="gauche"><input type="text" name="titre" size="52" value="<?php print($this->preferences["titre"]); ?>"></td> - </tr> - - </table> - </fieldset> - - <?php echo $this->formSubmit("Valider","Valider",array("class" => "bouton")) ?> - </form> - </div> diff --git a/application/modules/admin/views/scripts/accueil/rss.phtml b/application/modules/admin/views/scripts/accueil/rss.phtml deleted file mode 100644 index f2e1ddf2432f3d1ae6a1a7711efc2dd3cd22879a..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/rss.phtml +++ /dev/null @@ -1,71 +0,0 @@ -<center> -<h1>Propriétés du module fils rss</h1><br> -<div class="formTable"> - <form method="post" action="<?php echo $this->url ?>"> - - <fieldset> - <legend>Affichage</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Style de boite </td> - <td class="gauche"><?php echo $this->combo_templates ?></td> - </tr> - - </table> - </fieldset> - <br> - - <fieldset> - <legend>Généralités</legend> - <table cellspacing="2"> - <tr> - <td class="droite">Titre </td> - <td class="gauche"><input type="text" name="titre" size="55" value="<?php print($this->preferences["titre"]); ?>"></td> - </tr> - </table> - </fieldset> - <br> - - <fieldset> - <legend>Fils Rss à afficher</legend> - <table cellspacing="2" width="100%"> - <tr> - <td class="droite" width="90px">Type de fils rss </td> - <td class="gauche"> - <?php - $onchange="$('.treeselect').treeselect('toggleVisibility', (this.value == '1'));"; - echo $this->formSelect("type_aff", - $this->preferences["type_aff"], - array("onchange" => $onchange), - array("1" => "Une sélection de catégories ou de fils Rss", - "2" => "Les fils Rss les plus récents")) - ?> - </td> - </tr> - </table> - - <div id="table_selection" width="100%"> - <?php - echo $this->treeSelect( - $this->preferences["id_items"], - $this->preferences["id_categorie"], - ($this->preferences["type_aff"] == "1"), - BASE_URL.'/admin/bib/allitems?id_bib='.$this->id_bib.'&type=rss', - "form"); - ?> - </div> - - <table cellspacing="2" width="100%"> - <tr id='option_nb_aff'> - <td class="droite" width="90px">Nombre à afficher </td> - <td class="gauche"><input type="text" name="nb_aff" size="2" maxlength="1" value="<?php print($this->preferences["nb_aff"]); ?>"></td> - </tr> - </table> - - </fieldset> - <br> - - <?php echo $this->formSubmit("Valider","Valider",array("class" => "bouton")) ?> - </form> - </div> diff --git a/application/modules/admin/views/scripts/accueil/sitotheque.phtml b/application/modules/admin/views/scripts/accueil/sitotheque.phtml deleted file mode 100644 index 42ac656b0aa2cc4c0a886a8317edf6536d231a4d..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/sitotheque.phtml +++ /dev/null @@ -1,108 +0,0 @@ -<?php -Class_ScriptLoader::getInstance() -->addJQueryReady(' -function toggleDisplayTypeDependents() { - ("3" == $("#type_aff").val() || "2" == $("#type_aff").val()) ? $("#option_nb_aff").addClass("hidden") : $("#option_nb_aff").removeClass("hidden"); - - ("3" == $("#type_aff").val()) ? $("#option_display_order").addClass("hidden") : $("#option_display_order").removeClass("hidden"); -} - -$("#type_aff").change(function () { - toggleDisplayTypeDependents(); -}); - -toggleDisplayTypeDependents(); -'); -?> -<center> - <h1><?php echo $this->_('Propriétés du module sitothèque'); ?></h1><br> - <div class="formTable"> - <form method="post" action="<?php echo $this->url; ?>"> - - <fieldset> - <legend><?php echo $this->_('Affichage'); ?></legend> - <table cellspacing="2"> - <tr> - <td class="droite"><?php echo $this->_('Style de boite'); ?> </td> - <td class="gauche"><?php echo $this->combo_templates; ?></td> - </tr> - </table> - </fieldset> - <br> - - <fieldset> - <legend><?php echo $this->_('Généralités'); ?></legend> - <table cellspacing="2"> - <tr> - <td class="droite"><?php echo $this->_('Titre'); ?> </td> - <td class="gauche"><input type="text" name="titre" size="50" value="<?php print($this->preferences['titre']); ?>"></td> - </tr> - <tr> - <td class="droite"><?php echo $this->_('Proposer un fil Rss'); ?> </td> - <td class="gauche"> - <?php echo $this->formCheckbox('rss', - $this->preferences['rss'], - null, - ['1', '0']) ?> - </td> - </tr> - </table> - </fieldset> - <br> - - <fieldset> - <legend><?php echo $this->_('Sites à afficher'); ?></legend> - <table cellspacing="2" width="100%"> - <tr> - <td class="droite" width="90px"><?php echo $this->_('Type'); ?> </td> - <td class="gauche"> - <?php - echo $this->formSelect('type_aff', - $this->preferences['type_aff'], - [], - ['1' => $this->_('Affichage paginé'), - '2' => $this->_('Affichage groupé par catégorie'), - '3' => $this->_('Affichage hiérarchique par catégorie')]); - ?> - </td> - </tr> - </table> - - <div id="table_selection"> - <?php - echo $this->treeSelect($this->preferences['id_items'], - $this->preferences['id_categorie'], - true, - BASE_URL . '/admin/bib/allitems?id_bib=' . $this->id_bib . '&type=sito', - "form"); - ?> - </div> - - <table cellspacing="2" width="100%"> - <tr id='option_display_order'> - <td class="droite" width="90px"><?php echo $this->_('Ordre d\'affichage'); ?> </td> - <td class="gauche"> - <?php - echo $this->formRadio('display_order', - $this->preferences['display_order'], - [], - ['Random' => $this->_('Par ordre aléatoire'), - 'Selection' => $this->_('Par ordre de sélection'), - 'Recent' => $this->_('Les sites les plus récents')]); - ?> - </td> - </tr> - - <tr id='option_nb_aff'> - <td class="droite" width="90px"><?php echo $this->_('Nbre de sites par page'); ?> </td> - <td class="gauche"><input type="text" name="nb_aff" size="3" maxlength="3" value="<?php print($this->preferences['nb_aff']); ?>"></td> - </tr> - - </table> - </fieldset> - <br /> - - <?php echo $this->formSubmit('Valider', $this->_('Valider'), ['class' => 'bouton']); ?> - </form> - </div> -</center> diff --git a/application/modules/admin/views/scripts/accueil/tags.phtml b/application/modules/admin/views/scripts/accueil/tags.phtml deleted file mode 100644 index 1fa20256f6c34e1c38544ebb58bbb2ee4e7c2b7d..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/accueil/tags.phtml +++ /dev/null @@ -1,77 +0,0 @@ -<?php -echo '<script src="'.URL_ADMIN_JS.'drag_and_drop.js'.'" type="text/javascript"> </script>'; -echo '<script src="'.URL_ADMIN_JS.'selection_champs.js'.'" type="text/javascript"> </script>'; -echo '<link rel="stylesheet" type="text/css" media="screen" href="'.URL_ADMIN_CSS.'drag_and_drop.css" />'; -echo $this->tagSelectionChamps("libelles"); - -?> -<center> - <h1>Propriétés d'affichage du nuage de tags</h1><br> - <div class="formTable"> - <form method="post" action="<?php echo $this->url ?>"> - - <fieldset> - <legend>Affichage</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Style de boite </td> - <td class="gauche"><?php echo $this->combo_templates ?></td> - </tr> - - </table> - </fieldset> - <br> - - <fieldset> - <legend>Généralités</legend> - <table cellspacing="2"> - <tr> - <td class="droite">Titre </td> - <td class="gauche"><input type="text" name="message" size="52" value="<?php print($this->preferences["message"]); ?>"></td> - </tr> - <tr> - <td class="droite" valign="top">Types de notices </td> - <td class="gauche"> - <?php - echo $this->formSelect("notices", - $this->preferences["notices"], - "", - array("0" => "Toutes", - "1" => "Les nouveautés", - "2" => "Les plus consultées")); - ?> - </td> - </tr> - <td class="droite" valign="top">Types de tags </td> - <td class="gauche"><?php echo $this->tagSelectionChamps("type_tags", $this->preferences["type_tags"]);?></td> - </tr> - <tr> - <td class="droite">Domaine </td> - <td class="gauche"> - <?php echo $this->formSelect("id_catalogue", - $this->preferences["id_catalogue"], - null, - $this->catalogues) ?> - </td> - </tr> - </table> - </fieldset> - - <br> - <fieldset> - <legend>Limites</legend> - <table cellspacing="2"> - <tr> - <td class="droite">Nombre de notices à analyser </td> - <td class="gauche"><input type="text" name="limite" size="4" value="<?php print($this->preferences["limite"]); ?>"></td> - </tr> - <tr> - <td class="droite">Nombre de tags à afficher dans le nuage </td> - <td class="gauche"><input type="text" name="nombre" size="4" value="<?php print($this->preferences["nombre"]); ?>"></td> - </tr> - </table> - </fieldset> - <?php echo $this->formSubmit("Valider","Valider",array("class" => "bouton")) ?> - </form> - </div> diff --git a/application/modules/admin/views/scripts/cms/edit.phtml b/application/modules/admin/views/scripts/cms/edit.phtml index 020a61d98bcee0338b870db67fa4291edbd64efc..3c45021526c957ab299fe7f4ea4a1a3aad44fde2 100644 --- a/application/modules/admin/views/scripts/cms/edit.phtml +++ b/application/modules/admin/views/scripts/cms/edit.phtml @@ -1,6 +1,8 @@ <?php echo $this->partial('cms/_newsform_head.phtml', ['article' => $this->article]); + if ($this->article->isTraduction()) $this->form->setOriginal($this->article->getArticleOriginal()); + echo $this->renderForm($this->form); ?> diff --git a/application/modules/admin/views/scripts/menus/_debut.phtml b/application/modules/admin/views/scripts/menus/_debut.phtml deleted file mode 100644 index 501c609454b5cd522d9e8a4598bcbec9f0868fd3..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/menus/_debut.phtml +++ /dev/null @@ -1,22 +0,0 @@ -<center> -<h1>Propriétés de l'entrée de menu</h1><br> -<div class="formTable"> - <?php if($this->erreur) echo '<p class="erreur">'.$this->erreur.'</p>'; ?> - <form method="post" action="<?php echo htmlspecialchars($this->url) ?>"> - - <fieldset> - <legend>Ligne de menu</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Libellé </td> - <td class="gauche"><input type="text" name="libelle" size="40" value="<?php print($this->libelle); ?>"></td> - </tr> - - <tr> - <td valign="top" class="droite">Pictogramme </td> - <td><?php echo $this->ChoixPictogramme("menus","picto",$this->id_profil_maj,$this->picto); ?></td> - </tr> - - </table> - </fieldset> diff --git a/application/modules/admin/views/scripts/menus/_fin.phtml b/application/modules/admin/views/scripts/menus/_fin.phtml deleted file mode 100644 index 00fb383010db768f6496e527c025348d64d8bf2a..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/menus/_fin.phtml +++ /dev/null @@ -1,4 +0,0 @@ -<?php echo $this->formSubmit("","Valider",array("class" => "bouton")) ?> - -</form> -</div> diff --git a/application/modules/admin/views/scripts/menus/_retour.phtml b/application/modules/admin/views/scripts/menus/_retour.phtml deleted file mode 100644 index 400ce8d6405aa17bddfe127cf2164af6a2016ad4..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/menus/_retour.phtml +++ /dev/null @@ -1,11 +0,0 @@ -<script> - parent.hidePopWin(false); - <?php - if($this->reload=="SITE") print('parent.window.location=parent.document.location.href;'); - else - { - $args= '"'.$this->id_module.'","'.$this->libelle.'","'.$this->picto.'","'.$this->properties.'"'; - echo 'parent.retourMajProprietes('.$args.');opacDialogClose();'; - } - ?> -</script> diff --git a/application/modules/admin/views/scripts/menus/album.phtml b/application/modules/admin/views/scripts/menus/album.phtml deleted file mode 100644 index 2d4398895818e196918b08e0e1d8e734046286de..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/menus/album.phtml +++ /dev/null @@ -1,15 +0,0 @@ -<?php echo $this->render('menus/_debut.phtml'); ?> -<br/> -<fieldset> - <legend>Affichage</legend> - <table cellspacing="2"> - <tr> - <td class="droite">Album </td> - <td class="gauche"> - <?php echo $this->formSelect('album_id', $this->preferences['album_id'], null, $this->albums); ?> - </td> - </tr> - </table> -</fieldset> -<?php echo $this->render('menus/_fin.phtml'); ?> - diff --git a/application/modules/admin/views/scripts/menus/avis.phtml b/application/modules/admin/views/scripts/menus/avis.phtml deleted file mode 100644 index 2cba7c37418fbeb0072712732b8e485939fe9fbc..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/menus/avis.phtml +++ /dev/null @@ -1,17 +0,0 @@ -<?php echo $this->render('menus/_debut.phtml'); ?> - -<br> -<fieldset> - <legend>Avis</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Nombre d'avis à afficher </td> - <td class="gauche"><input type="text" name="nb" size="2" maxlength="2" value="<?php print($this->preferences["nb"]); ?>"></td> - </tr> - - </table> -</fieldset> - -<?php echo $this->render('menus/_fin.phtml'); ?> - diff --git a/application/modules/admin/views/scripts/menus/bibnum.phtml b/application/modules/admin/views/scripts/menus/bibnum.phtml deleted file mode 100644 index 1d4864c72a4bf25cf39c2bfa264cf1234dba36c7..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/menus/bibnum.phtml +++ /dev/null @@ -1,3 +0,0 @@ -<?php echo $this->render('menus/_debut.phtml'); ?> -<?php echo $this->render('menus/_fin.phtml'); ?> - diff --git a/application/modules/admin/views/scripts/menus/catalogue.phtml b/application/modules/admin/views/scripts/menus/catalogue.phtml deleted file mode 100644 index f6cb8b08322d1a8a7c8b5dfc75cbc6bffdb77632..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/menus/catalogue.phtml +++ /dev/null @@ -1,54 +0,0 @@ -<?php echo $this->render('menus/_debut.phtml'); ?> - -<br> -<fieldset> - <legend>Type d'analyse</legend> - <table cellspacing="2"> - - <tr> - <td class="droite" width="35%">Titre </td> - <td class="gauche"><input type="text" name="titre" size="50" maxlength="50" value="<?php print($this->preferences["titre"]); ?>"></td> - </tr> - - <tr> - <td class="droite">Tirage aléatoire </td> - <td class="gauche"><?php echo $this->formSelect("aleatoire",$this->preferences["aleatoire"],"",array("0" => "non","1"=>"oui")) ?></td> - </tr> - - <tr> - <td class="droite">Tri du résultat </td> - <td class="gauche"><?php echo $this->formSelect("tri",$this->preferences["tri"],"",array("0" => "par ordre alphabétique","1"=>"par date de nouveauté","2"=>"par nombre de visualisations")) ?></td> - </tr> - - <tr> - <td class="droite">Nombre à afficher </td> - <td class="gauche"><input type="text" name="nb_notices" size="4" maxlength="4" value="<?php print($this->preferences["nb_notices"]); ?>"> (0=pas de limite)</td> - </tr> - - <tr> - <td class="droite">Nombre à analyser </td> - <td class="gauche"><input type="text" name="nb_analyse" size="4" maxlength="4" value="<?php print($this->preferences["nb_analyse"]); ?>"> (pour le mode aléatoire)</td> - </tr> - - </table> - </fieldset> - - <br> - <fieldset> - <legend>Sélection</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Catalogue </td> - <td class="gauche"><?php echo $this->formSelect("id_catalogue",$this->preferences["id_catalogue"],array("onchange"=>"$('#id_panier').val('')"),$this->catalogues) ?></td> - </tr> - - <tr> - <td class="droite">Panier </td> - <td class="gauche"><?php echo $this->formSelect("id_panier",$this->preferences["id_panier"],array("onchange"=>"$('#id_catalogue').val('')"),$this->paniers) ?></td> - </tr> - - </table> - </fieldset> - -<?php echo $this->render('menus/_fin.phtml'); ?> diff --git a/application/modules/admin/views/scripts/menus/etagere.phtml b/application/modules/admin/views/scripts/menus/etagere.phtml deleted file mode 100644 index 1d4864c72a4bf25cf39c2bfa264cf1234dba36c7..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/menus/etagere.phtml +++ /dev/null @@ -1,3 +0,0 @@ -<?php echo $this->render('menus/_debut.phtml'); ?> -<?php echo $this->render('menus/_fin.phtml'); ?> - diff --git a/application/modules/admin/views/scripts/menus/googlemap.phtml b/application/modules/admin/views/scripts/menus/googlemap.phtml deleted file mode 100644 index c99e1ccf8b160a6cdb7aca02ad7978479851912b..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/menus/googlemap.phtml +++ /dev/null @@ -1,16 +0,0 @@ -<?php echo $this->render('menus/_debut.phtml'); ?> - -<br> -<fieldset> - <legend>Carte à afficher</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Bibliothèque </td> - <td class="gauche"><?php echo $this->combo_bibs ?></td> - </tr> - - </table> -</fieldset> - -<?php echo $this->render('menus/_fin.phtml'); ?> diff --git a/application/modules/admin/views/scripts/menus/index.phtml b/application/modules/admin/views/scripts/menus/index.phtml deleted file mode 100644 index 8c287fcc2079e38d5fd79d8a11dad58118b3977f..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/menus/index.phtml +++ /dev/null @@ -1,2 +0,0 @@ -<?php echo $this->render('menus/_debut.phtml'); ?> -<?php echo $this->render('menus/_fin.phtml'); ?> \ No newline at end of file diff --git a/application/modules/admin/views/scripts/menus/lastnews.phtml b/application/modules/admin/views/scripts/menus/lastnews.phtml deleted file mode 100644 index 8bf7ae7e99ad850ef8fd776d9144d3ed3624855d..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/menus/lastnews.phtml +++ /dev/null @@ -1,16 +0,0 @@ -<?php echo $this->render('menus/_debut.phtml'); ?> - -<br> -<fieldset> - <legend>Articles</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Nombre d'articles à afficher </td> - <td class="gauche"><input type="text" name="nb" size="2" maxlength="2" value="<?php print($this->preferences["nb"]); ?>"></td> - </tr> - - </table> -</fieldset> - -<?php echo $this->render('menus/_fin.phtml'); ?> diff --git a/application/modules/admin/views/scripts/menus/lienprofil.phtml b/application/modules/admin/views/scripts/menus/lienprofil.phtml deleted file mode 100644 index 8f9b80f025cbe0ab419663c666ac05fa46f59ab0..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/menus/lienprofil.phtml +++ /dev/null @@ -1,17 +0,0 @@ -<?php echo $this->render('menus/_debut.phtml'); ?> - -<br> -<fieldset> - <legend>Définition du profil</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Profil </td> - <td class="gauche"><?php echo $this->ComboProfils("ALL","ALL",$this->preferences["clef_profil"],false,true) ?></td> - </tr> - - </table> -</fieldset> - -<?php echo $this->render('menus/_fin.phtml'); ?> - diff --git a/application/modules/admin/views/scripts/menus/liensite.phtml b/application/modules/admin/views/scripts/menus/liensite.phtml deleted file mode 100644 index 819394f220c5ccccca20e3f0ac0d126282d5f3bd..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/menus/liensite.phtml +++ /dev/null @@ -1,20 +0,0 @@ -<?php echo $this->render('menus/_debut.phtml'); ?> - -<br> -<fieldset> - <legend>Définition du lien</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Url </td> - <td class="gauche"><input type="text" name="url" size="60" value="<?php print($this->preferences["url"]); ?>"></td> - </tr> - <tr> - <td class="droite">Navigation </td> - <td class="gauche"><?php echo $this->formSelect("target",$this->preferences["target"],"",array("0" => "Ouvrir dans un nouvel onglet","1"=>"Rester sur le même onglet")) ?></td> - </tr> - - </table> -</fieldset> - -<?php echo $this->render('menus/_fin.phtml'); ?> diff --git a/application/modules/admin/views/scripts/menus/news.phtml b/application/modules/admin/views/scripts/menus/news.phtml deleted file mode 100644 index 8388637c3bea39eab05871f31d0814eca4cd97aa..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/menus/news.phtml +++ /dev/null @@ -1,44 +0,0 @@ -<?php -Class_ScriptLoader::getInstance() -->addJqueryReady('formSelectToggleVisibilityForElement("input.display_mode", "tr#option_summary_content", "Summary")'); - -echo $this->render('menus/_debut.phtml'); ?> - -<?php -echo $this->partial("modules/_options_cms.phtml", - ['preferences' => $this->preferences, - 'id_bib' => $this->id_bib, - 'form_selector' => 'form']); -?> - -<fieldset> - <legend><?php echo $this->_('Mode d\'affichage'); ?></legend> - <table> - <tr> - <td class="droite"><?php echo $this->_('Clic sur le menu ouvre'); ?></td> - <td class="gauche"> - <?php - echo $this->formRadioButtons("display_mode", - $this->preferences["display_mode"], - ['Submenu' => $this->_('sous-menu'), - 'Summary' => $this->_('sommaire')]); - ?> - </td> - </tr> - - <tr id="option_summary_content"> - <td class="droite"><?php echo $this->_('Contenu du sommaire'); ?></td> - <td class="gauche"> - <?php - echo $this->formRadioButtons("summary_content", - $this->preferences["summary_content"], - ['Summary' => $this->_('Résumés'), - 'TitlesOnly' => $this->_('Titres seulement'), - 'FullContent' => $this->_('Articles complets')]); - ?> - </td> - </tr> - </table> -</fieldset> - -<?php echo $this->render('menus/_fin.phtml'); ?> diff --git a/application/modules/admin/views/scripts/menus/rss.phtml b/application/modules/admin/views/scripts/menus/rss.phtml deleted file mode 100644 index b5f336e2d3c113f1b9344b20f542abc76e660d9b..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/menus/rss.phtml +++ /dev/null @@ -1,25 +0,0 @@ -<?php echo $this->render('menus/_debut.phtml'); ?> - -<br> -<fieldset> - <legend>Fils RSS</legend> - <div id="table_selection"> - <?php - echo $this->treeSelect( - $this->preferences["id_items"], - $this->preferences["id_categorie"], - true, - BASE_URL.'/admin/bib/allitems?id_bib='.$this->id_bib.'&type=rss', - "form"); - ?> - </div> - <table cellspacing="2"> - <tr> - <td class="droite">Nbre à afficher </td> - <td class="gauche"><input type="text" name="nb" size="2" maxlength="2" value="<?php print($this->preferences["nb"]); ?>"></td> - </tr> - - </table> -</fieldset> - -<?php echo $this->render('menus/_fin.phtml'); ?> diff --git a/application/modules/admin/views/scripts/menus/sitotheque.phtml b/application/modules/admin/views/scripts/menus/sitotheque.phtml deleted file mode 100644 index 99a8d28c8b5f473fdda9059cbe6933bbf78c040d..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/menus/sitotheque.phtml +++ /dev/null @@ -1,25 +0,0 @@ -<?php echo $this->render('menus/_debut.phtml'); ?> - -<br> -<fieldset> - <legend>Sites</legend> - <div id="table_selection"> - <?php - echo $this->treeSelect( - $this->preferences["id_items"], - $this->preferences["id_categorie"], - true, - BASE_URL.'/admin/bib/allitems?id_bib='.$this->id_bib.'&type=sito', - "form"); - ?> - </div> - <table cellspacing="2"> - <tr> - <td class="droite">Nbre à afficher </td> - <td class="gauche"><input type="text" name="nb" size="2" maxlength="2" value="<?php print($this->preferences["nb"]); ?>"></td> - </tr> - - </table> -</fieldset> - -<?php echo $this->render('menus/_fin.phtml'); ?> diff --git a/application/modules/admin/views/scripts/accueil/login.phtml b/application/modules/admin/views/scripts/modules/record.phtml similarity index 85% rename from application/modules/admin/views/scripts/accueil/login.phtml rename to application/modules/admin/views/scripts/modules/record.phtml index 17e0bee64581d02850194991a0c3a5482cb47b73..fb242e29dad1e1f4f12bec7faf7da998bfac22d7 100644 --- a/application/modules/admin/views/scripts/accueil/login.phtml +++ b/application/modules/admin/views/scripts/modules/record.phtml @@ -1,4 +1,3 @@ <?php echo $this->renderForm($this->form); -return; ?> diff --git a/application/modules/admin/views/scripts/profil/menusindex.phtml b/application/modules/admin/views/scripts/profil/menusindex.phtml index e4958b09acd9ab576c4cf950db69d96ec2a3fabb..e2c6a4a28b894b8a665b742b7e7eb26ac34ddb81 100644 --- a/application/modules/admin/views/scripts/profil/menusindex.phtml +++ b/application/modules/admin/views/scripts/profil/menusindex.phtml @@ -1,71 +1,13 @@ -<?php echo $this->partial('profil/_profil_panel.phtml', - array('profil' => $this->profil)); ?> - - - -<center> - <div align="center"><br\> - <?php - echo $this->bouton('id=creer', - 'picto=add', - 'texte='.$this->traduire('Ajouter un menu').'', - 'url='.$this->url(array('action' => 'menusmaj', - 'id_profil' => $this->profil->getId(), - 'mode' => 'add')), - 'largeur=170px') - ?> - </div> -</center> - - -<br /> -<table cellspacing="0" cellpadding="0"> - <tr class="soustitre"> - <td width="30px">Picto.</td> - <td>Libellé</td> - <td width="20px"> </td> - <td width="20px"> </td> - </tr> - <tr> - <td colspan="3" class="separ"></td> - </tr> - <?php -$ligne=0; -foreach($this->menus as $id_menu => $menu) -{ - if ($ligne & 1) $class="first"; else $class="second"; - echo '<tr class="'.$class.'" style="height:30px">'; - echo '<td align="center">'; - echo '<img src="'.$this->path_img.$menu["picto"].'">'; - echo '</td>'; - echo '<td>'.$menu["libelle"].'</td>'; - echo '<td align="center"><a href="'.$this->url(array('action' => 'menusmaj', - 'id_profil' => $this->profil->getId(), - 'id_menu' => $id_menu, - 'mode' => 'edit')).'">'. - $this->boutonIco("type=edit"). - '</a></td>'; - - if($id_menu=="H") - echo '<td align="center"><a href="'.$this->url(['action' => 'duplicate-horizontal-menu', - 'id_profil' => $this->profil->getId() ]).'" - onclick="javascript:if(!confirm(\''.$this->traduire('Êtes vous sûr de vouloir dupliquer la configuration du menu horizontal à tous les autres profils ? Cela supprimera la configuration existante pour les autres profils').'\')) return false;" >'. - '<img src="'.URL_ADMIN_IMG.'ico/page_copy.png" alt="Dupliquer le menu horizontal" title="Dupliquer le menu horizontal à tous les autres profils" /></a>'; +Class_ScriptLoader::getInstance()->addSearchInputToContent($this->_('Filtrer les menus ')); +echo $this->partial('profil/_profil_panel.phtml', + ['profil' => $this->profil]); +echo $this->Button_New((new Class_Entity()) + ->setUrl($this->url(['module' => 'admin', + 'controller' => 'widget', + 'action' => 'add-menu'], null, true)) + ->setText($this->_('Ajouter un menu'))); - else - echo '<td align="center"><a href="'.$this->url(array('action' => 'menusmaj', - 'id_profil' => $this->profil->getId(), - 'id_menu' => $id_menu, - 'mode' => 'delete')).'">' . - $this->boutonIco("type=del") . - '</a></td>'; - print('</tr>'); - $ligne ++ ; -} - +echo $this->menus(); ?> - -</table> -<br /> diff --git a/application/modules/admin/views/scripts/profil/menusmaj.phtml b/application/modules/admin/views/scripts/profil/menusmaj.phtml deleted file mode 100644 index 2493063a72db2cd80d13d7aa1bc2d199cd645472..0000000000000000000000000000000000000000 --- a/application/modules/admin/views/scripts/profil/menusmaj.phtml +++ /dev/null @@ -1,67 +0,0 @@ -<?php -Class_ScriptLoader::getInstance() - ->addInlineScript('sPathIco="'.$this->path_img.'";nIdProfil='.$this->id_profil.';nIdBib='.($this->id_bib == 'ALL' ? 'null' : $this->id_bib)) - ->addAdminScripts(['common', 'controle_maj', 'config_menu']) - ->addInlineScript((new Class_Systeme_ModulesMenu)->getStructureJavaScript()); -?> - -<?php echo $this->partial('profil/_profil_panel.phtml', - array('profil' => $this->profil)); ?> - -<div class="form" align="center"> - <form id="form_menu" name="form" action="<?php echo $this->url(array('action' => 'menusmaj', 'id_menu' => $this->id_menu, 'mode' => 'valider')); ?>" method="post"> - - <fieldset><legend><?php echo $this->_('Description'); ?> </legend> - <br/> - <div class="formTable"> - <table> - <tr> - <td class="droite" style="width:120px;"><?php echo $this->_('Libellé'); ?></td> - <td class="gauche"><input type="text" name="libelle" size="50" maxlength="70" value="<?php echo $this->menu["libelle"] ?>" /></td> - </tr> - <tr> - <td class="droite" style="width:120px;"><?php echo $this->_('Pictogramme'); ?></td> - <td><?php echo $this->ChoixPictogramme("menus","picto",$this->id_profil,$this->menu["picto"]); ?></td> - </tr> - </table> - </div> - </fieldset> - - <br/> - <fieldset><legend><?php echo $this->_('Entrées'); ?> </legend> - <br/> - <div class="formTable" id="menu_container"> - <div class="fonction_menu" onclick="addMenu()">» Ajouter une entrée</div> - <?php - - // Affichage des - if(!isset($this->menu['menus']) or !count($this->menu["menus"])) - $menus[0]=array("picto" => "vide.gif","libelle" => "** nouvelle entrée **","type_menu" => "MENU"); - else - $menus=$this->menu["menus"]; - - foreach($menus as $menu) - echo $this->blocMenu($this->path_img,"module",$menu,false,$this->browser); - - ?> - </div> - </fieldset> - - <br/> - <table> - <tr> - <td align="right" style="padding-right:5px;"><?php echo $this->bouton('type=V',"javascript=saveMenu();"); ?> </td> - <td align="left" style="padding-left:5px;"> <?php echo $this->bouton('id=29','picto=remove','texte=Annuler','url='.$this->url(array('action' => 'menusindex')), 'largeur=120px'); ?></td> - </tr> - </table> - - </form> -</div> - - -<?php -// Creer un menu et un sous_menu vide -print($this->blocMenu($this->path_img,"menu_vide",array("picto" => "vide.gif","libelle" => "** nouvelle entrée **","type_menu" =>"MENU"),false,$this->browser)); -print($this->blocMenu($this->path_img,"sous_menu_vide",array("picto" => "vide.gif","libelle" => "** nouveau sous-menu **","type_menu" =>"ACCUEIL"),true,$this->browser)); - -?> diff --git a/application/modules/admin/views/scripts/render-form.phtml b/application/modules/admin/views/scripts/render-form.phtml new file mode 100644 index 0000000000000000000000000000000000000000..c52ca489f905555642d9f8210fc3130ba4abfdcd --- /dev/null +++ b/application/modules/admin/views/scripts/render-form.phtml @@ -0,0 +1 @@ +<?php echo $this->renderForm($this->form); ?> diff --git a/application/modules/opac/controllers/NoticeajaxController.php b/application/modules/opac/controllers/NoticeajaxController.php index 7c2fd4fc152efdb53fea0fe82794668f5125c599..dac9e3dc8f6948f1806b01bd13fc5626edd96a3e 100644 --- a/application/modules/opac/controllers/NoticeajaxController.php +++ b/application/modules/opac/controllers/NoticeajaxController.php @@ -65,8 +65,6 @@ class NoticeAjaxController extends Zend_Controller_Action { // Url panier $user = ZendAfi_Auth::getInstance()->getIdentity(); - $this->view->url_panier = "fonction_abonne('".$user->ID_USER."','/opac/abonne/panier?id=".$this->id_notice."')"; - // View $viewRenderer = $this->getHelper('ViewRenderer'); $viewRenderer->setLayoutScript('noticeajax/notice.phtml'); diff --git a/application/modules/opac/controllers/PanierController.php b/application/modules/opac/controllers/PanierController.php index 994cfc798bd4465e4fd021e316a8fdfdee485eea..b95971fc826a0ce26e6fd8f72b12134808ff5a04 100644 --- a/application/modules/opac/controllers/PanierController.php +++ b/application/modules/opac/controllers/PanierController.php @@ -185,7 +185,7 @@ class PanierController extends ZendAfi_Controller_Action { return $url ? $this->_redirect($url) - : $this->_redirectToReferer(); + : $this->_redirectClose($this->_getReferer()); } diff --git a/application/modules/opac/views/scripts/bib/selection.phtml b/application/modules/opac/views/scripts/bib/selection.phtml index 90ae6c54dcfb16be48d37e08acbab0c08342567d..e56e98fd6af43b9ecd9670aebf05f78a38b73989 100644 --- a/application/modules/opac/views/scripts/bib/selection.phtml +++ b/application/modules/opac/views/scripts/bib/selection.phtml @@ -3,10 +3,15 @@ $html = ''; $html .= $this->tag('p', $this->_('Vous pouvez sélectionner une ou plusieurs bibliothèques pour effectuer une recherche ')); -$form_content = $this->formSubmit('Valider', $this->_('Valider la sélection')); -$form_content .= $this->tagAnchor('javascript:selectall()', $this->_('Tout cocher')); -$form_content .= $this->tagAnchor('javascript:deselectall()', $this->_('Tout décocher')); -$form_content .= $this->formHidden('update_bib_select', '1'); +$form_content = [$this->formHidden('update_bib_select', '1'), + $this->Button_Submit((new Class_Entity())->setText($this->_('Valider la sélection'))), + $this->Button((new Class_Entity())->setText($this->_('Tout cocher')) + ->setAttribs(['class' => 'bouton', + 'onclick' => '$(this).closest(form).find(\'input:checkbox\').prop(\'checked\', true); return false;'])), + $this->Button((new Class_Entity())->setText($this->_('Tout décocher')) + ->setAttribs(['class' => 'bouton', + 'onclick' => '$(this).closest(form).find(\'input:checkbox\').prop(\'checked\', false);return false;']))]; + $form_li = ''; foreach($this->zones as $zone ) { @@ -26,8 +31,8 @@ foreach($this->zones as $zone ) { $form_li .= $this->tag('li', $this->tag('h2', $zone->getLibelle()) . $form_ul_ul); } -$form_content .= $this->tag('ul', $form_li); -$form = $this->tag('form', $form_content, ['name' => 'selection', +$form_content[] = $this->tag('ul', $form_li); +$form = $this->tag('form', implode($form_content), ['name' => 'selection', 'method' => 'post', 'action' => $this->form_action]); diff --git a/application/modules/opac/views/scripts/head.phtml b/application/modules/opac/views/scripts/head.phtml index bb0f428ecc23a1c4ccabde2064e67c8d387c2edd..759cebcf4bd71cb9d3aae171ee52af358fa6aa5a 100644 --- a/application/modules/opac/views/scripts/head.phtml +++ b/application/modules/opac/views/scripts/head.phtml @@ -28,9 +28,7 @@ BASE_URL, URL_IMG, URL_CSS, USERFILESURL)) ->addAdminScripts(['onload_utils', 'global', 'toolbar', 'common']) - ->addOPACScripts(['abonne', - 'menu', - 'bib', + ->addOPACScripts(['menu', 'avis', 'recherche', 'accessibility', diff --git a/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/AnnexeControllerTest.php b/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/AnnexeControllerTest.php index 49621af55141715845247ee69be3288b419f8e43..279d4d0525c57f8a5638380da6926fedc4ad5c78 100644 --- a/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/AnnexeControllerTest.php +++ b/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/AnnexeControllerTest.php @@ -201,6 +201,7 @@ class AnnexeControllerPostEditActionTest extends AnnexeControllerTestCase { /** @test */ public function shouldRedirectToEdit() { + $this->assertRedirect(); $this->assertRedirectTo('/cosmo/annexe/edit/id/98'); } diff --git a/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerTest.php b/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerTest.php index 6c3ece4ec663a8b3ab5d4297844f94e22065ec51..6a24006b6cbc992c92ca22e6cb6920ff323cbd4e 100644 --- a/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerTest.php +++ b/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerTest.php @@ -63,6 +63,15 @@ abstract class Cosmo_DataProfileControllerTestCase extends CosmoControllerTestCa 'valeur' => null, 'liste' => "k:995$k\r\nf:995$f"]); } + + + public function tearDown() { + Class_IntProfilDonnees::clearCache(); + Class_CosmoVar::clearCache(); + Class_TypeDoc::clearCache(); + Class_ScriptLoader::resetInstance(); + parent::tearDown(); + } } @@ -193,6 +202,7 @@ class Cosmo_DataProfileControllerEditUnimarcKohaTest extends Cosmo_DataProfileCo $this->dispatch('cosmo/data-profile/edit/id/56', true); } + /** @test */ public function labelShouldBePresent() { $this->assertXPath('//form//input[@type="text"][@name="libelle"][@value= "Unimarc Koha"]'); diff --git a/index.php b/index.php index 8cffd349abccb366f8ec12ff41c157f3a7cc5ca1..3b48768698644af2f072ed407abecd5918dec141 100644 --- a/index.php +++ b/index.php @@ -21,7 +21,7 @@ // Run Bokeh installer if not configured if ((!file_exists('local.php') || !file_exists('config.ini') || !file_exists('cosmogramme/config.php')) && file_exists('scripts/install-bokeh.php')) { - include('scripts/install-bokeh.php'); + include('scripts/install-bokeh.php'); } require('includes.php'); diff --git a/library/Class/Admin/Skin.php b/library/Class/Admin/Skin.php index 960da7b51ec7a2216cb5af2fb6761bada75d3e12..0599f9e7647c7daf16199baa2ad9764b7eaa457b 100644 --- a/library/Class/Admin/Skin.php +++ b/library/Class/Admin/Skin.php @@ -39,8 +39,8 @@ class Class_Admin_Skin { public static function current() { $user = Class_Users::getIdentity() - ? Class_Users::getIdentity() - : new Class_Users(); + ? Class_Users::getIdentity() + : new Class_Users(); return $user->getAdminSkin(); } @@ -136,20 +136,39 @@ class Class_Admin_Skin { public function renderButtonCssOn($script_loader) { + return $this->_renderCssOn($script_loader, 'buttons.css'); + } + + + public function renderFormCssOn($script_loader) { + return $this->_renderCssOn($script_loader, 'form.css'); + } + + + public function renderJQueryCssOn($script_loader) { + return $this->_renderCssOn($script_loader, 'jquery.css'); + } + + + protected function _renderCssOn($script_loader, $css) { $script_loader - ->addStyleSheets(array_merge([$this->_getSkinUrl() . 'buttons.css'], - $this->_getBaseStyleSheets())); + ->addStyleSheets($this->_addColorsCss($css)); return $this; } public function getStyleSheets() { - return array_merge([$this->_getSkinUrl() . 'global.css'], - $this->_getBaseStyleSheets()); + return $this->_addColorsCss('global.css'); + } + + + protected function _addColorsCss($css) { + return array_merge([$this->_getSkinUrl() . $css], + $this->_getColorsStyleSheets()); } - protected function _getBaseStyleSheets() { + protected function _getColorsStyleSheets() { return array_filter([$this->_getSkinUrl() . 'colors.css', ($this->_color ? $this->_getSkinUrl() . static::ADMIN_COLORS_FOLDER . $this->_color diff --git a/library/Class/CVSLink.php b/library/Class/CVSLink.php index ed964a46289f56e3b90125447673dafe6ea07c32..e4b97d88878855b6e73581cd2067fd9d0cb84704 100644 --- a/library/Class/CVSLink.php +++ b/library/Class/CVSLink.php @@ -38,7 +38,7 @@ class Class_CVSLink { public static function staticLink() { - return Class_Url::assemble(['controller' => 'modules', 'action' => 'cvs']); + return ['controller' => 'modules', 'action' => 'cvs']; } diff --git a/library/Class/KidilanguesLink.php b/library/Class/KidilanguesLink.php index 5470060d2ca6e9ec2cf649f502faae509df68c8d..4b107e856cb5055907eb04d553e121cde5296913 100644 --- a/library/Class/KidilanguesLink.php +++ b/library/Class/KidilanguesLink.php @@ -24,8 +24,8 @@ class Class_KidilanguesLink { public static function staticUrl() { - return Class_Url::assemble(['controller' => 'modules', - 'action' => 'kidilangues']); + return ['controller' => 'modules', + 'action' => 'kidilangues']; } diff --git a/library/Class/LeSocialLink.php b/library/Class/LeSocialLink.php index 7339a555b8b22f3b2e1391e5e6b244a5cbf98ee6..1fee7f07e60b968ec4598eef20276d7bc2d8b37a 100644 --- a/library/Class/LeSocialLink.php +++ b/library/Class/LeSocialLink.php @@ -29,8 +29,8 @@ class Class_LeSocialLink { } public static function staticUrl() { - return Class_Url::assemble(['controller' => 'modules', - 'action' => 'lesocial']); + return ['controller' => 'modules', + 'action' => 'lesocial']; } diff --git a/library/Class/Profil.php b/library/Class/Profil.php index 4d33dfbd5f502c2beea48c2e6f1bc8ab9b2073f8..7a36ba3238c0b03bb4af7a47fa930250facb61bb 100644 --- a/library/Class/Profil.php +++ b/library/Class/Profil.php @@ -704,7 +704,7 @@ class Class_Profil extends Storm_Model_Abstract { // réserve l'id pour ne pas redonner 2 fois le même $cfg_accueil = $this->getCfgAccueilAsArray(); - $cfg_accueil['modules'][$new_id] = ['preferences' => ['id_module' => $new_id]]; + $cfg_accueil['modules'][$new_id]['id_module'] = $cfg_accueil['modules'][$new_id]['preferences']['id_module'] = $new_id; $this->setCfgAccueil($cfg_accueil); return $new_id; @@ -902,10 +902,12 @@ class Class_Profil extends Storm_Model_Abstract { try { $unserialized = ZendAfi_Filters_Serialize::unserialize($data); } catch (Exception $e) { - $unserialized = array(); + $unserialized = []; } - if (!$unserialized) return array(); + if (!$unserialized) + return []; + return $unserialized; } @@ -1873,7 +1875,6 @@ class Class_Profil extends Storm_Model_Abstract { $menus = $this->getCfgMenusAsArray(); $menus ['H']= $cfg_menu_horizontal; return $this->setCfgMenus($menus); - } diff --git a/library/Class/ScriptLoader.php b/library/Class/ScriptLoader.php index acfb2ad49a5098076d652a1ce1e49c79ecc34c4c..da4247daeffe2b427c96c0fbb54cb487e69d58fe 100644 --- a/library/Class/ScriptLoader.php +++ b/library/Class/ScriptLoader.php @@ -514,7 +514,8 @@ class Class_ScriptLoader { * @return ScriptLoader */ public function _scriptsAddLine($line) { - $this->_script_lines []= $line; + $this->_script_lines[] = $line; + array_unique($this->_script_lines); return $this; } @@ -523,7 +524,8 @@ class Class_ScriptLoader { * @return ScriptLoader */ public function cssAddLine($line) { - $this->_css_lines []= $line; + $this->_css_lines[] = $line; + array_unique($this->_css_lines); return $this; } @@ -808,7 +810,7 @@ class Class_ScriptLoader { return $this->_addSearchInput('.main > .modules', 'input_content_menu', $label, - 'table, thead, th , .form, .form *, center, center *, br, .bouton, a *, a, img, h1, h3, h3 + div , .error, h3 + div *, .soustitre, .soustitre *, tr *, #progressbar, #progressbar *'); + 'table, thead, th , .form, .form *, center, center *, br, .bouton, a *, a, img, h1, h3, h3 + div , .error, h3 + div *, .soustitre, .soustitre *, tr *, #progressbar, #progressbar *, button'); } @@ -816,7 +818,7 @@ class Class_ScriptLoader { return $this->_addSearchInput('.main > .left', 'input_search_menu', $label, - '.menuGaucheAdmin tr, .titre, img, table, tbody, td'); + '.menuGaucheAdmin tr, .titre, img, table, tbody, td, button'); } diff --git a/library/Class/Systeme/MenuHorizontal.php b/library/Class/Systeme/MenuHorizontal.php index a28d09b773f75e08d5b215e047a705cef5cc0846..0518a8be118dac2560d2c949c25cdc4d4db6924d 100644 --- a/library/Class/Systeme/MenuHorizontal.php +++ b/library/Class/Systeme/MenuHorizontal.php @@ -16,33 +16,40 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class Class_Systeme_MenuHorizontal { - protected + protected + $_is_child = false, $_cfg_menus, - $_current_id_module, + $_current_id_module = 0, $_index_menus = []; public function __construct($cfg_menus) { - $this->_cfg_menus=$cfg_menus; - $this->_current_id_module = 0; - $this->injectIdModuleInMenus($this->_cfg_menus); + $this->_cfg_menus = $this->injectIdModuleInMenus($cfg_menus); } - public function injectIdModuleInMenus(&$menus) { - for($i=0;$i<count($menus);$i++) { - $menus[$i]['id_module'] = $this->_current_id_module; + public function injectIdModuleInMenus($menus) { + $menus_with_ids = []; - $this->_index_menus[$this->_current_id_module] = &$menus[$i]; + foreach($menus as $menu) { + $menu['id_module'] = $this->_current_id_module; + $menus_with_ids[$this->_current_id_module] + = $this->_index_menus[$this->_current_id_module] + = $menu; + + if (isset($menu['sous_menus']) + && !empty($menu['sous_menus'])) + $menus_with_ids[$this->_current_id_module]['sous_menus'] + = $this->injectIdModuleInMenus($menu['sous_menus'], $this->_current_id_module++); $this->_current_id_module++; - if (isset($menus[$i]['sous_menus']) && !empty($menus[$i]['sous_menus'])) - $this->injectIdModuleInMenus($menus[$i]['sous_menus']); } + + return $menus_with_ids; } @@ -59,9 +66,9 @@ class Class_Systeme_MenuHorizontal { public function updatePreferencesForModule($id_module, $preferences) { - $this->_index_menus[$id_module]['preferences'] = $preferences; + $this->_cfg_menus[$id_module]['preferences'] + = $this->_index_menus[$id_module]['preferences'] + = $preferences; return $this; } -} - -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAbstract.php b/library/Class/Systeme/ModulesAbstract.php index dc15daad675e3864bd2f121402822ee9b076c113..99f69c5f43c74025405733fbd33d28c2ba09396d 100644 --- a/library/Class/Systeme/ModulesAbstract.php +++ b/library/Class/Systeme/ModulesAbstract.php @@ -16,9 +16,11 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class Class_Systeme_ModulesAbstract { + use Trait_Translator; + /** * @var array */ diff --git a/library/Class/Systeme/ModulesAccueil.php b/library/Class/Systeme/ModulesAccueil.php index 0d3979629d00da552fb0b273ad85bb7a88265f7b..220b96f62cfb92159f441cb430061ca4110fff3f 100644 --- a/library/Class/Systeme/ModulesAccueil.php +++ b/library/Class/Systeme/ModulesAccueil.php @@ -28,18 +28,6 @@ class Class_Systeme_ModulesAccueil extends Class_Systeme_ModulesAbstract { const GROUP_SITE = 'ACCUEIL_SITE'; const GROUP_ABONNE = 'ACCUEIL_ABONNE'; - /** - * @var array - */ - protected $_groupes = array( - self::GROUP_INFO => "Modules Information", - self::GROUP_RECH => "Modules Recherche", - self::GROUP_SITE => "Modules Site", - self::GROUP_ABONNE => "Modules Abonné" - ); - - - /** * @var array */ @@ -67,6 +55,19 @@ class Class_Systeme_ModulesAccueil extends Class_Systeme_ModulesAbstract { } + public function __construct() { + $this->initGroups(); + } + + + public function initGroups() { + return $this->_groupes = [self::GROUP_INFO => $this->_('Boites d\'informations'), + self::GROUP_RECH => $this->_('Boites de recherche'), + self::GROUP_SITE => $this->_('Boites du site'), + self::GROUP_ABONNE => $this->_('Boites d\'abonné')]; + } + + /** * @param string $code * @return Class_Systeme_ModulesAccueil_Null or subclass @@ -81,6 +82,11 @@ class Class_Systeme_ModulesAccueil extends Class_Systeme_ModulesAbstract { } + public function getFonction($type) { + return $this->getModuleByCode($type); + } + + /** * @return array */ @@ -137,4 +143,26 @@ class Class_Systeme_ModulesAccueil extends Class_Systeme_ModulesAbstract { return self::$_modules; } + + + public static function getWidgets() { + $profil = Class_Profil::getCurrentProfil(); + $modules_accueil = Class_Systeme_ModulesAccueil::getInstance(); + $modules = $modules_accueil->getModules(); + $groupes = $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] = []; + + $hierarchy[$group_label][$type] = $module->getLibelle(); + } + + return $hierarchy; + } } diff --git a/library/Class/Systeme/ModulesAccueil/BibliothequeNumerique.php b/library/Class/Systeme/ModulesAccueil/BibliothequeNumerique.php index 69907324e9fbdc99df73549210f825965c146952..f3a66f714df397db95d5ec9b63318b04423be078 100644 --- a/library/Class/Systeme/ModulesAccueil/BibliothequeNumerique.php +++ b/library/Class/Systeme/ModulesAccueil/BibliothequeNumerique.php @@ -18,70 +18,58 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesAccueil_BibliothequeNumerique extends Class_Systeme_ModulesAccueil_Null { - const DISPLAY_TREE = 'displayTree'; - const DISPLAY_ALBUM_TEASER = 'displayAlbumTeaser'; - const DISPLAY_PAGINATED = 'displayPaginated'; - - const ORDER_SELECTION = 'orderRespect'; - const ORDER_RANDOM = 'orderRandom'; - const ORDER_RECENT = 'orderRecent'; - - /** @var array */ - protected $_displayModes = [self::DISPLAY_TREE => 'Arborescence', - self::DISPLAY_ALBUM_TEASER => 'Mise en avant d\'un album', - self::DISPLAY_PAGINATED => 'Affichage paginé']; - - /** @var array */ - protected $_orderModes = [self::ORDER_SELECTION => 'Par ordre de sélection', - self::ORDER_RANDOM => 'Par ordre aléatoire', - self::ORDER_RECENT => 'Les plus récents']; - - /** @var string */ - protected $_group = Class_Systeme_ModulesAccueil::GROUP_INFO; - - /** @var string */ - protected $_libelle = 'Bibliothèque numérique'; - /** @var string */ - protected $_action = 'bibliotheque-numerique'; - - /** @var int */ - protected $_popupWidth = 800; - - /** @var int */ - protected $_popupHeight = 700; - - /** @var bool */ - protected $_isPhone = true; +class Class_Systeme_ModulesAccueil_BibliothequeNumerique extends Class_Systeme_ModulesAccueil_Null { - /** @var array */ - protected $_defaultValues = array('titre' => 'Bibliothèque numérique', // Titre de la boite - 'id_categories' => '', // séparés par des - - 'type_aff' => self::DISPLAY_TREE, // mode d'affichage - 'nb_aff' => '', // nb à afficher - 'nb_aff_by_page' => '2', - 'id_items' => '', - 'id_albums' => '', // séparés par des - - 'display_order' => self::ORDER_SELECTION, // mode de tri, - ); + const + DISPLAY_TREE = 'displayTree', + DISPLAY_ALBUM_TEASER = 'displayAlbumTeaser', + DISPLAY_PAGINATED = 'displayPaginated', + ORDER_SELECTION = 'orderRespect', + ORDER_RANDOM = 'orderRandom', + ORDER_RECENT = 'orderRecent'; + + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_INFO, + $_action = 'bibliotheque-numerique', + $_popupWidth = 800, + $_popupHeight = 700, + $_isPhone = true; + + + public function __construct() { + $this->_libelle = $this->_('Boite bibliothèque numérique'); + $this->_form = 'ZendAfi_Form_Configuration_Widget_Albums'; + $this->_defaultValues = ['titre' => $this->_libelle, + 'id_categories' => '', + 'type_aff' => self::DISPLAY_TREE, + 'nb_aff' => '', + 'nb_aff_by_page' => '2', + 'id_items' => '', + 'id_albums' => '', + 'display_order' => self::ORDER_SELECTION]; + + $this->_displayModes = [self::DISPLAY_TREE => $this->_('Arborescence'), + self::DISPLAY_ALBUM_TEASER => $this->_('Mise en avant d\'un album'), + self::DISPLAY_PAGINATED => $this->_('Affichage paginé')]; + + $this->_orderModes = [self::ORDER_SELECTION => $this->_('par ordre de sélection'), + self::ORDER_RANDOM => $this->_('par ordre aléatoire'), + self::ORDER_RECENT => $this->_('les plus récents')]; + } - /** @return array */ public function getDisplayModes() { return $this->_displayModes; } - /** @return array */ public function getOrderModes() { return $this->_orderModes; } - /** @return boolean */ public function isVisibleForProfil($profil) { return Class_AdminVar::isBibNumEnabled(); } -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/Calendrier.php b/library/Class/Systeme/ModulesAccueil/Calendrier.php index ba4afc5ddb49324bd10ea9c057132462bb49a500..43a8fa2a46f54120570ee5a46c2b59cee017c812 100644 --- a/library/Class/Systeme/ModulesAccueil/Calendrier.php +++ b/library/Class/Systeme/ModulesAccueil/Calendrier.php @@ -18,48 +18,37 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesAccueil_Calendrier extends Class_Systeme_ModulesAccueil_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesAccueil::GROUP_INFO; - /** @var string */ - protected $_libelle = 'Calendrier'; +class Class_Systeme_ModulesAccueil_Calendrier extends Class_Systeme_ModulesAccueil_Null { - /** @var string */ - protected $_action = 'calendrier'; + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_INFO, + $_action = 'calendrier', + $_popupWidth = 800, + $_popupHeight = 700, + $_isPhone = true; - /** @var int */ - protected $_popupWidth = 800; - /** @var int */ - protected $_popupHeight = 700; - - /** @var bool */ - protected $_isPhone = true; - - /** @var array */ - protected $_defaultValues = - [ - 'titre' => 'Calendrier des animations', // Titre de la boite - 'id_categorie' => '', // Catégories d'articles à afficher. ex: 2-3-4 - 'display_cat_select' => false, // Afficher le sélecteur de catégories - // Information à afficher en préfixed du titre de l'article: bib, cat ou none. - 'display_event_info'=> false, - 'rss_avis' => false, //RSS - - 'display_next_event' => '1',//Afficher Prochains rendez-vous - 'display_order' => 'EventDebut', //Tri des articles - 'display_mode' => 'Title', // Mode d'affichage Title, Summary, FullArticle, - 'display_full_page' => '1', // Transforme les url en render/ajax si 0 - 'nb_events' => '3', // Nombre de rendez-vous à afficher - 'display_calendar' => '1', // Mode d'affichage du calendrier: 0 (caché) / 1 (calendrier) / 2 (frise chrono) - 'mode-affichage' => 'simple', // mode d'affichage des prochains événements dans la boite: none (aucun) / simple (titre + catégorie ou bib) / article (résumé article) - 'event_filter' => 'none', // filtre les articles par mois à l'affichage - 'enabled_filters' => '' // liste des filtres (mois, lieu, custom_fields) d'articles - ]; + public function __construct() { + $this->_libelle = $this->_('Boite calendrier'); + $this->_form = 'ZendAfi_Form_Configuration_Widget_Calendar'; + $this->_defaultValues = ['titre' => $this->_libelle, + 'id_categorie' => '', + 'display_cat_select' => false, + 'display_event_info'=> false, + 'rss_avis' => false, + 'display_next_event' => '1', + 'display_order' => 'EventDebut', + 'display_mode' => 'Title', + 'display_full_page' => '1', + 'nb_events' => '3', + 'display_calendar' => '1', + 'mode-affichage' => 'simple', + 'event_filter' => 'none', + 'enabled_filters' => '']; + } - /** @return array */ public function getProperties() { $properties = parent::getProperties(); $properties['display_event_info'] = 'bib'; @@ -67,15 +56,14 @@ class Class_Systeme_ModulesAccueil_Calendrier extends Class_Systeme_ModulesAccue } public function getAvailableFilters() { - $available_filters = [ - 'date' => $this->_('Mois'), - 'place' => $this->_('Lieu'), - ]; + $available_filters = ['date' => $this->_('Mois'), + 'place' => $this->_('Lieu')]; + $custom_fields = Class_CustomField_Model::getModel('Article')->getFields(); - foreach ($custom_fields as $field) { + + foreach ($custom_fields as $field) $available_filters['custom_field_' . $field->getId()] = $field->getLabel(); - } + return $available_filters; } -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/CarteZones.php b/library/Class/Systeme/ModulesAccueil/CarteZones.php index 3b3af39b038378b6227a7365f23fa6c86e69f36b..29e40d4cf9edc4ef8902c732d8c96acafaa53784 100644 --- a/library/Class/Systeme/ModulesAccueil/CarteZones.php +++ b/library/Class/Systeme/ModulesAccueil/CarteZones.php @@ -16,31 +16,23 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesAccueil_CarteZones extends Class_Systeme_ModulesAccueil_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesAccueil::GROUP_SITE; - - /** @var string */ - protected $_libelle = 'Carte des zones'; - /** @var string */ - protected $_action = 'cartezones'; +class Class_Systeme_ModulesAccueil_CarteZones extends Class_Systeme_ModulesAccueil_Null { - /** @var int */ - protected $_popupWidth = 570; + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_SITE, + $_action = 'cartezones', + $_popupWidth = 570, + $_popupHeight = 262, + $_isPhone = false; - /** @var int */ - protected $_popupHeight = 262; - /** @var bool */ - protected $_isPhone = false; - - /** @var array */ - protected $_defaultValues = array( - 'titre' => "Rechercher une bibliothèque", // Titre de la boite - 'message_carte' => "Message sous la carte", // Message sous la carte - ); -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Boite carte des zones'); + $this->_form = 'ZendAfi_Form_Configuration_Widget_Zones'; + $this->_defaultValues = ['titre' => $this->_('Rechercher une bibliothèque'), + 'message_carte' => $this->_('Message sous la carte')]; + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/Catalogue.php b/library/Class/Systeme/ModulesAccueil/Catalogue.php deleted file mode 100644 index afbe9e8e5cb3b1cc906e588369aec968aa9a5dbb..0000000000000000000000000000000000000000 --- a/library/Class/Systeme/ModulesAccueil/Catalogue.php +++ /dev/null @@ -1,56 +0,0 @@ -<?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 Class_Systeme_ModulesAccueil_Catalogue extends Class_Systeme_ModulesAccueil_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesAccueil::GROUP_RECH; - - /** @var string */ - protected $_libelle = 'Catalogue de notices'; - - /** @var string */ - protected $_action = 'catalogue'; - - /** @var int */ - protected $_popupWidth = 570; - - /** @var int */ - protected $_popupHeight = 545; - - /** @var bool */ - protected $_isPhone = false; - - /** @var array */ - protected $_defaultValues = array( - 'message' => "message du dessus", // Message place au dessus de la boite - 'notices' => 2, // Notices a afficher 0=toutes, 1=les plus consultees, 2=les nouveautés - 'format' => 4, // Format affichage (4=bookflip) - 'ordre' => "", // Affichage (0=par ordre, 1=aléatoire) - 'type_doc' => "", // Types de docs (codes) - 'section' => "", // Sections (codes) - 'genre' => "", // Genres (codes) - 'dewey' => "", // Dewey (commence par) - 'pcdm4' => "", // Pcdm4 (commence par) - 'matiere' => "", // Matieres (codes) - 'nb_requete' => 200, // Nbre de notices à analyser - 'nb_aff' => 10, // Nombre de notices a afficher - ); -} -?> \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/Compteurs.php b/library/Class/Systeme/ModulesAccueil/Compteurs.php index 70a9b6ed04e8bb76e396b105d7216488ef55571f..222071984c6382417b17105ebae39d6b5b5a4642 100644 --- a/library/Class/Systeme/ModulesAccueil/Compteurs.php +++ b/library/Class/Systeme/ModulesAccueil/Compteurs.php @@ -16,31 +16,24 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesAccueil_Compteurs extends Class_Systeme_ModulesAccueil_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesAccueil::GROUP_SITE; - - /** @var string */ - protected $_libelle = 'Compteurs statistiques'; - /** @var string */ - protected $_action = 'compteurs'; +class Class_Systeme_ModulesAccueil_Compteurs extends Class_Systeme_ModulesAccueil_Null { - /** @var int */ - protected $_popupWidth = 570; + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_SITE, + $_libelle = 'Compteurs statistiques', + $_action = 'compteurs', + $_popupWidth = 570, + $_popupHeight = 400, + $_isPhone = false; - /** @var int */ - protected $_popupHeight = 400; - /** @var bool */ - protected $_isPhone = false; - - /** @var array */ - protected $_defaultValues = array( - 'titre' => '', - 'nb_notices' => 1, // Nombre de notices en fonction des bibs sélectionnées - ); -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Boite compteurs statistiques'); + $this->_form = 'ZendAfi_Form_Configuration_Widget_Statistics'; + $this->_defaultValues = ['titre' => $this->_libelle, + 'nb_notices' => 1]; + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/ConteneurDeuxColonnes.php b/library/Class/Systeme/ModulesAccueil/ConteneurDeuxColonnes.php index add8c3d39f98500587bfd1e95a34ed884ea39c29..b55eb250340cb6957f6bf912f6418c1063dfa9fa 100644 --- a/library/Class/Systeme/ModulesAccueil/ConteneurDeuxColonnes.php +++ b/library/Class/Systeme/ModulesAccueil/ConteneurDeuxColonnes.php @@ -18,47 +18,50 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesAccueil_ConteneurDeuxColonnes extends Class_Systeme_ModulesAccueil_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesAccueil::GROUP_SITE; - /** @var string */ - protected $_libelle = 'Boite deux colonnes'; +class Class_Systeme_ModulesAccueil_ConteneurDeuxColonnes extends Class_Systeme_ModulesAccueil_Null { - /** @var string */ - protected $_action = 'conteneur2colonnes'; + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_SITE, + $_action = 'conteneur2colonnes', + $_popupWidth = 570, + $_popupHeight = 400, + $_isPhone = false; - /** @var int */ - protected $_popupWidth = 570; - /** @var int */ - protected $_popupHeight = 400; + public function __construct() { + $this->_libelle = $this->_('Boite deux colonnes'); + $this->_form = 'ZendAfi_Form_Configuration_Widget_TwoWidgets'; + $this->_defaultValues = ['titre' => $this->_libelle, + 'col_gauche_type' => "NEWS", + 'col_droite_type' => "CRITIQUES"]; + } + - /** @var bool */ - protected $_isPhone = false; + public function updateHook($datas) { + foreach(['gauche', 'droite'] as $column) { + $key = 'col_' . $column .'_module_id'; + $datas [$key] = $datas['preferences'][$key] = static::createModuleForCol($column, $datas, $datas['id_module'], $datas['profile_id']); + } - /** @var array */ - protected $_defaultValues = array( - 'titre' => "A la une", - 'col_gauche_type' => "NEWS", - 'col_droite_type' => "CRITIQUES", - ); + return $datas; + } - public static function createModuleForCol($colonne, $preferences, $parent_id) { + public static function createModuleForCol($colonne, $preferences, $parent_id, $profile_id = null) { $id_key = 'col_'.$colonne.'_module_id'; $type_key = 'col_'.$colonne.'_type'; $type_module = $preferences[$type_key]; - $profil = Class_Profil::getCurrentProfil(); - - $id_module = self::getOrCreateModuleForCol($profil, $parent_id, $type_module, $colonne); + $profil = $profile_id ? Class_Profil::find($profile_id) : Class_Profil::getCurrentProfil(); + $id_module = static::getOrCreateModuleForCol($profil, $parent_id, $type_module, $colonne); $config = ['preferences' => self::getOrCreateModulePref($profil, $id_module, $type_module), + 'id_module' => $id_module, 'type_module' => $type_module, 'parent_id' => $parent_id]; $my_config = $profil->getModuleAccueilConfig($parent_id, $type_module); - $my_config['preferences'][$id_key] = $id_module; + $my_config[$id_key] = $my_config['preferences'][$id_key] = $id_module; $profil ->updateModuleConfigAccueil($id_module, $config); @@ -74,6 +77,7 @@ class Class_Systeme_ModulesAccueil_ConteneurDeuxColonnes extends Class_Systeme_M public static function getOrCreateModuleForCol($profil, $id, $type_module, $colonne) { if(!$id = $profil->getModuleIdFromCol($id, $type_module, $colonne)) return $profil->createNewModuleAccueilId(1000); + return $id; } @@ -83,5 +87,4 @@ class Class_Systeme_ModulesAccueil_ConteneurDeuxColonnes extends Class_Systeme_M return (new Class_Systeme_ModulesAccueil())->getValeursParDefaut($type_module); return $pref; } -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/Critiques.php b/library/Class/Systeme/ModulesAccueil/Critiques.php index 809e05f3e4575c97c497d764ecd07824e6ee3795..43a356ec6299a39beed157047382b7181d40b7a0 100644 --- a/library/Class/Systeme/ModulesAccueil/Critiques.php +++ b/library/Class/Systeme/ModulesAccueil/Critiques.php @@ -19,36 +19,28 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class Class_Systeme_ModulesAccueil_Critiques extends Class_Systeme_ModulesAccueil_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesAccueil::GROUP_INFO; - /** @var string */ - protected $_libelle = 'Critiques'; + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_INFO, + $_action = 'critiques', + $_popupWidth = 570, + $_popupHeight = 520, + $_isPhone = true; - /** @var string */ - protected $_action = 'critiques'; - /** @var int */ - protected $_popupWidth = 570; - - /** @var int */ - protected $_popupHeight = 520; - - /** @var bool */ - protected $_isPhone = true; - - /** @var array */ - protected $_defaultValues = ['titre' => "Dernières critiques", // Titre du bloc critiques - 'nb_aff_avis' => 2, // Nombre de critiques à afficher - 'nb_words' => 30, // Couper les critiques à X mots - 'display_order' => "Random", // Affichage par ordre aléatoire - 'rss_avis' => "1", // Proposer le flux RSS - 'only_img' => '1', - 'id_panier' => 0, - 'id_catalogue' => 0, - 'abon_ou_bib' => 0, - 'tri' => 0, //tri par titre - 'hierarchical' => 0, - ]; -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Boite critiques'); + $this->_form = 'ZendAfi_Form_Configuration_Widget_Reviews'; + $this->_defaultValues = ['titre' => $this->_libelle, + 'nb_aff_avis' => 2, + 'nb_words' => 30, + 'display_order' => "Random", + 'rss_avis' => "1", + 'only_img' => '1', + 'id_panier' => 0, + 'id_catalogue' => 0, + 'abon_ou_bib' => 0, + 'tri' => 0, + 'hierarchical' => 0]; + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/DomainBrowser.php b/library/Class/Systeme/ModulesAccueil/DomainBrowser.php index 5df794d1167124e1c465ec275acd8f970717e118..ba86983aacab3f2827f9fd9694e2853f00e40d7d 100644 --- a/library/Class/Systeme/ModulesAccueil/DomainBrowser.php +++ b/library/Class/Systeme/ModulesAccueil/DomainBrowser.php @@ -19,26 +19,21 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -class Class_Systeme_ModulesAccueil_DomainBrowser extends Class_Systeme_ModulesAccueil_Null{ - - protected $_group = Class_Systeme_ModulesAccueil::GROUP_RECH; - - protected $_libelle = 'Domaines'; - - protected $_action = 'domain-browser'; - - protected $_popupWidth = 600; - - - protected $_popupHeight = 700; - - protected $_defaultValues = ['titre' => 'Domaines', - 'allow_breadcrumb' => 0, - 'root_domain_id' => 0, - 'display_mode' => Class_Systeme_ModulesAppli::LISTE_FORMAT_ACCORDEON]; - - - -} -?> \ No newline at end of file +class Class_Systeme_ModulesAccueil_DomainBrowser extends Class_Systeme_ModulesAccueil_Null { + + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_RECH, + $_action = 'domain-browser', + $_popupWidth = 600, + $_popupHeight = 700; + + + public function __construct() { + $this->_libelle = $this->_('Boite domaines'); + $this->_form = 'ZendAfi_Form_Configuration_Widget_Domains'; + $this->_defaultValues = ['titre' => $this->_libelle, + 'allow_breadcrumb' => 0, + 'root_domain_id' => 0, + 'display_mode' => Class_Systeme_ModulesAppli::LISTE_FORMAT_ACCORDEON]; + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/Formations.php b/library/Class/Systeme/ModulesAccueil/Formations.php index f5b778009daa2a55f08c36a649dab2b68b8ddd00..3ec4a3f13bbbffe0cf4a8a577d5c842123699119 100644 --- a/library/Class/Systeme/ModulesAccueil/Formations.php +++ b/library/Class/Systeme/ModulesAccueil/Formations.php @@ -19,30 +19,30 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - class Class_Systeme_ModulesAccueil_Formations extends Class_Systeme_ModulesAccueil_Null { - const DISPLAY_TABLE='Table'; - const DISPLAY_BLOC ='Block'; - const DISPLAY_NO_GROUP = 'NoGroup'; - const DISPLAY_GROUP_BY_YEAR = 'ByYear'; - const ORDER_BY_SELECTION = 'selection'; - const ORDER_BY_CONTRIBUTORS='contributors'; - const ORDER_BY_CREATION_ID='creation'; - - protected $_group = Class_Systeme_ModulesAccueil::GROUP_INFO; - - protected $_libelle = 'Formations'; - - protected $_action = 'formations-widget'; - - protected $_popupWidth = 900; - - protected $_popupHeight = 700; - - protected $_defaultValues = ['titre' => 'Formations', - 'selected_formations' => '', - 'display_mode' => self::DISPLAY_TABLE, - 'display_order' => self::ORDER_BY_SELECTION, - 'display_group_mode' => self::DISPLAY_GROUP_BY_YEAR]; -} -?> \ No newline at end of file + const + DISPLAY_TABLE='Table', + DISPLAY_BLOC ='Block', + DISPLAY_NO_GROUP = 'NoGroup', + DISPLAY_GROUP_BY_YEAR = 'ByYear', + ORDER_BY_SELECTION = 'selection', + ORDER_BY_CONTRIBUTORS='contributors', + ORDER_BY_CREATION_ID='creation'; + + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_INFO, + $_action = 'formations-widget', + $_popupWidth = 900, + $_popupHeight = 700; + + + public function __construct() { + $this->_libelle = $this->_('Boite formations'); + $this->_form = 'ZendAfi_Form_Configuration_Widget_Formations'; + $this->_defaultValues = ['titre' => $this->_libelle, + 'selected_formations' => '', + 'display_mode' => self::DISPLAY_TABLE, + 'display_order' => self::ORDER_BY_SELECTION, + 'display_group_mode' => self::DISPLAY_GROUP_BY_YEAR]; + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/HistoriqueRecherches.php b/library/Class/Systeme/ModulesAccueil/HistoriqueRecherches.php index e9fb8d39ac51860e10a93856eabac84bfcc12c74..d827001ceba50a958466ee133384cb79f067b6c0 100644 --- a/library/Class/Systeme/ModulesAccueil/HistoriqueRecherches.php +++ b/library/Class/Systeme/ModulesAccueil/HistoriqueRecherches.php @@ -16,28 +16,20 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesAccueil_HistoriqueRecherches extends Class_Systeme_ModulesAccueil_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesAccueil::GROUP_ABONNE; - - /** @var string */ - protected $_libelle = 'Historique recherches'; +class Class_Systeme_ModulesAccueil_HistoriqueRecherches extends Class_Systeme_ModulesAccueil_Null { - /** @var string */ - protected $_action = 'historique-recherches'; + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_ABONNE, + $_action = 'historique-recherches', + $_popupWidth = 570, + $_popupHeight = 400; - /** @var int */ - protected $_popupWidth = 570; - /** @var int */ - protected $_popupHeight = 400; - - /** @var array */ - protected $_defaultValues = array( - 'titre' => "Mes recherches", // Titre de la boite - ); - -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Boite historique recherches'); + $this->_form = 'ZendAfi_Form_Configuration_Widget_Base'; + $this->_defaultValues = ['titre' => $this->_('Mes recherches')]; + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/Kiosque.php b/library/Class/Systeme/ModulesAccueil/Kiosque.php index 099dcb918b3525857159533a6fceccc1c7fa353a..4a44c58259764954b0de5a9a256a34708551e4e6 100644 --- a/library/Class/Systeme/ModulesAccueil/Kiosque.php +++ b/library/Class/Systeme/ModulesAccueil/Kiosque.php @@ -18,57 +18,46 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesAccueil_Kiosque extends Class_Systeme_ModulesAccueil_Null{ +class Class_Systeme_ModulesAccueil_Kiosque extends Class_Systeme_ModulesAccueil_Null { const FAMILY_HTML = 'html'; const FAMILY_JAVA = 'java'; const FAMILY_FLASH= 'flash'; - /** @var string */ - protected $_group = Class_Systeme_ModulesAccueil::GROUP_RECH; - - /** @var string */ - protected $_libelle = 'Kiosque de notices'; - - /** @var string */ - protected $_action = 'kiosque'; - - /** @var int */ - protected $_popupWidth = 700; - - /** @var int */ - protected $_popupHeight = 800; - - /** @var bool */ - protected $_isPhone = true; - - /** @var array */ - protected $_styles; - - - /** @var array */ - protected $_defaultValues = - ['titre' => "Kiosque", // Titre de la boite - 'style_liste' => "slide_show", // Style de representation (objets flash ou js) - 'nb_notices' => 20, // Nombre de notices a afficher - 'only_img' => 1, // Notices avec vignettes - 'aleatoire' => 1, // 0=non,1=oui - 'tri' => 1, // 0=alpha,1=par date de creation,2=les plus consultées - 'nb_analyse' => 50, // nbre a analyser pour le mode aleatoire - 'op_hauteur_img' => 0, // hauteur des vignettes - 'op_transition' => '', //type de transition pour le diaporama - 'op_largeur_img' => 0, //largeur des vignettes - 'op_hauteur_boite' => 0, - 'op_captions' => 0, - 'op_autoplay' => 0, - 'op_visible' => 0, - 'op_speed' => 0, - 'op_auto' => 0, // Animation (0 = aucune) - 'op_scroll' => 1, // Défilement (1 = image par image) - 'rss_avis' => 1, // afficher les RSS - 'id_catalogue' => 0, - 'id_panier' => 0, - 'profil_redirect' => '', // affiche les notices dans ce profil + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_RECH, + $_action = 'kiosque', + $_popupWidth = 700, + $_popupHeight = 800, + $_isPhone = true, + $_styles; + + + public function __construct() { + $this->_libelle = $this->_('Boite kiosque'); + $this->_form = 'ZendAfi_Form_Configuration_Widget_Carousel'; + $this->_defaultValues = ['titre' => $this->_libelle, + 'style_liste' => "slide_show", + 'nb_notices' => 20, + 'only_img' => 1, + 'aleatoire' => 1, + 'tri' => 1, // 0=alpha,1=par date de creation,2=les plus consultées + 'nb_analyse' => 50, // nbre a analyser pour le mode aleatoire + 'op_hauteur_img' => 0, // hauteur des vignettes + 'op_transition' => '', //type de transition pour le diaporama + 'op_largeur_img' => 0, //largeur des vignettes + 'op_hauteur_boite' => 0, + 'op_captions' => 0, + 'op_autoplay' => 0, + 'op_visible' => 0, + 'op_speed' => 0, + 'op_auto' => 0, // Animation (0 = aucune) + 'op_scroll' => 1, // Défilement (1 = image par image) + 'rss_avis' => 1, // afficher les RSS + 'id_catalogue' => 0, + 'id_panier' => 0, + 'profil_redirect' => '', // affiche les notices dans ce profil ]; + } public static function updatePreferencesForProfileRedirect($id_module, $preferences) { diff --git a/library/Class/Systeme/ModulesAccueil/Langue.php b/library/Class/Systeme/ModulesAccueil/Langue.php index beb4b6286c08b488ec5a2b58925fdc9ee4ef15d5..3d51b1b999165db847caf2d14bef927218593209 100644 --- a/library/Class/Systeme/ModulesAccueil/Langue.php +++ b/library/Class/Systeme/ModulesAccueil/Langue.php @@ -16,30 +16,21 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesAccueil_Langue extends Class_Systeme_ModulesAccueil_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesAccueil::GROUP_SITE; - - /** @var string */ - protected $_libelle = 'Langue du site'; +class Class_Systeme_ModulesAccueil_Langue extends Class_Systeme_ModulesAccueil_Null { - /** @var string */ - protected $_action = 'langue'; + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_SITE, + $_action = 'langue', + $_popupWidth = 570, + $_popupHeight = 400, + $_isPhone = false; - /** @var int */ - protected $_popupWidth = 570; - /** @var int */ - protected $_popupHeight = 400; - - /** @var bool */ - protected $_isPhone = false; - - /** @var array */ - protected $_defaultValues = array( - 'titre' => 'Langue du site' - ); -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Boite langue du site'); + $this->_form = 'ZendAfi_Form_Configuration_Widget_Base'; + $this->_defaultValues = ['titre' => $this->_libelle]; + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/Library.php b/library/Class/Systeme/ModulesAccueil/Library.php index 67a1a7441e627404e810fe8c6a5c25e0c7aa9836..ddb80114d6ceda8113da205b9fbfdb090fb634f5 100644 --- a/library/Class/Systeme/ModulesAccueil/Library.php +++ b/library/Class/Systeme/ModulesAccueil/Library.php @@ -45,37 +45,30 @@ class Class_Systeme_ModulesAccueil_Library extends Class_Systeme_ModulesAccueil_ const POSITION_LEFT = 'left'; const POSITION_RIGHT = 'right'; - /** @var string */ - protected $_group = Class_Systeme_ModulesAccueil::GROUP_SITE; - - /** @var string */ - protected $_libelle = 'Bibliothèque'; - - /** @var string */ - protected $_action = 'library'; - - /** @var int */ - protected $_popupWidth = 800; - - /** @var int */ - protected $_popupHeight = 600; - - /** @var bool */ - protected $_isPhone = true; - - /** @var array */ - protected $_defaultValues = ['titre' => 'Bibliothèque', - 'libraries' => '', - 'nb_aff' => '10', - 'order' => self::ORDER_SELECTION, - 'pagination' => self::PAGINATION_BOTH, - 'fields' => self::FIELD_OPEN_CLOSE, - 'filters' => '', - 'filters_display_modes' => self::DISPLAY_LIST, - 'filters_position' => self::POSITION_RIGHT, - 'default_filters' => [], - 'linked' => 0, - 'osm_map' => 0]; + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_SITE, + $_action = 'library', + $_popupWidth = 800, + $_popupHeight = 600, + $_isPhone = true; + + + public function __construct() { + $this->_libelle = $this->_('Boite bibliothèques'); + $this->_form = 'ZendAfi_Form_Configuration_Widget_Libraries'; + $this->_defaultValues = ['titre' => $this->_libelle, + 'libraries' => '', + 'nb_aff' => '10', + 'order' => self::ORDER_SELECTION, + 'pagination' => self::PAGINATION_BOTH, + 'fields' => self::FIELD_OPEN_CLOSE, + 'filters' => '', + 'filters_display_modes' => self::DISPLAY_LIST, + 'filters_position' => self::POSITION_RIGHT, + 'default_filters' => [], + 'linked' => 0, + 'osm_map' => 0]; + } /** @return array */ diff --git a/library/Class/Systeme/ModulesAccueil/Login.php b/library/Class/Systeme/ModulesAccueil/Login.php index 3c3d03b1e4f62bd33c06db9d51bdda04facd02e8..dfeae2e0148ee6f6a5d7db0731b2049003f9ba6e 100644 --- a/library/Class/Systeme/ModulesAccueil/Login.php +++ b/library/Class/Systeme/ModulesAccueil/Login.php @@ -18,47 +18,36 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesAccueil_Login extends Class_Systeme_ModulesAccueil_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesAccueil::GROUP_SITE; +class Class_Systeme_ModulesAccueil_Login extends Class_Systeme_ModulesAccueil_Null { - /** @var string */ - protected $_libelle = 'Boite de connexion'; + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_SITE, + $_action = 'login', + $_popupWidth = 700, + $_popupHeight = 600, + $_isPhone = false, + $_isPackMobile = true; - /** @var string */ - protected $_action = 'login'; - /** @var int */ - protected $_popupWidth = 700; - - /** @var int */ - protected $_popupHeight = 600; - - /** @var bool */ - protected $_isPhone = false; - - /** @var bool */ - protected $_isPackMobile = true; - - /** @var array */ - protected $_defaultValues = [ - 'titre' => 'Se connecter', // Titre de la boite - 'titre_connecte' => '', - 'identifiant' => 'Identifiant', - 'identifiant_exemple' => '', //texte du placeholder - 'mot_de_passe' => 'Mot de passe', - 'mot_de_passe_exemple' => '', // texte du placeholder, - 'lien_connexion' => '» Se connecter', - 'lien_mot_de_passe_oublie' => '» Mot de passe oublié ?', - 'lien_creer_compte' => '» S\'enregistrer', - 'pre-registration' => '', - 'message_connecte' => 'Bienvenue', - 'lien_compte' => '» Mon compte', - 'lien_deconnection' => '» Se déconnecter', - 'pre_registration' => '', - 'autocomplete_off' => 1 ,// si == 1, rajoute autocomplete="off" au formulaire - 'profil_redirect' => '0', - 'profil_logout_redirect' => '0' - ]; -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Boite d\'authentification'); + $this->_form = 'ZendAfi_Form_Configuration_Widget_Login'; + $this->_defaultValues = ['titre' => $this->_('Se connecter'), + 'titre_connecte' => '', + 'identifiant' => $this->_('Identifiant'), + 'identifiant_exemple' => '', + 'mot_de_passe' => $this->_('Mot de passe'), + 'mot_de_passe_exemple' => '', + 'lien_connexion' => '» ' . $this->_('Se connecter'), + 'lien_mot_de_passe_oublie' => '» ' . $this->_('Mot de passe oublié ?'), + 'lien_creer_compte' => '» ' . $this->_('S\'enregistrer'), + 'pre-registration' => '', + 'message_connecte' => $this->_('Bienvenue'), + 'lien_compte' => '» ' . $this->_('Mon compte'), + 'lien_deconnection' => '» ' . $this->_('Se déconnecter'), + 'pre_registration' => '', + 'autocomplete_off' => 1 , + 'profil_redirect' => '0', + 'profil_logout_redirect' => '0']; + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/MenuVertical.php b/library/Class/Systeme/ModulesAccueil/MenuVertical.php index 8a9f3217eab97b5bc07caa875f2a98c0fb35ef5c..69d74c9fc0e8ee45798374f219051b17fa6facd5 100644 --- a/library/Class/Systeme/ModulesAccueil/MenuVertical.php +++ b/library/Class/Systeme/ModulesAccueil/MenuVertical.php @@ -18,30 +18,97 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesAccueil_MenuVertical extends Class_Systeme_ModulesAccueil_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesAccueil::GROUP_SITE; +class Class_Systeme_ModulesAccueil_MenuVertical extends Class_Systeme_ModulesAccueil_Null { - /** @var string */ - protected $_libelle = 'Menu vertical'; + const NEW_MENU = 'new_menu'; - /** @var string */ - protected $_action = 'menuvertical'; + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_SITE, + $_action = 'menuvertical', + $_popupWidth = 650, + $_popupHeight = 300, + $_isPhone = false, + $_defaultValues = ['afficher_titre' => '1', + 'menu_deplie' => 0, + 'new_html' => 0, + 'toggle_menu' => 0]; - /** @var int */ - protected $_popupWidth = 650; - /** @var int */ - protected $_popupHeight = 300; + public function __construct() { + $this->_libelle = $this->_('Boite menu'); + $this->_form = 'ZendAfi_Form_Configuration_Widget_Menu'; + } - /** @var bool */ - protected $_isPhone = false; - /** @var array */ - protected $_defaultValues = ['menu' => 'V', - 'afficher_titre' => '1', - 'menu_deplie' => 0, - 'new_html' => 0, - 'toggle_menu' => 0]; -} -?> \ No newline at end of file + protected function _prefixMenu($id) { + $profil = Class_Profil::getCurrentProfil(); + $profil = $profil->hasParentProfil() + ? $profil->getParentProfil() + : $profil; + + return $profil->getId() + . Class_Systeme_ModulesMenu::MENU_CONFIG_PROFIL_SEPARATOR + . $id; + } + + + public function getDefaultValues() { + $this->_defaultValues['menu'] = $this->_prefixMenu('V'); + return parent::getDefaultValues(); + } + + + public function updateHook($datas) { + if(!isset($datas['menu'])) + return $datas; + + if(static::NEW_MENU != $datas['menu']) + return $datas; + + $datas['menu'] = $this->_prefixMenu($this->addMenu()); + return $datas; + } + + + public function addMenu() { + $profil = Class_Profil::getCurrentProfil(); + $profil = $profil->hasParentProfil() + ? $profil->getParentProfil() + : $profil; + + $id = $profil->addMenu(['libelle' => $this->_('Nouveau menu'), + 'picto' => '', + 'menus' => []]); + $profil->save(); + return $id; + } + + + public function getValues($datas) { + if(false === strpos($datas['menu'], Class_Systeme_ModulesMenu::MENU_CONFIG_PROFIL_SEPARATOR)) + $datas['menu'] = $this->_prefixMenu($datas['menu']); + + return parent::getValues($datas); + } + + + public function getMenus() { + $profiles = array_merge([Class_Profil::find(1)], + Class_Profil::findTopProfils()); + + $menus = ['', static::NEW_MENU => $this->_('Créer un nouveau menu')]; + + foreach($profiles as $profile) + $menus[$profile->getLibelle()] = $this->_getMenusInProfile($profile); + + return $menus; + } + + + protected function _getMenusInProfile($profile) { + $menus = []; + foreach($profile->getCfgMenusAsArray() as $id => $datas) + $menus[$profile->getId() . Class_Systeme_ModulesMenu::MENU_CONFIG_PROFIL_SEPARATOR . $id] = $datas['libelle']; + return $menus; + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/Multimedia.php b/library/Class/Systeme/ModulesAccueil/Multimedia.php index 80e4d77c2c2ed079d84c0e384eb3116a844920c1..8035cfd0769befc33ba0e3abe09f8457cbfb18d7 100644 --- a/library/Class/Systeme/ModulesAccueil/Multimedia.php +++ b/library/Class/Systeme/ModulesAccueil/Multimedia.php @@ -16,28 +16,20 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesAccueil_Multimedia extends Class_Systeme_ModulesAccueil_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesAccueil::GROUP_ABONNE; - - /** @var string */ - protected $_libelle = 'Postes multimédia'; +class Class_Systeme_ModulesAccueil_Multimedia extends Class_Systeme_ModulesAccueil_Null { - /** @var string */ - protected $_action = 'multimedia'; + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_ABONNE, + $_action = 'multimedia', + $_popupWidth = 570, + $_popupHeight = 400; - /** @var int */ - protected $_popupWidth = 570; - /** @var int */ - protected $_popupHeight = 400; - - /** @var array */ - protected $_defaultValues = array( - 'titre' => "Postes multimédia", // Titre de la boite - ); - -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Boite postes multimédia'); + $this->_form = 'ZendAfi_Form_Configuration_Widget_Base'; + $this->_defaultValues = ['titre' => $this->_libelle]; + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/News.php b/library/Class/Systeme/ModulesAccueil/News.php index 89b24aec7fe11b65c3fa6a311ffb5888410c43a9..39aaac35aa075c5d7732d88816913430de474787 100644 --- a/library/Class/Systeme/ModulesAccueil/News.php +++ b/library/Class/Systeme/ModulesAccueil/News.php @@ -18,7 +18,7 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesAccueil_News extends Class_Systeme_ModulesAccueil_Null{ +class Class_Systeme_ModulesAccueil_News extends Class_Systeme_ModulesAccueil_Null { const SELECTION = 'Selection', CREATION_DESC = 'DateCreationDesc', @@ -27,43 +27,32 @@ class Class_Systeme_ModulesAccueil_News extends Class_Systeme_ModulesAccueil_Nul COMMENTS = 'CommentCount', RANDOM = 'Random'; - /** @var string */ - protected $_group = Class_Systeme_ModulesAccueil::GROUP_INFO; + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_INFO, + $_action = 'news', + $_popupWidth = 800, + $_popupHeight = 750, + $_isPhone = true, + $_isPackMobile = false; - /** @var string */ - protected $_libelle = 'Articles'; - /** @var string */ - protected $_action = 'news'; - - /** @var int */ - protected $_popupWidth = 800; - - /** @var int */ - protected $_popupHeight = 750; - - /** @var bool */ - protected $_isPhone = true; - - /** @var bool */ - protected $_isPackMobile = false; - - /** @var array */ - protected $_defaultValues = [ - 'titre' => 'Articles', // Titre de la boite - 'anchor' => '', - 'allow_link_on_title' => true, - 'type_aff' => 1, // Type a afficher : 1=sélection libre, 2=les + récents - 'id_categorie' => '', // Liste d'id_categorie séparés par des tirets - 'id_items' => '', // Liste d'id_news séparés par des tirets - 'nb_aff' => '1', // Nombre à afficher - 'nb_analyse' => '5', // Nombre à analyser - 'display_order' => 'Selection', // Ordre d'affichage des articles - 'display_titles_only' => false, // Afficher seulement les titres - 'rss_avis' => true, // Afficher les rss - 'op_largeur_img' => 200, // Largeur de la boite pour l'affichage diaporama - 'op_hauteur_boite' => 400 // Hauteur de la boite pour l'affichage diaporama - ]; + public function __construct() { + $this->_libelle = $this->_('Boite articles'); + $this->_form = 'ZendAfi_Form_Configuration_Widget_Articles'; + $this->_defaultValues = ['titre' => $this->_libelle, + 'anchor' => '', + 'allow_link_on_title' => true, + 'type_aff' => 1, + 'id_categorie' => '', + 'id_items' => '', + 'nb_aff' => '1', + 'nb_analyse' => '5', + 'display_order' => static::SELECTION, + 'display_titles_only' => false, + 'rss_avis' => true, + 'op_largeur_img' => 200, + 'op_hauteur_boite' => 400]; + } public function getDisplayOrders() { @@ -74,5 +63,4 @@ class Class_Systeme_ModulesAccueil_News extends Class_Systeme_ModulesAccueil_Nul static::COMMENTS => $this->_('par nombre d\'avis'), static::RANDOM => $this->_('par ordre aléatoire')]; } -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/Newsletters.php b/library/Class/Systeme/ModulesAccueil/Newsletters.php index 0e21d98fe7450df633ec6f73d7c88295d315cc1b..4df26abeed033e7ec0d1f8cd4885a1143f017756 100644 --- a/library/Class/Systeme/ModulesAccueil/Newsletters.php +++ b/library/Class/Systeme/ModulesAccueil/Newsletters.php @@ -16,28 +16,20 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesAccueil_Newsletters extends Class_Systeme_ModulesAccueil_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesAccueil::GROUP_ABONNE; - - /** @var string */ - protected $_libelle = 'Lettres d\'informations'; +class Class_Systeme_ModulesAccueil_Newsletters extends Class_Systeme_ModulesAccueil_Null { - /** @var string */ - protected $_action = 'newsletters'; + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_ABONNE, + $_action = 'newsletters', + $_popupWidth = 570, + $_popupHeight = 400; - /** @var int */ - protected $_popupWidth = 570; - /** @var int */ - protected $_popupHeight = 400; - - /** @var array */ - protected $_defaultValues = array( - 'titre' => "Lettres d'informations", // Titre de la boite - ); - -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Boite lettres d\'informations'); + $this->_form = 'ZendAfi_Form_Configuration_Widget_Base'; + $this->_defaultValues = ['titre' => $this->_libelle]; + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/Null.php b/library/Class/Systeme/ModulesAccueil/Null.php index 3aafbb41aceaf32385f6486eea77e077770df8fb..bbf7bf7cb3f953457af1eedff4eadb14183a3559 100644 --- a/library/Class/Systeme/ModulesAccueil/Null.php +++ b/library/Class/Systeme/ModulesAccueil/Null.php @@ -23,29 +23,16 @@ class Class_Systeme_ModulesAccueil_Null { protected static $PREFERENCES_SEPARATOR = '|'; - /** @var string */ - protected $_group = Class_Systeme_ModulesAccueil::GROUP_INFO; - - /** @var string */ - protected $_libelle = ''; - - /** @var string */ - protected $_action = ''; - - /** @var int */ - protected $_popupWidth = 0; - - /** @var int */ - protected $_popupHeight = 0; - - /** @var bool */ - protected $_isPhone = false; - - /** @var bool */ - protected $_isPackMobile = true; - - /** @var array */ - protected $_defaultValues = array(); + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_INFO, + $_libelle = '', + $_action = '', + $_popupWidth = 0, + $_popupHeight = 0, + $_isPhone = false, + $_isPackMobile = true, + $_defaultValues = [], + $_form; /** @return boolean */ @@ -66,7 +53,6 @@ class Class_Systeme_ModulesAccueil_Null { } - /** @return array */ public function getDefaultValues() { if (!isset($this->_defaultValues['boite'])) $this->_defaultValues['boite'] = null; @@ -165,6 +151,38 @@ class Class_Systeme_ModulesAccueil_Null { return array_merge($this->getDefaultValues(), $preferences); } -} -?> \ No newline at end of file + + public function getCategoryLabel() { + $categories = (new Class_Systeme_ModulesMenu())->getGroupes(); + if(isset($categories[$this->getGroup()])) + return $categories[$this->getGroup()] . ' -> '; + + return ''; + } + + + public function getForm() { + return $this->_form; + } + + + public function getTitle() { + return $this->_libelle; + } + + + public function updateHook($datas) { + return $datas; + } + + + public function getValues($datas) { + return array_merge($this->getDefaultValues(), $datas); + } + + + public function isMenu() { + return false; + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/Panier.php b/library/Class/Systeme/ModulesAccueil/Panier.php index 159707ba3bbffe309f7f1ba382c50521f0f32d4f..cfdbd8fdcf29460683295210851bf979b63003bd 100644 --- a/library/Class/Systeme/ModulesAccueil/Panier.php +++ b/library/Class/Systeme/ModulesAccueil/Panier.php @@ -16,24 +16,22 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class Class_Systeme_ModulesAccueil_Panier extends Class_Systeme_ModulesAccueil_Null{ - - protected $_group = Class_Systeme_ModulesAccueil::GROUP_ABONNE; - protected $_libelle = 'Panier'; + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_ABONNE, + $_action = 'panier', + $_popupWidth = 600, + $_popupHeight = 200; - protected $_action = 'panier'; - - protected $_popupWidth = 600; - - protected $_popupHeight = 200; - - protected $_defaultValues = ['titre' => 'Panier']; + public function __construct() { + $this->_libelle = $this->_('Boite paniers'); + $this->_form = 'ZendAfi_Form_Configuration_Widget_Base'; + $this->_defaultValues = ['titre' => $this->_libelle]; + } } - -?> diff --git a/library/Class/Systeme/ModulesAccueil/PremierChapitre.php b/library/Class/Systeme/ModulesAccueil/PremierChapitre.php index f1d5b5a787f7bc4ce06cdcb54f2ffe43c45a0054..47b88032a906cc4fd64972c5e6d14117269144b5 100644 --- a/library/Class/Systeme/ModulesAccueil/PremierChapitre.php +++ b/library/Class/Systeme/ModulesAccueil/PremierChapitre.php @@ -19,25 +19,24 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -class Class_Systeme_ModulesAccueil_PremierChapitre extends Class_Systeme_ModulesAccueil_Null{ - - protected $_group = Class_Systeme_ModulesAccueil::GROUP_INFO; - - protected $_libelle = 'Premier Chapitre'; - - protected $_action = 'premier-chapitre'; - - protected $_popupWidth = 600; - - - protected $_popupHeight = 600; - - protected $_defaultValues = ['titre' => 'Premier Chapitre', - 'intro' => '', - 'type' => 0, - 'nb_aff' => 8, - 'id_panier' => 0, - 'format' => 0]; -} -?> \ No newline at end of file +class Class_Systeme_ModulesAccueil_PremierChapitre extends Class_Systeme_ModulesAccueil_Null { + + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_INFO, + $_libelle = 'Premier Chapitre', + $_action = 'premier-chapitre', + $_popupWidth = 600, + $_popupHeight = 600; + + + public function __construct() { + $this->_libelle = 'Boite Premier Chapitre'; + $this->_form = 'ZendAfi_Form_Configuration_Widget_PremierChapitre'; + $this->_defaultValues = ['titre' => $this->_libelle, + 'intro' => '', + 'type' => 0, + 'nb_aff' => 8, + 'id_panier' => 0, + 'format' => 0]; + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/Prets.php b/library/Class/Systeme/ModulesAccueil/Prets.php index b2234936fa8ce32d5f5162524b0192839ca2ff6e..9768a3f16a92b0143641f7ae4e3d11d09082c6f4 100644 --- a/library/Class/Systeme/ModulesAccueil/Prets.php +++ b/library/Class/Systeme/ModulesAccueil/Prets.php @@ -16,28 +16,21 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesAccueil_Prets extends Class_Systeme_ModulesAccueil_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesAccueil::GROUP_ABONNE; - - /** @var string */ - protected $_libelle = 'Prêts'; - /** @var string */ - protected $_action = 'prets'; +class Class_Systeme_ModulesAccueil_Prets extends Class_Systeme_ModulesAccueil_Null { - /** @var int */ - protected $_popupWidth = 570; + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_ABONNE, + $_action = 'prets', + $_popupWidth = 570, + $_popupHeight = 400; - /** @var int */ - protected $_popupHeight = 400; - /** @var array */ - protected $_defaultValues = array( - 'titre' => "Mes prêts", // Titre de la boite - ); - -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Boite prêts'); + $this->_form = 'ZendAfi_Form_Configuration_Widget_Base'; + $this->_defaultValues = ['titre' => $this->_('Mes prêts')]; + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/RechercheGuidee.php b/library/Class/Systeme/ModulesAccueil/RechercheGuidee.php index e7c47960d23d1a6e6ed717fc4124b8d500e463bf..7d5860fab8046ae0df131900ca4d25e5d75a37dd 100644 --- a/library/Class/Systeme/ModulesAccueil/RechercheGuidee.php +++ b/library/Class/Systeme/ModulesAccueil/RechercheGuidee.php @@ -16,28 +16,21 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesAccueil_RechercheGuidee extends Class_Systeme_ModulesAccueil_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesAccueil::GROUP_RECH; - - /** @var string */ - protected $_libelle = 'Recherche guidée'; +class Class_Systeme_ModulesAccueil_RechercheGuidee extends Class_Systeme_ModulesAccueil_Null { - /** @var string */ - protected $_action = 'rechguidee'; + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_RECH, + $_action = 'rechguidee', + $_popupWidth = 550, + $_popupHeight = 240, + $_isPhone = false; - /** @var int */ - protected $_popupWidth = 550; - /** @var int */ - protected $_popupHeight = 240; - - /** @var bool */ - protected $_isPhone = false; - - /** @var array */ - protected $_defaultValues = array('titre' => 'Recherche guidée'); // Titre de la boite -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Boite recherche guidée'); + $this->_form = 'ZendAfi_Form_Configuration_Widget_Base'; + $this->_defaultValues = ['titre' => $this->_libelle]; + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/RechercheSimple.php b/library/Class/Systeme/ModulesAccueil/RechercheSimple.php index 33ad55bf441ad4fe3850d7cc70c9babe78ec6602..47d45db3a67f3bdc7f071c2f6997c41d0ed43e72 100644 --- a/library/Class/Systeme/ModulesAccueil/RechercheSimple.php +++ b/library/Class/Systeme/ModulesAccueil/RechercheSimple.php @@ -18,48 +18,37 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesAccueil_RechercheSimple extends Class_Systeme_ModulesAccueil_Null{ +class Class_Systeme_ModulesAccueil_RechercheSimple extends Class_Systeme_ModulesAccueil_Null { const DOMAIN_SELECT_SELECT = 'select', DOMAIN_SELECT_CHECKBOX = 'checkbox'; - /** @var string */ - protected $_group = Class_Systeme_ModulesAccueil::GROUP_RECH; - - /** @var string */ - protected $_libelle = 'Recherche simple'; - - /** @var string */ - protected $_action = 'rechsimple'; - - /** @var int */ - protected $_popupWidth = 850; - - /** @var int */ - protected $_popupHeight = 600; - - /** @var bool */ - protected $_isPhone = false; - - /** @var array */ - protected $_defaultValues = - [ - 'titre' => 'Rechercher', // Titre de la boite - 'message' => '', // Message au-dessus du champ de saisie - 'exemple' => '', // Exemple sous le champ de saisie - 'select_bib' => 0, // Sélection des bib - 'select_doc' => 0, // Sélection des types de docs - 'select_annexe' => 0, // Sélection annexes - 'largeur' => 140, // du champ de saisie - 'recherche_avancee' => 1, //afficher le lien recherche avancée, - 'type_doc' => 0, // filtre du type de doc - 'tri' => '*', - 'profil_redirect' => 0, //type de profil vers lequel basculer lors d'une recherche - 'placeholder' => '', //message d'exemple dans le champ de recherche - 'search_button' => '', //search button text value, - 'domain_ids' => '', // list of domains user can choose to restrict search - 'domain_select_style' => self::DOMAIN_SELECT_SELECT // type of domain selection (select / checkbox) - ]; -} -?> \ No newline at end of file + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_RECH, + $_action = 'rechsimple', + $_popupWidth = 850, + $_popupHeight = 600, + $_isPhone = false; + + + public function __construct() { + $this->_libelle = $this->_('Boite recherche'); + $this->_form = 'ZendAfi_Form_Configuration_Widget_Search'; + $this->_defaultValues = ['titre' => $this->_libelle, + 'message' => '', + 'exemple' => '', + 'select_bib' => 0, + 'select_doc' => 0, + 'select_annexe' => 0, + 'largeur' => 140, + 'recherche_avancee' => 1, + 'type_doc' => 0, + 'tri' => '*', + 'profil_redirect' => 0, + 'placeholder' => '', + 'search_button' => '', + 'domain_ids' => '', + 'domain_select_style' => self::DOMAIN_SELECT_SELECT]; + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/Reservations.php b/library/Class/Systeme/ModulesAccueil/Reservations.php index b247e8aa518e831122b1676efb374028a60bc21a..4424f4881cb29b52d4f16d333b10238b628a1ad1 100644 --- a/library/Class/Systeme/ModulesAccueil/Reservations.php +++ b/library/Class/Systeme/ModulesAccueil/Reservations.php @@ -18,26 +18,18 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesAccueil_Reservations extends Class_Systeme_ModulesAccueil_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesAccueil::GROUP_ABONNE; +class Class_Systeme_ModulesAccueil_Reservations extends Class_Systeme_ModulesAccueil_Null { - /** @var string */ - protected $_libelle = 'Réservations'; + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_ABONNE, + $_action = 'reservations', + $_popupWidth = 570, + $_popupHeight = 400; - /** @var string */ - protected $_action = 'reservations'; - /** @var int */ - protected $_popupWidth = 570; - - /** @var int */ - protected $_popupHeight = 400; - - /** @var array */ - protected $_defaultValues = array( - 'titre' => "Mes réservations", // Titre de la boite - ); - -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Boite réservations'); + $this->_form = 'ZendAfi_Form_Configuration_Widget_Base'; + $this->_defaultValues = ['titre' => $this->_('Mes réservations')]; + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/Rss.php b/library/Class/Systeme/ModulesAccueil/Rss.php index f6569774c7b053917d82bfd52f70cc8fac03b9fc..2167c0f27e875dfa27ab5c709740964bee5249c1 100644 --- a/library/Class/Systeme/ModulesAccueil/Rss.php +++ b/library/Class/Systeme/ModulesAccueil/Rss.php @@ -16,34 +16,25 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesAccueil_Rss extends Class_Systeme_ModulesAccueil_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesAccueil::GROUP_INFO; - - /** @var string */ - protected $_libelle = 'Fils Rss'; +class Class_Systeme_ModulesAccueil_Rss extends Class_Systeme_ModulesAccueil_Null { - /** @var string */ - protected $_action = 'rss'; + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_INFO, + $_action = 'rss', + $_popupWidth = 800, + $_popupHeight = 650, + $_isPhone = false; - /** @var int */ - protected $_popupWidth = 800; - /** @var int */ - protected $_popupHeight = 650; - - /** @var bool */ - protected $_isPhone = false; - - /** @var array */ - protected $_defaultValues = array( - 'titre' => 'Fils Rss', // Titre de la boite - 'type_aff' => 1, // Type a afficher : 1=sélection libre, 2=les + récents - 'id_categorie' => '', // Liste d'id_categorie séparés par des tirets - 'id_items' => '', // Liste d'id_rss séparés par des tirets - 'nb_aff' => '2', // Nombre à afficher - ); -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Boite RSS'); + $this->_form = 'ZendAfi_Form_Configuration_Widget_RSS'; + $this->_defaultValues = ['titre' => $this->_libelle, + 'type_aff' => 1, + 'id_categorie' => '', + 'id_items' => '', + 'nb_aff' => '2']; + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/Sitotheque.php b/library/Class/Systeme/ModulesAccueil/Sitotheque.php index f003255193d8fd3936c8908135e7e5106ad72777..b80ca537c24ac15686d8e9b8b62f3c0634691b66 100644 --- a/library/Class/Systeme/ModulesAccueil/Sitotheque.php +++ b/library/Class/Systeme/ModulesAccueil/Sitotheque.php @@ -1,6 +1,6 @@ <?php /** - * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved. + * Copyright (c) 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 @@ -18,42 +18,45 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesAccueil_Sitotheque extends Class_Systeme_ModulesAccueil_Null{ - const ORDER_RANDOM = 'Random'; - const ORDER_SELECTION = 'Selection'; - const ORDER_RECENT = 'Recent'; - - const DISPLAY_PAGINATED = 1; - const DISPLAY_GROUPED = 2; - const DISPLAY_HIERARCHY = 3; - - /** @var string */ - protected $_group = Class_Systeme_ModulesAccueil::GROUP_INFO; - - /** @var string */ - protected $_libelle = 'Sitothèque'; - - /** @var string */ - protected $_action = 'sitotheque'; - - /** @var int */ - protected $_popupWidth = 800; - - /** @var int */ - protected $_popupHeight = 600; - - /** @var bool */ - protected $_isPhone = false; - - /** @var array */ - protected $_defaultValues = [ - 'titre' => 'Sitothèque', // Titre de la boite - 'type_aff' => self::DISPLAY_PAGINATED, - 'id_categorie' => '', // Liste d'id_categorie séparés par des tirets - 'id_items' => '', // Liste d'id_site séparés par des tirets - 'nb_aff' => '2', // Nombre à afficher par page - 'rss' => '0', - 'display_order' => self::ORDER_RANDOM - ]; -} -?> \ No newline at end of file + +class Class_Systeme_ModulesAccueil_Sitotheque extends Class_Systeme_ModulesAccueil_Null { + + const + ORDER_RANDOM = 'Random', + ORDER_SELECTION = 'Selection', + ORDER_RECENT = 'Recent', + DISPLAY_PAGINATED = 1, + DISPLAY_GROUPED = 2, + DISPLAY_HIERARCHY = 3; + + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_INFO, + $_action = 'sitotheque', + $_popupWidth = 800, + $_popupHeight = 600, + $_isPhone = false; + + + public function __construct() { + $this->_libelle = $this->_('Boite sitothèques'); + $this->_form = 'ZendAfi_Form_Configuration_Widget_ListOfSites'; + $this->_defaultValues = ['titre' => $this->_libelle, + 'type_aff' => self::DISPLAY_PAGINATED, + 'id_categorie' => '', + 'id_items' => '', + 'nb_aff' => '2', + 'rss' => '0', + 'display_order' => self::ORDER_RANDOM]; + } + + + public function updateHook($datas) { + if(static::DISPLAY_HIERARCHY != $datas['type_aff']) + return $datas; + + if ($categories = explode('-', $datas['id_categorie'])) + $datas['preferences']['id_categorie'] = $datas['id_categorie'] = $categories[0]; + + return $datas; + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/Tags.php b/library/Class/Systeme/ModulesAccueil/Tags.php index d32b35b79cb54609e6a65a56f9102eb091efa820..365a94eb97beee6ed1232b161d403a0fdb8eb4e7 100644 --- a/library/Class/Systeme/ModulesAccueil/Tags.php +++ b/library/Class/Systeme/ModulesAccueil/Tags.php @@ -16,36 +16,28 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class Class_Systeme_ModulesAccueil_Tags extends Class_Systeme_ModulesAccueil_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesAccueil::GROUP_RECH; - - /** @var string */ - protected $_libelle = 'Nuage de tags'; - /** @var string */ - protected $_action = 'tags'; + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_RECH, + $_action = 'tags', + $_popupWidth = 570, + $_popupHeight = 460, + $_isPhone = false; - /** @var int */ - protected $_popupWidth = 570; - /** @var int */ - protected $_popupHeight = 460; - - /** @var bool */ - protected $_isPhone = false; - - /** @var array */ - protected $_defaultValues = array( - 'message' => "Message du dessus", // Message au dessus de la boite - 'type_tags' => "AMDPZ", // Types de tags a afficher - 'nombre' => 20, // Nombre de tags a afficher - 'limite' => 300, // Nombre de notices a analyser - 'notices' => 1, - 'id_panier' => 0, - 'id_catalogue' => 0, - ); -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Boite nuage de tags'); + $this->_form = 'ZendAfi_Form_Configuration_Widget_Tags'; + $this->_defaultValues = ['titre' => $this->_libelle, + 'message' => $this->_('Message du dessus'), + 'type_tags' => "AMDPZ", + 'nombre' => 20, + 'limite' => 300, + 'notices' => 1, + 'id_panier' => 0, + 'id_catalogue' => 0]; + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAppli.php b/library/Class/Systeme/ModulesAppli.php index 9abddc24f80e91d40125f67518f16fe0837cebc6..56c5cc4547b4e64519ff07a64adf828c5d58fe36 100644 --- a/library/Class/Systeme/ModulesAppli.php +++ b/library/Class/Systeme/ModulesAppli.php @@ -23,8 +23,6 @@ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// class Class_Systeme_ModulesAppli extends Class_Systeme_ModulesAbstract { - use Trait_Translator; - const ONGLETS_KEY = 'onglets'; const LISTE_FORMAT_TABLEAU = 1; const LISTE_FORMAT_ACCORDEON = 2; diff --git a/library/Class/Systeme/ModulesMenu.php b/library/Class/Systeme/ModulesMenu.php index 7e55aeafbbba51c73f368bca3e4b2c313e76f0c3..c1b15f080fee1e1868fbce19c381ec7b67ce1cf3 100644 --- a/library/Class/Systeme/ModulesMenu.php +++ b/library/Class/Systeme/ModulesMenu.php @@ -19,8 +19,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - class Class_Systeme_ModulesMenu extends Class_Systeme_ModulesAbstract { + const MENU_CONFIG_PROFIL_SEPARATOR='-'; const PREFERENCES_KEY = 'preferences'; const MENUS_KEY = 'menus'; @@ -36,14 +36,6 @@ class Class_Systeme_ModulesMenu extends Class_Systeme_ModulesAbstract { protected static $_modules; - protected $_groupes = [ - self::GROUP_MENU_NAVIGATION => "Navigation" , - self::GROUP_MENU_INFORMATIONS => "Informations", - self::GROUP_MENU_RECHERCHES =>"Recherches" , - self::GROUP_MENU_CATALOGUES => "Catalogues", - self::GROUP_MENU_ABONNES => "Abonnés" - ]; - private $fonctions; @@ -73,12 +65,16 @@ class Class_Systeme_ModulesMenu extends Class_Systeme_ModulesAbstract { unset($this->fonctions[$key]); } - if (Class_AdminVar::isMenuBoiteEnabled()) { - $this->_groupes[Class_Systeme_ModulesAccueil::GROUP_INFO] = "Modules informations"; - $this->_groupes[Class_Systeme_ModulesAccueil::GROUP_RECH] = "Modules Recherches"; - $this->_groupes[Class_Systeme_ModulesAccueil::GROUP_SITE] = "Modules Site"; - $this->_groupes[Class_Systeme_ModulesAccueil::GROUP_ABONNE] = "Modules Abonnés"; - } + if (Class_AdminVar::isMenuBoiteEnabled()) + $this->_groupes = (new Class_Systeme_ModulesAccueil())->initGroups(); + + $this->_groupes = array_merge($this->_groupes, + [self::GROUP_MENU_NAVIGATION => $this->_('Liens de navigation'), + self::GROUP_MENU_INFORMATIONS => $this->_('Liens d\'informations'), + self::GROUP_MENU_RECHERCHES => $this->_('Liens de recherche'), + self::GROUP_MENU_CATALOGUES => $this->_('Liens de catalogues'), + self::GROUP_MENU_ABONNES => $this->_('Liens vers l\'abonné')]); + } @@ -147,8 +143,11 @@ class Class_Systeme_ModulesMenu extends Class_Systeme_ModulesAbstract { public function getValeursParDefaut($type) { - return $this->getFonction($type)->getDefaultValues(); + $values = $this->getFonction($type)->getDefaultValues(); + if(false !== strpos($type, static::MODULE_ACCUEIL_PREFIX)) + $values['type_menu'] = $values['type_module'] = $type; + return $values; } @@ -163,6 +162,97 @@ class Class_Systeme_ModulesMenu extends Class_Systeme_ModulesAbstract { } + public function getEntries() { + $entries = []; + $menus = $this->fonctions; + unset($menus['vide']); + foreach($menus as $id => $entry) + $entries[] = (new Class_Entity()) + ->setId($id) + ->setCategory($entry->getCategoryLabel()) + ->setLabel($entry->getLibelle()) + ->setForm($entry->getForm()); + + usort($entries, function($a, $b) + { + return strtolower($a->getLabel()) > strtolower($b->getLabel()); + }); + + return $entries; + } + + + public function getForm($id) { + foreach(Class_Profil::getCurrentProfil()->getCfgMenuHorizontal() as $index => $entry) { + if($id == $entry['id_module']) + return $this->getFonction($entry['type_menu'])->getForm(); + } + + return ''; + } + + + public function getTitle($id) { + foreach(Class_Profil::getCurrentProfil()->getCfgMenuHorizontal() as $index => $entry) { + if($id != $entry['id_module']) + continue; + + return $this->getFonction($entry['type_menu'])->getLibelle(); + } + + return ''; + } + + + public function getDatas($id) { + if($id === 'H') { + $raw_datas = Class_Profil::getCurrentProfil()->getMenu('H'); + $datas = []; + $entries = (new Class_Systeme_MenuHorizontal($raw_datas['menus']))->asCfgProfil(); + foreach($entries as $index => $entry) { + $item = $this->getFonction($entry['type_menu']); + $datas[] = (new Class_Entity()) + ->setId($entry['id_module']) + ->setLabel($this->_('%s%s : %s', + $item->getCategoryLabel(), + $item->getLibelle(), + $entry['libelle'])); + } + + $raw_datas['children'] = $datas; + return $raw_datas; + } + + foreach(Class_Profil::getCurrentProfil()->getCfgMenuHorizontal() as $index => $entry) { + if($id != $entry['id_module']) + continue; + + if(isset($entry['sous_menus'])) + $entry['children'] = $this->_getEntries($entry['sous_menus']); + + return $entry; + } + + return []; + } + + + protected function _getEntries($entries) { + $datas = []; + foreach($entries as $index => $entry) { + $item = $this->getFonction($entry['type_menu']); + $datas[] = (new Class_Entity()) + ->setId($entry['id_module']) + ->setLabel($this->_('%s%s : %s', + $item->getCategoryLabel(), + $item->getLibelle(), + $entry['libelle'])); + } + + return $datas; + } + + /** * @param string $type * @param array $preferences @@ -171,7 +261,7 @@ class Class_Systeme_ModulesMenu extends Class_Systeme_ModulesAbstract { public function getUrl($type, $preferences) { $module = $this->getFonction($type); $preferences = is_array($preferences) - ? array_merge($module->getDefaultValues(),$preferences) + ? array_merge($module->getDefaultValues(), $preferences) : $module->getDefaultValues(); return ['url' => $module->getUrl($preferences), @@ -283,5 +373,4 @@ class Class_Systeme_ModulesMenu extends Class_Systeme_ModulesAbstract { } } - } \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/AbonneAvis.php b/library/Class/Systeme/ModulesMenu/AbonneAvis.php index 58f5593191e8e31d99c1316f0b1693a4521a500d..56a877eadc12a321e21d3fcb464b8079894dc78e 100644 --- a/library/Class/Systeme/ModulesMenu/AbonneAvis.php +++ b/library/Class/Systeme/ModulesMenu/AbonneAvis.php @@ -16,21 +16,19 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class Class_Systeme_ModulesMenu_AbonneAvis extends Class_Systeme_ModulesMenu_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES; - /** @var string */ - protected $_type_module = 'ABON_AVIS'; - - protected $_libelle = "Derniers avis"; - - protected $_isPhone = false; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES, + $_type_module = 'ABON_AVIS', + $_isPhone = false, + $_url = ['controller' => 'abonne', + 'action' => 'viewavis']; - protected $_url = ['controller' => 'abonne', - 'action' => 'viewavis']; -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Lien vers mes derniers avis'); + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/AbonneCards.php b/library/Class/Systeme/ModulesMenu/AbonneCards.php index 20a87a7b000a6e500e3d2d07cf3f1ceed5555e49..bf61b1b4bbf9d0d7c5aacbac1a1946ef30e6c3f0 100644 --- a/library/Class/Systeme/ModulesMenu/AbonneCards.php +++ b/library/Class/Systeme/ModulesMenu/AbonneCards.php @@ -18,18 +18,17 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + class Class_Systeme_ModulesMenu_AbonneCards extends Class_Systeme_ModulesMenu_Null { - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES; - /** @var string */ - protected $_type_module = 'ABON_CARDS'; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES, + $_type_module = 'ABON_CARDS', + $_url = ['controller' => 'abonne', + 'action' => 'cards']; - /** @var string */ - protected $_libelle = 'Cartes'; - /** @var string */ - protected $_url = ['controller' => 'abonne', - 'action' => 'cards']; -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Lien vers mes cartes'); + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/AbonneFiche.php b/library/Class/Systeme/ModulesMenu/AbonneFiche.php index 00a2ccb4925d6e796822b9c951fa8567eea0c6db..f7e5bf6ab74a6a8fcd5295f3c4811910180e057d 100644 --- a/library/Class/Systeme/ModulesMenu/AbonneFiche.php +++ b/library/Class/Systeme/ModulesMenu/AbonneFiche.php @@ -16,20 +16,19 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + class Class_Systeme_ModulesMenu_AbonneFiche extends Class_Systeme_ModulesMenu_Null { - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES; - /** @var string */ - protected $_type_module = 'ABON_FICHE'; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES, + $_type_module = 'ABON_FICHE', + $_url = ['controller' => 'abonne', + 'action' => 'fiche']; - /** @var string */ - protected $_libelle = 'Fiche abonné'; - /** @var string */ - protected $_url = ['controller' => 'abonne', - 'action' => 'fiche']; -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Lien vers ma fiche d\'abonné'); + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/AbonneFormations.php b/library/Class/Systeme/ModulesMenu/AbonneFormations.php index d79b66998ec6aae4bc6946a66a708a656c6576b1..cc1740e208c62a39b82c01794955ae6a09341920 100644 --- a/library/Class/Systeme/ModulesMenu/AbonneFormations.php +++ b/library/Class/Systeme/ModulesMenu/AbonneFormations.php @@ -18,23 +18,22 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + class Class_Systeme_ModulesMenu_AbonneFormations extends Class_Systeme_ModulesMenu_Null { - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES; - /** @var string */ - protected $_type_module = 'ABON_FORMATIONS'; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES, + $_type_module = 'ABON_FORMATIONS', + $_url = ['controller' => 'formations', + 'action' => 'index']; - /** @var string */ - protected $_libelle = 'Formations'; - /** @var string */ - protected $_url = ['controller' => 'formations', - 'action' => 'index']; + public function __construct() { + $this->_libelle = $this->_('Lien vers mes formations'); + } public function isVisibleForProfil($profil) { return Class_AdminVar::isFormationEnabled(); } -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/AbonneModificationFiche.php b/library/Class/Systeme/ModulesMenu/AbonneModificationFiche.php index 765d5eabb81e19a67da55a9c664d346bd66c623b..d2f50fbf33f494cb970b4d63d8909e689d4ed953 100644 --- a/library/Class/Systeme/ModulesMenu/AbonneModificationFiche.php +++ b/library/Class/Systeme/ModulesMenu/AbonneModificationFiche.php @@ -16,20 +16,19 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + class Class_Systeme_ModulesMenu_AbonneModificationFiche extends Class_Systeme_ModulesMenu_Null { - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES; - /** @var string */ - protected $_type_module = 'ABON_MODIF_FICHE'; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES, + $_type_module = 'ABON_MODIF_FICHE', + $_url = ['controller' => 'abonne', + 'action' => 'edit']; - /** @var string */ - protected $_libelle = 'Modifier données abonné'; - /** @var string */ - protected $_url = ['controller' => 'abonne', - 'action' => 'edit']; -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Lien vers la modification de ma fiche abonné'); + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/AbonnePrets.php b/library/Class/Systeme/ModulesMenu/AbonnePrets.php index 105fa63504e1d76b4b1b07bac534f433977a94c9..8c21a8b44c5ff3770a94df960245b88a29ed1bce 100644 --- a/library/Class/Systeme/ModulesMenu/AbonnePrets.php +++ b/library/Class/Systeme/ModulesMenu/AbonnePrets.php @@ -16,20 +16,18 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesMenu_AbonnePrets extends Class_Systeme_ModulesMenu_Null { - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES; - /** @var string */ - protected $_type_module = 'ABON_PRETS'; +class Class_Systeme_ModulesMenu_AbonnePrets extends Class_Systeme_ModulesMenu_Null { + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES, + $_type_module = 'ABON_PRETS', + $_url = ['controller' => 'abonne', + 'action' => 'prets']; - /** @var string */ - protected $_libelle = 'Prêts en cours'; - /** @var string */ - protected $_url = ['controller' => 'abonne', - 'action' => 'prets']; -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Lien vers mes prêts en cours'); + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/AbonneReservations.php b/library/Class/Systeme/ModulesMenu/AbonneReservations.php index 84c185cb9d6d556c8f200be990c7da4591447d48..1054b9a8f384f6eb8fcd7464f1ae8a2ae7d82f7a 100644 --- a/library/Class/Systeme/ModulesMenu/AbonneReservations.php +++ b/library/Class/Systeme/ModulesMenu/AbonneReservations.php @@ -16,20 +16,19 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + class Class_Systeme_ModulesMenu_AbonneReservations extends Class_Systeme_ModulesMenu_Null { - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES; - /** @var string */ - protected $_type_module = 'ABON_RESAS'; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES, + $_type_module = 'ABON_RESAS', + $_url = ['controller' => 'abonne', + 'action' => 'reservations']; - /** @var string */ - protected $_libelle = 'Réservations en cours'; - /** @var string */ - protected $_url = ['controller' => 'abonne', - 'action' => 'reservations']; -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Lien vers mes réservations en cours'); + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/Accueil.php b/library/Class/Systeme/ModulesMenu/Accueil.php index 37bef2287e41ff91e6bda85d85eab9d74d66fd46..a7ec737307add82251689468a9c899aa53d01211 100644 --- a/library/Class/Systeme/ModulesMenu/Accueil.php +++ b/library/Class/Systeme/ModulesMenu/Accueil.php @@ -18,26 +18,19 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesMenu_Accueil extends Class_Systeme_ModulesMenu_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_NAVIGATION; - /** @var string */ - protected $_type_module = 'ACCUEIL'; +class Class_Systeme_ModulesMenu_Accueil extends Class_Systeme_ModulesMenu_Null { - /** @var string */ - protected $_libelle = 'Retour à l\'accueil'; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_NAVIGATION, + $_type_module = 'ACCUEIL', + $_isPhone = true, + $_isPackMobile = false, + $_defaultValues = [], + $_url = []; - /** @var bool */ - protected $_isPhone = true; - /** @var bool */ - protected $_isPackMobile = false; - - /** @var array */ - protected $_defaultValues = array(); - - /** @var string */ - protected $_url = []; -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Lien de retour à l\'accueil'); + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/ArteVOD.php b/library/Class/Systeme/ModulesMenu/ArteVOD.php index 01d68042ae1a11df4f3965bad2fbbf1fbd51e914..75d5c096744dab133ba2fa89dba64835108e1d1f 100644 --- a/library/Class/Systeme/ModulesMenu/ArteVOD.php +++ b/library/Class/Systeme/ModulesMenu/ArteVOD.php @@ -18,15 +18,20 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + class Class_Systeme_ModulesMenu_ArteVOD extends Class_Systeme_ModulesMenu_SSOAbstract { - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES; - /** @var string */ - protected $_type_module = 'ArteVod'; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES, + $_type_module = 'ArteVod', + $_url = ['controller' => 'modules', + 'action' => 'artevod']; + - /** @var string */ - protected $_libelle = 'Lien vers ArteVod'; + + public function __construct() { + $this->_libelle = $this->_('Lien vers ArteVod'); + } public function getArteVodUrlForUser($user) { @@ -42,14 +47,7 @@ class Class_Systeme_ModulesMenu_ArteVOD extends Class_Systeme_ModulesMenu_SSOAbs } - - public function getUrl($preferences=[]) { - return Class_Url::assemble(['controller' => 'modules', - 'action' => 'artevod']); - } - - - public function getDynamiqueUrl($docid=null) { + public function getDynamiqueUrl($docid = null) { $user = Class_Users::getIdentity(); if (!$user) { $arte_link=new Class_ArteVodLink(); @@ -63,4 +61,4 @@ class Class_Systeme_ModulesMenu_ArteVOD extends Class_Systeme_ModulesMenu_SSOAbs public function isVisibleForProfil($profil) { return Class_AdminVar::isArteVODEnabled(); } -} +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/Avis.php b/library/Class/Systeme/ModulesMenu/Avis.php index a4ebf48ed62533f961cdee6389895ce3e0815eb5..6881394a3f759c456d8384ce0640c5b1b6902444 100644 --- a/library/Class/Systeme/ModulesMenu/Avis.php +++ b/library/Class/Systeme/ModulesMenu/Avis.php @@ -16,40 +16,36 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class Class_Systeme_ModulesMenu_Avis extends Class_Systeme_ModulesMenu_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_INFORMATIONS; - /** @var string */ - protected $_type_module = 'AVIS'; - - /** @var string */ - protected $_libelle = 'Dernières critiques'; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_INFORMATIONS, + $_type_module = 'AVIS', + $_action = 'avis', + $_popupWidth = 550, + $_popupHeight = 290, + $_isPhone = false, + $_isPackMobile = false, + $_defaultValues = ['nb' => '10']; - /** @var string */ - protected $_action = 'avis'; - /** @var int */ - protected $_popupWidth = 550; - - /** @var int */ - protected $_popupHeight = 290; + public function __construct() { + $this->_libelle = $this->_('Lien vers les avis les plus récents'); + $this->_form = 'ZendAfi_Form_Configuration_Menu_LastReviews'; + } - /** @var bool */ - protected $_isPhone = false; - /** @var bool */ - protected $_isPackMobile = false; + public function getUrl($preferences = []) { + $nb = isset($preferences['nb']) + ? $preferences['nb'] + : $this->_defaultValues['nb']; - /** @var array */ - protected $_defaultValues = ['nb' => '10']; + $this->_url = ['controller' => 'blog', + 'action' => 'lastcritique', + 'nb' => $nb]; - public function getUrl($preferences=[]) { - return Class_Url::assemble(['controller' => 'blog', - 'action' => 'lastcritique', - 'nb' => $preferences["nb"]]); + return parent::getUrl($preferences); } -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/BibliothequeNumerique.php b/library/Class/Systeme/ModulesMenu/BibliothequeNumerique.php index 6baffcc8da08a5d33c48c7f7255ba7c91b74290f..fe6877d3e2b081fbad6c2cf759565e2fb4038359 100644 --- a/library/Class/Systeme/ModulesMenu/BibliothequeNumerique.php +++ b/library/Class/Systeme/ModulesMenu/BibliothequeNumerique.php @@ -16,39 +16,36 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesMenu_BibliothequeNumerique extends Class_Systeme_ModulesMenu_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_INFORMATIONS; - /** @var string */ - protected $_type_module = 'BIBNUM'; - - /** @var int */ - protected $_popupWidth = 550; +class Class_Systeme_ModulesMenu_BibliothequeNumerique extends Class_Systeme_ModulesMenu_Null { - protected $_libelle = "Lien vers un album"; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_INFORMATIONS, + $_type_module = 'BIBNUM', + $_popupWidth = 550, + $_action = "album", + $_popupHeight = 290, + $_isPhone = false; - protected $_action = "album"; - - /** @var int */ - protected $_popupHeight = 290; - - protected $_isPhone = false; + public function __construct() { + $this->_libelle = $this->_('Lien vers un album'); + $this->_form = 'ZendAfi_Form_Configuration_Menu_Album'; + } - /** @return boolean */ public function isVisibleForProfil($profil) { return Class_AdminVar::isBibNumEnabled(); } - public function getUrl($preferences=[]) { - return Class_Url::assemble(['controller' => 'bib-numerique', - 'action' => 'booklet', - 'id' => $preferences['album_id']]); + public function getUrl($preferences = []) { + $this->_url = ['controller' => 'bib-numerique', + 'action' => 'booklet', + 'id' => $preferences['album_id']]; + + return parent::getUrl($preferences); } -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/CVS.php b/library/Class/Systeme/ModulesMenu/CVS.php index d8a32db5c83f1827967185d8e413e49e135771b1..affb0c82e3f1fd7775d9526aaf21410262276c3c 100644 --- a/library/Class/Systeme/ModulesMenu/CVS.php +++ b/library/Class/Systeme/ModulesMenu/CVS.php @@ -18,17 +18,19 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + class Class_Systeme_ModulesMenu_CVS extends Class_Systeme_ModulesMenu_SSOAbstract { - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES; - /** @var string */ - protected $_type_module = 'CVS'; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES, + $_type_module = 'CVS', + $_doc_id = null; - /** @var string */ - protected $_libelle = 'Lien vers CVS'; - protected $_doc_id = null; + public function __construct() { + $this->_libelle = $this->_('Lien vers CVS'); + $this->_url = Class_CVSLink::staticLink(); + } public function getCVSUrlForUser($user) { @@ -44,12 +46,6 @@ class Class_Systeme_ModulesMenu_CVS extends Class_Systeme_ModulesMenu_SSOAbstrac } - - public function getUrl($preferences=[]) { - return Class_CVSLink::staticLink(); - } - - public function setDocId($doc_id) { $this->_doc_id = $doc_id; return $this; diff --git a/library/Class/Systeme/ModulesMenu/Catalogue.php b/library/Class/Systeme/ModulesMenu/Catalogue.php index 67df6140e44bbabb974494f06648891b888a1f75..6261a29821d6c8f7577967b7d9ebe300e946555f 100644 --- a/library/Class/Systeme/ModulesMenu/Catalogue.php +++ b/library/Class/Systeme/ModulesMenu/Catalogue.php @@ -16,33 +16,32 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesMenu_Catalogue extends Class_Systeme_ModulesMenu_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_CATALOGUES; - /** @var string */ - protected $_type_module = 'CATALOGUE'; - - /** @var int */ - protected $_popupWidth = 550; +class Class_Systeme_ModulesMenu_Catalogue extends Class_Systeme_ModulesMenu_Null { - protected $_libelle = "Domaine"; - /** @var int */ - protected $_popupHeight = 470; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_CATALOGUES, + $_type_module = 'CATALOGUE', + $_popupWidth = 550, + $_popupHeight = 470, + $_isPhone = false, + $_action = 'catalogue'; - protected $_isPhone = false; - protected $_action = 'catalogue'; + public function __construct() { + $this->_libelle = $this->_('Lien vers un résultat de recherche d\'un domaine ou d\'un panier'); + $this->_form = 'ZendAfi_Form_Configuration_Menu_SearchResult'; - protected $_defaultValues = array( - 'titre' => 'Catalogue', // Titre de la boite - 'nb_notices' => 20, // Nombre de notices a afficher - 'aleatoire' => 1, // 1=tirage aleatoire - 'tri' => 1, // 0=alpha,1=par date de creation,2=les plus consultées - 'nb_analyse' => 50, // nbre a analyser pour le mode aleatoire - ); + $this->_defaultValues = ['tri' => 1, + 'titre' => $this->_libelle, + 'nb_notices' => 20, + 'aleatoire' => 1, + 'nb_analyse' => 50, + 'id_catalogue' => '', + 'id_panier' => '']; + } public function getUrl($preferences = []) { @@ -51,11 +50,12 @@ class Class_Systeme_ModulesMenu_Catalogue extends Class_Systeme_ModulesMenu_Null '2' => 'nb_visu desc']; $preferences['tri'] = isset($preferences['tri']) ? $tris[$preferences['tri']] : $tris[0]; + unset($preferences['preferences']); - return Class_Url::assemble(array_merge(['controller' => 'recherche', - 'action' => 'simple', - 'tri' => 'alpha_titre'], - $preferences)); + $this->_url = array_merge(['controller' => 'recherche', + 'action' => 'simple', + 'tri' => 'alpha_titre'], + array_filter(array_intersect_key($preferences, $this->_defaultValues))); + return parent::getUrl($preferences); } -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/CiteDeLaMusique.php b/library/Class/Systeme/ModulesMenu/CiteDeLaMusique.php index 5516a773a63e52e7a4acd9d79573a254d81007d0..e53cecc0160566d843c8d76436cec557eae830b7 100644 --- a/library/Class/Systeme/ModulesMenu/CiteDeLaMusique.php +++ b/library/Class/Systeme/ModulesMenu/CiteDeLaMusique.php @@ -19,22 +19,19 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - class Class_Systeme_ModulesMenu_CiteDeLaMusique extends Class_Systeme_ModulesMenu_SSOAbstract { - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES; - /** @var string */ - protected $_type_module = 'CITE_DE_LA_MUSIQUE'; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES, + $_type_module = 'CITE_DE_LA_MUSIQUE', + $_url = ['controller' => 'modules', + 'action' => 'cite-de-la-musique']; - /** @var string */ - protected $_libelle = 'Lien vers Cité de la Musique'; + public function __construct() { + $this->_libelle = $this->_('Lien vers Cité de la Musique'); + } - protected $_url = [ - 'controller' => 'modules', - 'action' => 'cite-de-la-musique' - ]; public function urlForUser($user) { $cite_musique = new Class_AdminVar_CiteDeLaMusique(); diff --git a/library/Class/Systeme/ModulesMenu/Connect.php b/library/Class/Systeme/ModulesMenu/Connect.php index c39e353a8459007c537f263ded8ee93ce5744b75..4add257ec5ba57549dd0e88b16e2a62e6849b414 100644 --- a/library/Class/Systeme/ModulesMenu/Connect.php +++ b/library/Class/Systeme/ModulesMenu/Connect.php @@ -16,25 +16,20 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class Class_Systeme_ModulesMenu_Connect extends Class_Systeme_ModulesMenu_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_NAVIGATION; - /** @var string */ - protected $_type_module = 'CONNECT'; - - /** @var string */ - protected $_libelle = 'Se connecter'; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_NAVIGATION, + $_type_module = 'CONNECT', + $_isPhone = true, + $_defaultValues = [], + $_url = ['controller' => 'auth', + 'action' => 'login']; - /** @var bool */ - protected $_isPhone = true; - /** @var array */ - protected $_defaultValues = []; - - protected $_url = ['controller' => 'auth', - 'action' => 'login']; -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Lien vers la page de connexion'); + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/Disconnect.php b/library/Class/Systeme/ModulesMenu/Disconnect.php index 3e1c6bd4a09e576f3da16877b99e307f1bfc9c49..f0748cee2f7c1f1c93cbae3d9254aed55dca1e79 100644 --- a/library/Class/Systeme/ModulesMenu/Disconnect.php +++ b/library/Class/Systeme/ModulesMenu/Disconnect.php @@ -16,26 +16,21 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesMenu_Disconnect extends Class_Systeme_ModulesMenu_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_NAVIGATION; - /** @var string */ - protected $_type_module = 'DISCONNECT'; - - /** @var string */ - protected $_libelle = 'Se déconnecter'; +class Class_Systeme_ModulesMenu_Disconnect extends Class_Systeme_ModulesMenu_Null { - protected $_url = ['controller' => 'auth', - 'action' => 'logout']; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_NAVIGATION, + $_type_module = 'DISCONNECT', + $_url = ['controller' => 'auth', + 'action' => 'logout'], + $_isPhone = true, + $_defaultValues = []; - /** @var bool */ - protected $_isPhone = true; - /** @var array */ - protected $_defaultValues = array(); - -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Lien vers la page de déconnexion'); + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/FormulaireContact.php b/library/Class/Systeme/ModulesMenu/FormulaireContact.php index 11004122df647c8b9805f94229c96401848b132a..90b211d05099438e7b09ac70f1fc98e61f9442e5 100644 --- a/library/Class/Systeme/ModulesMenu/FormulaireContact.php +++ b/library/Class/Systeme/ModulesMenu/FormulaireContact.php @@ -18,23 +18,19 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesMenu_FormulaireContact extends Class_Systeme_ModulesMenu_Null { - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES; - /** @var string */ - protected $_type_module = 'FORM_CONTACT'; +class Class_Systeme_ModulesMenu_FormulaireContact extends Class_Systeme_ModulesMenu_Null { - /** @var string */ - protected $_libelle = 'Formulaire de contact'; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES, + $_type_module = 'FORM_CONTACT', + $_url = ['controller' => 'index', + 'action' => 'formulairecontact']; - /** @var string */ - protected $_url = ['controller' => 'index', - 'action' => 'formulairecontact']; - public function getDefaultValues() { - return ['barre_nav' => 'Formulaire de contact', - 'bib_selector' => 0]; + public function __construct() { + $this->_libelle = $this->_('Lien vers le formulaire de contact'); + $this->_defaultValues = ['barre_nav' => $this->_libelle, + 'bib_selector' => 0]; } -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/Kidilangues.php b/library/Class/Systeme/ModulesMenu/Kidilangues.php index 7ec758093e0ec1cc14e0376a6635337180238d9e..819d04baa9c2a61263da15126a7b668e90c64b21 100644 --- a/library/Class/Systeme/ModulesMenu/Kidilangues.php +++ b/library/Class/Systeme/ModulesMenu/Kidilangues.php @@ -19,16 +19,17 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - class Class_Systeme_ModulesMenu_Kidilangues extends Class_Systeme_ModulesMenu_SSOAbstract { - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES; - /** @var string */ - protected $_type_module = 'KIDILANGUES'; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES, + $_type_module = 'KIDILANGUES'; + - /** @var string */ - protected $_libelle = 'Lien vers Kidilangues'; + public function __construct() { + $this->_libelle = $this->_('Lien vers Kidilangues'); + $this->_url = Class_KidilanguesLink::staticUrl(); + } public function urlForUser($user) { @@ -40,11 +41,6 @@ class Class_Systeme_ModulesMenu_Kidilangues extends Class_Systeme_ModulesMenu_SS } - public function getUrl($preferences=[]) { - return Class_KidilanguesLink::staticUrl(); - } - - public function isVisibleForProfil($profil) { return Class_AdminVar::isKidilanguesEnabled(); } diff --git a/library/Class/Systeme/ModulesMenu/LastNews.php b/library/Class/Systeme/ModulesMenu/LastNews.php index d561d9a6e7d74805728b0a91570c281a1758f238..63e5c586e5d4f3504be0cf850785689780dc1c97 100644 --- a/library/Class/Systeme/ModulesMenu/LastNews.php +++ b/library/Class/Systeme/ModulesMenu/LastNews.php @@ -16,42 +16,32 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesMenu_LastNews extends Class_Systeme_ModulesMenu_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_INFORMATIONS; - /** @var string */ - protected $_type_module = 'LAST_NEWS'; - - /** @var string */ - protected $_libelle = 'Derniers articles'; +class Class_Systeme_ModulesMenu_LastNews extends Class_Systeme_ModulesMenu_Null { - /** @var string */ - protected $_action = 'lastnews'; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_INFORMATIONS, + $_type_module = 'LAST_NEWS', + $_action = 'lastnews', + $_popupWidth = 550, + $_popupHeight = 290, + $_isPhone = false, + $_isPackMobile = false, + $_defaultValues = ['nb' => '5']; - /** @var int */ - protected $_popupWidth = 550; - /** @var int */ - protected $_popupHeight = 290; - - /** @var bool */ - protected $_isPhone = false; - - /** @var bool */ - protected $_isPackMobile = false; - - /** @var array */ - protected $_defaultValues = array('nb' => '5'); // Nombres d'articles à afficher + public function __construct() { + $this->_libelle = $this->_('Lien vers les articles les plus récents'); + $this->_form = 'ZendAfi_Form_Configuration_Menu_LatestNews'; + } public function getUrl($preferences = []) { - return Class_Url::assemble(['controller' => 'cms', - 'action' => 'articleviewrecent', - 'nb' => $preferences["nb"]]); + $this->_url = Class_Url::assemble(['controller' => 'cms', + 'action' => 'articleviewrecent', + 'nb' => $preferences["nb"]]); + return parent::getUrl($preferences); } - -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/LeSocial.php b/library/Class/Systeme/ModulesMenu/LeSocial.php index cba38c087341064dfaeceb9ca89aa1c997c7aaae..21256065b9057fc159f50c2167dcb4df261426e8 100644 --- a/library/Class/Systeme/ModulesMenu/LeSocial.php +++ b/library/Class/Systeme/ModulesMenu/LeSocial.php @@ -19,15 +19,17 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - class Class_Systeme_ModulesMenu_LeSocial extends Class_Systeme_ModulesMenu_SSOAbstract { - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES; - protected $_type_module = 'LESOCIAL'; - protected $_libelle = 'Lien vers Le Social'; - protected $_url = [ - 'controller' => 'modules', - 'action' => 'lesocial' - ]; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES, + $_type_module = 'LESOCIAL'; + + + public function __construct() { + $this->_libelle = $this->_('Lien vers Le Social'); + $this->_url = Class_LeSocialLink::staticUrl(); + } + public function urlForUser($user) { if ($user && $user->hasRightAccessLeSocial() && Class_AdminVar::isLeSocialEnabled()) @@ -37,11 +39,6 @@ class Class_Systeme_ModulesMenu_LeSocial extends Class_Systeme_ModulesMenu_SSOAb } - public function getUrl($preferences=[]) { - return Class_LeSocialLink::staticUrl(); - } - - public function isVisibleForProfil($profil) { return Class_AdminVar::isLeSocialEnabled(); } diff --git a/library/Class/Systeme/ModulesMenu/Menu.php b/library/Class/Systeme/ModulesMenu/Menu.php index 875350e23927237d1509bed258a42a69d70d98b4..232c948735298aac55a36bf24868ba76d43753f7 100644 --- a/library/Class/Systeme/ModulesMenu/Menu.php +++ b/library/Class/Systeme/ModulesMenu/Menu.php @@ -16,26 +16,33 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + class Class_Systeme_ModulesMenu_Menu extends Class_Systeme_ModulesMenu_Null { - /** @var string */ - protected $_libelle = 'Menu'; - /** @var string */ - protected $_type_module = 'MENU'; - protected $_action = 'lienprofil'; + protected + $_type_module = 'MENU', + $_action = 'lienprofil', + $_defaultValues = ['clef_profil' => '0'], + $_form = 'ZendAfi_Form_Configuration_NavWidget'; + - protected $_defaultValues = ['clef_profil' => '0']; + public function __construct() { + $this->_libelle = $this->_('Menu'); + } public function getUrl($preferences=[]) { - return $preferences['clef_profil'] > 0 + return $preferences['clef_profil'] > 0 ? Class_Url::assemble(['controller' => 'index', 'action' => 'index', - 'id_profil' => $preferences["clef_profil"]]) + 'id_profil' => $preferences["clef_profil"]]) : '#'; } -} -?> \ No newline at end of file + + public function isMenu() { + return true; + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/MusicMe.php b/library/Class/Systeme/ModulesMenu/MusicMe.php index b0e9d01f93c0ccc4d658f88984cefda5a59154e8..f86b20d8b4bb1a9d1246805b2fc20f9b0ac27a54 100644 --- a/library/Class/Systeme/ModulesMenu/MusicMe.php +++ b/library/Class/Systeme/ModulesMenu/MusicMe.php @@ -18,19 +18,19 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + class Class_Systeme_ModulesMenu_MusicMe extends Class_Systeme_ModulesMenu_SSOAbstract { - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES; - /** @var string */ - protected $_type_module = 'MusicMe'; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES, + $_type_module = 'MusicMe', + $_url = ['controller' => 'modules', + 'action' => 'musicme']; - /** @var string */ - protected $_libelle = 'Lien vers MusicMe'; - /** @var string */ - protected $_url = ['controller' => 'modules', - 'action' => 'musicme']; + public function __construct() { + $this->_libelle = $this->_('Lien vers MusicMe'); + } public function getMusicMeUrlForUser($user) { @@ -60,5 +60,4 @@ class Class_Systeme_ModulesMenu_MusicMe extends Class_Systeme_ModulesMenu_SSOAbs public function isVisibleForProfil($profil) { return Class_AdminVar::isMusicMeEnabled(); } -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/MyCow.php b/library/Class/Systeme/ModulesMenu/MyCow.php index 1fe973736abfbbf5780b5681df33787e582351f2..8e05ad4ee2321d1e2b2d0212573f5bf546fead9a 100644 --- a/library/Class/Systeme/ModulesMenu/MyCow.php +++ b/library/Class/Systeme/ModulesMenu/MyCow.php @@ -18,17 +18,19 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + class Class_Systeme_ModulesMenu_MyCow extends Class_Systeme_ModulesMenu_SSOAbstract { + const MYCOW_URL = 'https://www.mycow.eu/connectSSO.php'; - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES, + $_type_module = 'MYCOW'; - /** @var string */ - protected $_type_module = 'MYCOW'; - /** @var string */ - protected $_libelle = 'Lien vers MyCOW.EU'; + public function __construct() { + $this->_libelle = $this->_('Lien vers MyCOW.EU'); + } public function urlForUser($user) { diff --git a/library/Class/Systeme/ModulesMenu/News.php b/library/Class/Systeme/ModulesMenu/News.php index b57319236343ea426f65f2a2797cffa8d2457246..03803e85a06ab822ac38fbcef5f9abac4e13761a 100644 --- a/library/Class/Systeme/ModulesMenu/News.php +++ b/library/Class/Systeme/ModulesMenu/News.php @@ -16,47 +16,36 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesMenu_News extends Class_Systeme_ModulesMenu_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_INFORMATIONS; - /** @var string */ - protected $_type_module = 'NEWS'; - - /** @var string */ - protected $_libelle = 'Articles cms'; - - /** @var string */ - protected $_action = 'news'; - - - /** @var int */ - protected $_popupWidth = 700; - - /** @var int */ - protected $_popupHeight = 400; - - /** @var bool */ - protected $_isPhone = false; - - /** @var bool */ - protected $_isPackMobile = false; +class Class_Systeme_ModulesMenu_News extends Class_Systeme_ModulesMenu_Null { + + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_INFORMATIONS, + $_type_module = 'NEWS', + $_action = 'news', + $_popupWidth = 700, + $_popupHeight = 400, + $_isPhone = false, + $_isPackMobile = false, + $_defaultValues = ['id_categorie' => '', + 'id_items' => '', + 'nb_aff' => '5', + 'nb_analyse' => '10', + 'display_order' => 'Selection']; + + + public function __construct() { + $this->_libelle = $this->_('Lien vers une sélection d\'articles'); + $this->_form = 'ZendAfi_Form_Configuration_Menu_News'; + } - /** @var array */ - protected $_defaultValues = array( - 'id_categorie' => '', // Liste d'id_categorie séparés par des tirets - 'id_items' => '', // Liste d'id_news séparés par des tirets - 'nb_aff' => '5', // Nombres d'articles à afficher - 'nb_analyse' => '10', // Nombres d'articles à analyser - 'display_order' => 'Selection', - ); public function getUrl($preferences = []) { - return Class_Url::assemble(array_merge(['controller' => 'cms', - 'action' => 'articleviewpreferences'], - array_filter($preferences))); + $this->_url = array_merge(['controller' => 'cms', + 'action' => 'articleviewpreferences'], + array_filter(array_intersect_key($preferences, $this->_defaultValues))); + return parent::getUrl($preferences); } -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/Null.php b/library/Class/Systeme/ModulesMenu/Null.php index 479056b79df8edebb858a51a8bc736eb9657bd9d..9631929a49d350ae0b76baa4a28cbc524a511db3 100644 --- a/library/Class/Systeme/ModulesMenu/Null.php +++ b/library/Class/Systeme/ModulesMenu/Null.php @@ -16,25 +16,35 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesMenu_Null extends Class_Systeme_ModulesAccueil_Null { - /** @var string */ - protected $_url = ''; - - protected $_message=''; - - protected $_action = 'index'; - protected $_group=''; - /** @var string */ - protected $_open_in_new_window = false; - - protected $_popupWidth='550'; - protected $_popupHeight='215'; +class Class_Systeme_ModulesMenu_Null extends Class_Systeme_ModulesAccueil_Null { - public function getUrl($preferences=[]) { - return is_array($this->_url) ? Class_Url::assemble($this->_url) : BASE_URL.$this->_url; + protected + $_defaultValues = [], + $_url = '', + $_message='', + $_action = 'index', + $_group='', + $_open_in_new_window = false, + $_popupWidth='550', + $_popupHeight='215', + $_type_module, + $_form = 'ZendAfi_Form_Configuration_Menu_Entry'; + + + public function getUrl($preferences = []) { + if(!isset($preferences['preferences'])) + $preferences['preferences'] = $preferences; + + $profil_parts = []; + if (isset($preferences['use_profil']) && $preferences['use_profil']) + $profil_parts = ['id_profil' => $preferences['use_profil']]; + + return is_array($this->_url) + ? Class_Url::assemble(array_merge($this->_url, $profil_parts)) + : BASE_URL . $this->_url; } @@ -54,23 +64,36 @@ class Class_Systeme_ModulesMenu_Null extends Class_Systeme_ModulesAccueil_Null { 'phone' => $this->isPhone(), 'popup_width' => $this->_popupWidth, 'popup_height' => $this->_popupHeight, - + ]; if ($this->_action) $properties['action'] = $this->_action; - return $properties; + return $properties; } + function setMessage($message) { $this->_message=$message; } + function getMessage() { return $this->_message; } -} + public function getDefaultValues() { + if(!$this->_type_module) + return []; -?> \ No newline at end of file + return array_merge(['type_module' => $this->_type_module, + 'type_menu' => $this->_type_module, + 'id_module' => '', + 'libelle' => $this->_libelle, + 'picto' => '', + 'action' => '', + 'preferences' => []], + $this->_defaultValues); + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/Numilog.php b/library/Class/Systeme/ModulesMenu/Numilog.php index 722d935fa0aba783ddcc422b2affbe9912d1012c..6569397f9f37b17e6ebeab78e5b1a738bad2b368 100644 --- a/library/Class/Systeme/ModulesMenu/Numilog.php +++ b/library/Class/Systeme/ModulesMenu/Numilog.php @@ -18,19 +18,19 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + class Class_Systeme_ModulesMenu_Numilog extends Class_Systeme_ModulesMenu_SSOAbstract { - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES; - /** @var string */ - protected $_type_module = 'NUMILOG'; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES, + $_type_module = 'NUMILOG', + $_url = ['controller' => 'modules', + 'action' => 'numilog']; - /** @var string */ - protected $_libelle = 'Lien vers Numilog'; - /** @var string */ - protected $_url = ['controller' => 'modules', - 'action' => 'numilog']; + public function __construct() { + $this->_libelle = $this->_('Lien vers Numilog'); + } public function getNumilogUrlForUser($user) { diff --git a/library/Class/Systeme/ModulesMenu/Orthodidacte.php b/library/Class/Systeme/ModulesMenu/Orthodidacte.php index d385efcb3b8bab6a24e5fd41f74c4435efb43f00..cdbcf5da68fafe54a4f764bb7210e29ba0299e7d 100644 --- a/library/Class/Systeme/ModulesMenu/Orthodidacte.php +++ b/library/Class/Systeme/ModulesMenu/Orthodidacte.php @@ -19,21 +19,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - class Class_Systeme_ModulesMenu_Orthodidacte extends Class_Systeme_ModulesMenu_SSOAbstract { - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES; - /** @var string */ - protected $_type_module = 'ORTHODIDACTE'; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES, + $_type_module = 'ORTHODIDACTE', + $_url = ['controller' => 'modules', + 'action' => 'orthodidacte']; - /** @var string */ - protected $_libelle = 'Lien vers Orthodidacte'; - protected $_url = [ - 'controller' => 'modules', - 'action' => 'orthodidacte' - ]; + public function __construct() { + $this->_libelle = $this->_('Lien vers Orthodidacte'); + } public function urlForUser($user) { diff --git a/library/Class/Systeme/ModulesMenu/Paniers.php b/library/Class/Systeme/ModulesMenu/Paniers.php index 3a550d27323c2162fbb4b5a4b353b0affc63a34c..101d2d763003d3cf46308feff0894356bfc712b4 100644 --- a/library/Class/Systeme/ModulesMenu/Paniers.php +++ b/library/Class/Systeme/ModulesMenu/Paniers.php @@ -16,21 +16,20 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesMenu_Paniers extends Class_Systeme_ModulesMenu_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES; - /** @var string */ - protected $_type_module = 'PANIER'; - - protected $_libelle = "Paniers de notices"; - - protected $_isPhone = false; +class Class_Systeme_ModulesMenu_Paniers extends Class_Systeme_ModulesMenu_Null { - /** @var string */ - protected $_url = ['controller' => 'panier', - 'action' => 'index']; -} -?> \ No newline at end of file + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES, + $_type_module = 'PANIER', + $_isPhone = false, + $_url = ['controller' => 'panier', + 'action' => 'index']; + + + public function __construct() { + $this->_libelle = $this->_('Lien vers mes paniers'); + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/PlanetNemo.php b/library/Class/Systeme/ModulesMenu/PlanetNemo.php index 65f9b3245554170e363ac01b5b181db4a7a71949..97a85349f704bc4efcbbbe6887c700706f573e58 100644 --- a/library/Class/Systeme/ModulesMenu/PlanetNemo.php +++ b/library/Class/Systeme/ModulesMenu/PlanetNemo.php @@ -18,16 +18,17 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + class Class_Systeme_ModulesMenu_PlanetNemo extends Class_Systeme_ModulesMenu_SSOAbstract { - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES, + $_type_module = 'PLANETNEMO'; - /** @var string */ - protected $_type_module = 'PLANETNEMO'; - /** @var string */ - protected $_libelle = 'Lien vers planetnemo.fr'; + public function construct() { + $this->_libelle = $this->_('Lien vers planetnemo.fr'); + } public function urlForUser($user) { diff --git a/library/Class/Systeme/ModulesMenu/PreRegistration.php b/library/Class/Systeme/ModulesMenu/PreRegistration.php index 2c94d66d87ef927a9575259dbd0d44b8f20bba32..91f9abcecb390f82c4135e986175d19b360bf13f 100644 --- a/library/Class/Systeme/ModulesMenu/PreRegistration.php +++ b/library/Class/Systeme/ModulesMenu/PreRegistration.php @@ -18,19 +18,18 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesMenu_PreRegistration extends Class_Systeme_ModulesMenu_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_NAVIGATION; - /** @var string */ - protected $_type_module = 'PREREGISTRATION'; +class Class_Systeme_ModulesMenu_PreRegistration extends Class_Systeme_ModulesMenu_Null { - protected $_libelle = "Se préinscrire"; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_NAVIGATION, + $_type_module = 'PREREGISTRATION', + $_isPhone = false, + $_url = ['controller' => 'auth', + 'action' => 'pre-registration']; - protected $_isPhone = false; - /** @var string */ - protected $_url = ['controller' => 'auth', - 'action' => 'pre-registration']; -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Lien vers la page de préinscription'); + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/Profil.php b/library/Class/Systeme/ModulesMenu/Profil.php index e809160fc052d050a3f14af429ae23b910fe2e06..b99db8488587bbd229f397d10b2959e88a27b455 100644 --- a/library/Class/Systeme/ModulesMenu/Profil.php +++ b/library/Class/Systeme/ModulesMenu/Profil.php @@ -18,25 +18,25 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesMenu_Profil extends Class_Systeme_ModulesMenu_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_INFORMATIONS; - /** @var string */ - protected $_type_module = 'PROFIL'; +class Class_Systeme_ModulesMenu_Profil extends Class_Systeme_ModulesMenu_Null { - /** @var int */ - protected $_popupWidth = 550; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_INFORMATIONS, + $_type_module = 'PROFIL', + $_popupWidth = 550, + $_libelle = 'Lien vers un profil du portail', + $_popupHeight = 290, + $_isPhone = false, + $_action = 'lienprofil', + $_defaultValues = ['clef_profil' => '1']; - protected $_libelle = 'Lien vers un profil du portail'; - /** @var int */ - protected $_popupHeight = 290; - protected $_isPhone = false; - - protected $_action = 'lienprofil'; + public function __construct() { + $this->_libelle = $this->_('Lien vers un profil ou une page'); + $this->_form = 'ZendAfi_Form_Configuration_Menu_LinkToProfile'; + } - protected $_defaultValues = ['clef_profil' => '1'];// Par defaut profil portail public function getUrl($preferences=[]) { return $this->_url = Class_Url::assemble($this->_getUrlParams($preferences), diff --git a/library/Class/Systeme/ModulesMenu/RechercheAvancee.php b/library/Class/Systeme/ModulesMenu/RechercheAvancee.php index 70d7046235acb6082662048951d809f21c158401..62e08d267a1359458c6ca9d64a467d148d3ea3ce 100644 --- a/library/Class/Systeme/ModulesMenu/RechercheAvancee.php +++ b/library/Class/Systeme/ModulesMenu/RechercheAvancee.php @@ -16,24 +16,22 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesMenu_RechercheAvancee extends Class_Systeme_ModulesMenu_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_RECHERCHES; - /** @var string */ - protected $_type_module = 'RECH_AVANCEE'; - - /** @var int */ - protected $_libelle = "Recherche avancée"; +class Class_Systeme_ModulesMenu_RechercheAvancee extends Class_Systeme_ModulesMenu_Null { - protected $_isPhone = false; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_RECHERCHES, + $_type_module = 'RECH_AVANCEE', + $_libelle = "Recherche avancée", + $_isPhone = false, + $_url = ['controller' => 'recherche', + 'action' => 'avancee', + 'statut' => 'reset']; - protected $_url = ['controller' => 'recherche', - 'action' => 'avancee', - 'statut' => 'reset']; - -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Lien vers la recherche avancée'); + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/RechercheGeographique.php b/library/Class/Systeme/ModulesMenu/RechercheGeographique.php index edb6e1f057f40dafb3fe42822f7447b7168369a2..1f983de5b787b67d34e8fa9b9b86bfb23fade243 100644 --- a/library/Class/Systeme/ModulesMenu/RechercheGeographique.php +++ b/library/Class/Systeme/ModulesMenu/RechercheGeographique.php @@ -16,22 +16,20 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesMenu_RechercheGeographique extends Class_Systeme_ModulesMenu_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_RECHERCHES; - /** @var string */ - protected $_type_module = 'RECH_GEO'; - - /** @var int */ - protected $_libelle = "Recherche géographique"; +class Class_Systeme_ModulesMenu_RechercheGeographique extends Class_Systeme_ModulesMenu_Null { - protected $_isPhone = false; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_RECHERCHES, + $_type_module = 'RECH_GEO', + $_isPhone = false, + $_url = ['controller' => 'bib', + 'action' => 'index']; - protected $_url = ['controller' => 'bib', - 'action' => 'index']; -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Lien vers la recherche géographique'); + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/RechercheGuidee.php b/library/Class/Systeme/ModulesMenu/RechercheGuidee.php index 8525875b83e325c8a6435c2eac0dcf85b2e180cd..53cf9f1cdce6cabf69c9c97542dc50a779d3f156 100644 --- a/library/Class/Systeme/ModulesMenu/RechercheGuidee.php +++ b/library/Class/Systeme/ModulesMenu/RechercheGuidee.php @@ -16,23 +16,21 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesMenu_RechercheGuidee extends Class_Systeme_ModulesMenu_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_RECHERCHES; - /** @var string */ - protected $_type_module = 'RECH_GUIDEE'; - - /** @var int */ - protected $_libelle = "Recherche guidée"; +class Class_Systeme_ModulesMenu_RechercheGuidee extends Class_Systeme_ModulesMenu_Null { - protected $_isPhone = false; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_RECHERCHES, + $_type_module = 'RECH_GUIDEE', + $_isPhone = false, + $_url = ['controller' => 'recherche', + 'action' => 'guidee', + 'statut' => 'reset']; - protected $_url = ['controller' => 'recherche', - 'action' => 'guidee', - 'statut' => 'reset']; -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Lien vers la recherche guidée'); + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/RechercheOai.php b/library/Class/Systeme/ModulesMenu/RechercheOai.php index 60c3ac87b57f7c84aad6cd3c809e7b252f90bc92..fa79d433bcc49dd9b88be6e207796976233c6f07 100644 --- a/library/Class/Systeme/ModulesMenu/RechercheOai.php +++ b/library/Class/Systeme/ModulesMenu/RechercheOai.php @@ -16,23 +16,21 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesMenu_RechercheOai extends Class_Systeme_ModulesMenu_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_RECHERCHES; - /** @var string */ - protected $_type_module = 'RECH_OAI'; - - /** @var int */ - protected $_libelle = "Recherche OAI"; +class Class_Systeme_ModulesMenu_RechercheOai extends Class_Systeme_ModulesMenu_Null { - protected $_isPhone = false; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_RECHERCHES, + $_type_module = 'RECH_OAI', + $_isPhone = false, + $_url = ['controller' => 'rechercheoai', + 'action' => 'index', + 'statut' => 'saisie']; - protected $_url = ['controller' => 'rechercheoai', - 'action' => 'index', - 'statut' => 'saisie']; -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Lien vers la recherche OAI'); + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/RechercheSimple.php b/library/Class/Systeme/ModulesMenu/RechercheSimple.php index 64de7b37ae6ac2e9747562fc8047ab5549704ba0..f9e9bb3b3cf21ab9d72932f8e579c7169cb62054 100644 --- a/library/Class/Systeme/ModulesMenu/RechercheSimple.php +++ b/library/Class/Systeme/ModulesMenu/RechercheSimple.php @@ -16,23 +16,21 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesMenu_RechercheSimple extends Class_Systeme_ModulesMenu_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_RECHERCHES; - /** @var string */ - protected $_type_module = 'RECH_SIMPLE'; - - /** @var int */ - protected $_libelle = "Recherche simple"; +class Class_Systeme_ModulesMenu_RechercheSimple extends Class_Systeme_ModulesMenu_Null { - protected $_isPhone = true; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_RECHERCHES, + $_type_module = 'RECH_SIMPLE', + $_isPhone = true, + $_url = ['controller' => 'recherche', + 'action' => 'simple', + 'statut' => 'reset']; - protected $_url = ['controller' => 'recherche', - 'action' => 'simple', - 'statut' => 'reset']; -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Lien vers la recherche'); + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/Register.php b/library/Class/Systeme/ModulesMenu/Register.php index 1440bf3d83c24ae5a325c0884763ea646a46d756..59e862fafaab5d2c0dff5b5e17107fcd7b172b24 100644 --- a/library/Class/Systeme/ModulesMenu/Register.php +++ b/library/Class/Systeme/ModulesMenu/Register.php @@ -18,19 +18,18 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesMenu_Register extends Class_Systeme_ModulesMenu_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_NAVIGATION; - /** @var string */ - protected $_type_module = 'REGISTER'; +class Class_Systeme_ModulesMenu_Register extends Class_Systeme_ModulesMenu_Null { - protected $_libelle = "S'enregistrer"; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_NAVIGATION, + $_type_module = 'REGISTER', + $_isPhone = false, + $_url = ['controller' => 'auth', + 'action' => 'register']; - protected $_isPhone = false; - /** @var string */ - protected $_url = ['controller' => 'auth', - 'action' => 'register']; -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Lien vers l\'enregistrement'); + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/ReserverPoste.php b/library/Class/Systeme/ModulesMenu/ReserverPoste.php index 083984bcae09bea0c7fffae8803ff479abcf1c4c..3ab89eae8bf028bd26198230dbab67670906dd85 100644 --- a/library/Class/Systeme/ModulesMenu/ReserverPoste.php +++ b/library/Class/Systeme/ModulesMenu/ReserverPoste.php @@ -16,26 +16,24 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesMenu_ReserverPoste extends Class_Systeme_ModulesMenu_Null { - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES; - /** @var string */ - protected $_type_module = 'RESERVER_POSTE'; +class Class_Systeme_ModulesMenu_ReserverPoste extends Class_Systeme_ModulesMenu_Null { + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES, + $_type_module = 'RESERVER_POSTE', + $_url = ['controller' => 'abonne', + 'action' => 'multimedia-hold-location']; - /** @var string */ - protected $_libelle = 'Réserver un poste multimédia'; - /** @var string */ - protected $_url = ['controller' => 'abonne', - 'action' => 'multimedia-hold-location']; + public function __construct() { + $this->_libelle = $this->_('Lien vers la réservation d\'un poste multimédia'); + } public function isVisibleForProfil($profil) { return Class_AdminVar::isMultimediaEnabled(); } -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/Rss.php b/library/Class/Systeme/ModulesMenu/Rss.php index b515f751380c8e730754d009f3bc907dd3618535..0893f3d1e90e7ea4e10853357221632cbe958c95 100644 --- a/library/Class/Systeme/ModulesMenu/Rss.php +++ b/library/Class/Systeme/ModulesMenu/Rss.php @@ -16,44 +16,35 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesMenu_Rss extends Class_Systeme_ModulesMenu_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_INFORMATIONS; - /** @var string */ - protected $_type_module = 'RSS'; - - /** @var int */ - protected $_popupWidth = 800; +class Class_Systeme_ModulesMenu_Rss extends Class_Systeme_ModulesMenu_Null { - /** @var int */ - protected $_popupHeight = 550; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_INFORMATIONS, + $_type_module = 'RSS', + $_popupWidth = 800, + $_popupHeight = 550, + $_action = 'rss', + $_defaultValues = ['id_categorie' => '', + 'id_items' => '', + 'nb' => '10']; - /** @var string */ - protected $_libelle = 'Fils Rss'; - /** @var string */ - protected $_action = 'rss'; - - protected $_defaultValues = array( - 'id_categorie' => '', // Liste d'id_categorie séparés par des tirets - 'id_items' => '', // Liste d'id_sito séparés par des tirets - 'nb' => '10', // Nombres de flux à afficher - ); + public function __construct() { + $this->_libelle = $this->_('Lien vers un flux RSS'); + $this->_form = 'ZendAfi_Form_Configuration_Menu_Rss'; + } public function getUrl($preferences =[]) { - if ($preferences["id_items"]) { - $items = implode(';', explode("-", $preferences["id_items"])); - return Class_Url::assemble(['controller' => 'rss', - 'action' => 'main', - 'liste_flux' => $items]); - } - return $this->_url; - } + $this->_url = ['controller' => 'rss', + 'action' => 'main']; + if ($preferences["id_items"]) + $this->_url['liste_flux'] = implode(';', explode("-", $preferences["id_items"])); -} -?> \ No newline at end of file + return parent::getUrl($preferences); + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/Sitotheque.php b/library/Class/Systeme/ModulesMenu/Sitotheque.php index c717b19fe0cd41b8f2a0b6127a014baf94b0354a..a09e5b6863b41ae5c45e69ecd1fd4d208b9af19a 100644 --- a/library/Class/Systeme/ModulesMenu/Sitotheque.php +++ b/library/Class/Systeme/ModulesMenu/Sitotheque.php @@ -16,38 +16,32 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesMenu_Sitotheque extends Class_Systeme_ModulesMenu_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_INFORMATIONS; - /** @var string */ - protected $_type_module = 'SITO'; +class Class_Systeme_ModulesMenu_Sitotheque extends Class_Systeme_ModulesMenu_Null { - /** @var string */ - protected $_libelle = 'Sitothèque'; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_INFORMATIONS, + $_type_module = 'SITO', + $_action = 'sitotheque', + $_popupWidth = 800, + $_popupHeight = 550, + $_defaultValues = ['id_categorie' => '', + 'id_items' => '', + 'nb' => '10']; - /** @var string */ - protected $_action = 'sitotheque'; - /** @var int */ - protected $_popupWidth = 800; - - /** @var int */ - protected $_popupHeight = 550; - - protected $_defaultValues = array( - 'id_categorie' => '', // Liste d'id_categorie séparés par des tirets - 'id_items' => '', // Liste d'id_sito séparés par des tirets - 'nb' => '10', // Nombres de flux à afficher - ); + public function __construct() { + $this->_libelle = $this->_('Lien vers une sitothèque'); + $this->_form = 'ZendAfi_Form_Configuration_Menu_ListOfSites'; + } public function getUrl($preferences = []) { - return Class_Url::assemble(array_merge(['controller' => 'sito', - 'action' => 'sitoview'], - array_filter($preferences))); + $this->_url = array_merge(['controller' => 'sito', + 'action' => 'sitoview'], + array_filter(array_intersect_key($preferences, $this->_defaultValues))); + return parent::getUrl($preferences); } -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/SuggestionAchat.php b/library/Class/Systeme/ModulesMenu/SuggestionAchat.php index aa36cad0a4806262d7ad24924036ee45fc278cb3..2b51c6e7b270a1ec9697f7fde710b8a22675073a 100644 --- a/library/Class/Systeme/ModulesMenu/SuggestionAchat.php +++ b/library/Class/Systeme/ModulesMenu/SuggestionAchat.php @@ -16,21 +16,19 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesMenu_SuggestionAchat extends Class_Systeme_ModulesMenu_Null { - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES; - /** @var string */ - protected $_type_module = 'SUGGESTION_ACHAT'; +class Class_Systeme_ModulesMenu_SuggestionAchat extends Class_Systeme_ModulesMenu_Null { + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES, + $_type_module = 'SUGGESTION_ACHAT', + $_url = ['controller' => 'abonne', + 'action' => 'suggestion-achat']; - /** @var string */ - protected $_libelle = 'Suggestion d\'achat'; - /** @var string */ - protected $_url = ['controller' => 'abonne', - 'action' => 'suggestion-achat']; -} -?> \ No newline at end of file + public function __construct() { + $this->_libelle = $this->_('Lien vers la suggestion d\'achat'); + } +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/ToutApprendre.php b/library/Class/Systeme/ModulesMenu/ToutApprendre.php index 4d16923002436c5c359a24acf479658391553f52..83f14b65b5946082bde1ba506b7c708d9c3aecb3 100644 --- a/library/Class/Systeme/ModulesMenu/ToutApprendre.php +++ b/library/Class/Systeme/ModulesMenu/ToutApprendre.php @@ -18,15 +18,18 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + class Class_Systeme_ModulesMenu_ToutApprendre extends Class_Systeme_ModulesMenu_SSOAbstract { - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES; - /** @var string */ - protected $_type_module = 'TOUTAPPRENDRE'; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES, + $_type_module = 'TOUTAPPRENDRE'; + - /** @var string */ - protected $_libelle = 'Lien vers Tout Apprendre'; + public function __construct() { + $this->libelle = $this->_('libelle'); + $this->_url = Class_ToutApprendreLink::staticUrl(); + } public function urlForUser($user) { @@ -36,10 +39,6 @@ class Class_Systeme_ModulesMenu_ToutApprendre extends Class_Systeme_ModulesMenu_ return ''; } - public function getUrl($preferences=[]) { - return Class_ToutApprendreLink::staticUrl(); - } - public function isVisibleForProfil($profil) { return Class_AdminVar::isToutApprendreEnabled(); diff --git a/library/Class/Systeme/ModulesMenu/Url.php b/library/Class/Systeme/ModulesMenu/Url.php index c53ae3e6868c104ebef38ac933049f0118570b19..789f8b79ced3e71dac4311b414edf5e9078fe0b4 100644 --- a/library/Class/Systeme/ModulesMenu/Url.php +++ b/library/Class/Systeme/ModulesMenu/Url.php @@ -18,38 +18,32 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Systeme_ModulesMenu_Url extends Class_Systeme_ModulesMenu_Null{ - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_INFORMATIONS; - /** @var string */ - protected $_type_module = 'URL'; +class Class_Systeme_ModulesMenu_Url extends Class_Systeme_ModulesMenu_Null { - /** @var int */ - protected $_popupWidth = 550; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_INFORMATIONS, + $_type_module = 'URL', + $_popupWidth = 550, + $_popupHeight = 290, + $_isPhone = false, + $_action = 'liensite', + $_defaultValues = ['target' => 0, + 'url' => '']; - protected $_libelle = "Lien vers un site"; - /** @var int */ - protected $_popupHeight = 290; - protected $_isPhone = false; - - protected $_action = 'liensite'; + public function __construct() { + $this->_libelle = $this->_('Lien vers un site'); + $this->_form = 'ZendAfi_Form_Configuration_Menu_Link'; + } - protected $_defaultValues = array( - 'target' => 1, // Ouvrir dans un nouvel onglet ou pas - 'url' => 'https://google.fr', - ); public function getUrl($preferences=[]) { return $preferences['url']; } - public function shouldOpenInNewWindow($preferences=[]) { + public function shouldOpenInNewWindow($preferences = []) { return (0 == $preferences['target']); } - - -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/Vodeclic.php b/library/Class/Systeme/ModulesMenu/Vodeclic.php index 59f7556bc3fcc9a772acf048923c7247f555ba53..8d7a1bd89b0aa0a8ec7812bbe172fab775934507 100644 --- a/library/Class/Systeme/ModulesMenu/Vodeclic.php +++ b/library/Class/Systeme/ModulesMenu/Vodeclic.php @@ -18,15 +18,18 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + class Class_Systeme_ModulesMenu_Vodeclic extends Class_Systeme_ModulesMenu_SSOAbstract { - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES; - /** @var string */ - protected $_type_module = 'VODECLIC'; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES, + $_type_module = 'VODECLIC'; + - /** @var string */ - protected $_libelle = 'Lien vers Vodeclic'; + public function __construct() { + $this->_libelle = $this->_('Lien vers Vodeclic'); + $this->_url = Class_VodeclicLink::staticUrl(); + } public function urlForUser($user) { @@ -37,12 +40,7 @@ class Class_Systeme_ModulesMenu_Vodeclic extends Class_Systeme_ModulesMenu_SSOAb } - public function getUrl($preferences=[]) { - return Class_VodeclicLink::staticUrl(); - } - - public function isVisibleForProfil($profil) { return Class_AdminVar::isVodeclicEnabled(); } -} +} \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/WebkioskReservation.php b/library/Class/Systeme/ModulesMenu/WebkioskReservation.php index 574d31823f5abff73d26146e6d453da9349ffed5..c01b1ef7cbb7f85c18f337a851d54457682b31f7 100644 --- a/library/Class/Systeme/ModulesMenu/WebkioskReservation.php +++ b/library/Class/Systeme/ModulesMenu/WebkioskReservation.php @@ -18,24 +18,23 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + class Class_Systeme_ModulesMenu_WebkioskReservation extends Class_Systeme_ModulesMenu_Null { - /** @var string */ - protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES; - /** @var string */ - protected $_type_module = 'WEBKIOSK_RESERVATION'; + protected + $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES, + $_url = ['controller' => 'abonne', + 'action' => 'webkiosk-reservation'], + $_type_module = 'WEBKIOSK_RESERVATION'; + - /** @var string */ - protected $_libelle = 'Réserver un poste Webkiosk'; + public function __construct() { + $this->_libelle = $this->_('Lien vers la réservation d\'un poste Webkiosk'); + } - /** @var string */ - protected $_url = ['controller' => 'abonne', - 'action' => 'webkiosk-reservation']; public function isVisibleForProfil($profil) { return ('' != Class_AdminVar::get('WEBKIOSK_RESERVATION_URL')) && ('' != Class_AdminVar::get('WEBKIOSK_KEY')); } -} - -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/Class/Systeme/Widget/Abstract.php b/library/Class/Systeme/Widget/Abstract.php new file mode 100644 index 0000000000000000000000000000000000000000..b20785f13475c194e22dc4d90eb53c4132cbe5dd --- /dev/null +++ b/library/Class/Systeme/Widget/Abstract.php @@ -0,0 +1,175 @@ +<?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 + */ + +abstract class Class_Systeme_Widget_Abstract extends Class_Entity { + use Trait_Translator; + + public function load() { + if(!$this->init()) + return null; + + if(!$this->_load()) + return null; + + return $this + ->setTitle($this->_getTitle()) + ->setForm($this->_getForm()) + ->whenCalledDo('updateProfile', function() {return $this->_update();}) + ->whenCalledDo('forForm', function() + { + $settings = $this->getLocalSettings(); + $preferences = isset($settings['preferences']) + ? $settings['preferences'] + : []; + return array_merge($preferences, $settings, $this->toArray()); + }); + } + + + public function init() { + if(!$this->getProfileId()) + return null; + + if(!$profil = Class_Profil::find($this->getProfileId())) + return null; + + if('' == (String) $this->getId()) + return null; + + $this->setProfile($profil); + return $this; + } + + + protected function _getTitle() { + return $this->_getWidgetResources()->getTitle(); + } + + + protected function _getForm() { + return $this->_getWidgetResources()->getForm(); + } + + + protected function _getValues($attributes) { + return $this->_getWidgetResources()->getValues(array_merge(isset($attributes['preferences']) + ? $attributes['preferences'] + : [], + $attributes)); + } + + + protected function _getWidgetResources() { + return $this->getResourcesDefinition(); + } + + + protected function _transmute($attributes) { + if(empty($attributes)) + return null; + + if((!isset($attributes['type_menu'])) && (!isset($attributes['type_module']))) + return null; + + $this->setResourcesDefinition($this->_getResourcesDefinition(isset($attributes['type_menu']) + ? $attributes['type_menu'] + : $attributes['type_module'])); + $attributes = $this->_getValues($attributes); + $this->updateAttributes($attributes); + + if(isset($attributes['menus']) || isset($attributes['sous_menus'])) + $this->setChildren($this->_loadChildren(isset($attributes['menus']) ? $attributes['menus'] : $attributes['sous_menus'])); + + return $this->setLocalSettings($attributes); + } + + + protected function _loadChildren($children) { + if(empty($children)) + return []; + + $datas = []; + foreach($children as $index => $child) { + $item = $this->_getResourcesDefinition(isset($child['type_menu']) ? $child['type_menu'] : $child['type_module']); + + $datas[] = (new Class_Entity()) + ->setId($child['id_module']) + ->setCategory($item->getCategoryLabel()) + ->setLabel(sprintf('%s ( %s )', + $item->getLibelle(), + $child['libelle'])); + } + + return $datas; + } + + + protected function _getResourcesDefinition($type) { + return $this->getResourcesProvider()->getFonction($type); + } + + + protected function _convertChildren($datas) { + $datas = explode(';', $datas); + $menus = []; + foreach($datas as $id) { + if('' == $id) + continue; + + $menu = ($menu = $this->_findDeepIn($this->getLocalSettings(), $id)) + ? $menu + : (new Class_Systeme_ModulesMenu())->getValeursParDefaut($id); + + if(empty($menu)) + continue; + + $menus[] = $menu; + } + + return array_filter($menus); + } + + + protected function _load() { + return []; + } + + + protected function _findLeaf($id) { + return []; + } + + + protected function _update() { + return $this->_save([]); + } + + + protected function _save($datas) { + return false; + } + + public function getLabel() { + return $this->gettitre() + ? $this->gettitre() + : $this->getlibelle(); + } +} diff --git a/library/Class/Systeme/Widget/Menu.php b/library/Class/Systeme/Widget/Menu.php new file mode 100644 index 0000000000000000000000000000000000000000..8b4d2ee71a6668b08d63b4dae33cf88ce6763bf1 --- /dev/null +++ b/library/Class/Systeme/Widget/Menu.php @@ -0,0 +1,178 @@ +<?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 Class_Systeme_Widget_Menu extends Class_Systeme_Widget_Abstract { + + public static function findAllAsArray($id_profil) { + if(!$profil = Class_Profil::find($id_profil)) + return []; + + $all = []; + + $datas = $profil->getCfgMenusAsArray(); + foreach($datas as $key => $params) + $all[$key] = (new static()) + ->setId($key) + ->setProfileId($profil->getId()) + ->find(); + + return $all; + } + + + protected function _load() { + return $this->_transmute($this->find()); + } + + + public function find() { + return $this->init() + ->hasParent() + ? $this->_findLeaf($this->getId()) + : $this->_findNode($this->getId()); + } + + + protected function _findNode($id) { + $datas = $this->getProfile()->getCfgMenusAsArray()[$id]; + $datas['menus'] = (new Class_Systeme_MenuHorizontal($datas['menus']))->asCfgProfil(); + $datas['type_menu'] = 'MENU'; + return $datas; + } + + + protected function _findLeaf($id) { + $profil = $this->getProfile(); + $menus = $profil->getCfgMenusAsArray(); + + $menus = $this->hasParent() + ? $this->_findNode($this->getParent()) + : $menus; + + return $this->_findDeepIn($menus, $id); + } + + + protected function _findDeepIn($entries, $id) { + if(empty($entries)) + return []; + + foreach($entries as $position => $entry) { + if(isset($entry['id_module']) && ((String) $id == (String) $entry['id_module'])) + return $entry; + + if(isset($entry['sous_menus']) && ($found = $this->_findDeepIn($entry['sous_menus'], $id))) { + $this->setPosition($entry['id_module']); + return $found; + } + + if(isset($entries['menus']) && ($found = $this->_findDeepIn($entries['menus'], $id))) + return $found; + + if(isset($entries['sous_menus']) && ($found = $this->_findDeepIn($entries['sous_menus'], $id))) + return $found; + } + + return []; + } + + + protected function _update() { + $datas = array_merge($this->getLocalSettings(), + $this->getNewDatas()); + + if(isset($datas['preferences'])) + unset($datas['preferences']); + + $datas['preferences'] = $datas; + unset($datas['preferences']['menus']); + unset($datas['preferences']['sous_menus']); + + $sub_menus = null; + if(isset($datas['children'])) + $sub_menus = $this->_convertChildren($datas['children']); + + if(!$this->hasParent() && $sub_menus) { + $datas['menus'] = (new Class_Systeme_MenuHorizontal($sub_menus))->asCfgProfil(); + return $this->_save($datas); + } + + if($sub_menus) { + $datas['sous_menus'] = (new Class_Systeme_MenuHorizontal($sub_menus))->asCfgProfil(); + return $this->_save($datas); + } + + return $this->_save($datas); + } + + + protected function _save($datas) { + $profil = $this->getProfile(); + $cfg_menus = $profil->getCfgMenusAsArray(); + + if(!$this->hasParent()) { + $cfg_menus[$this->getId()] = $datas; + return $profil->setCfgMenus($cfg_menus)->save(); + } + + if(!isset($cfg_menus[$this->getParent()])) + return false; + + $cfg_menus[$this->getParent()] = $this->_findNode($this->getParent()); + + if('' == (String) $this->getPosition()) { + $cfg_menus[$this->getParent()]['menus'][$this->getId()] = $datas; + return $profil->setCfgMenus($cfg_menus)->save(); + } + + $cfg_menus[$this->getParent()]['menus'][$this->getPosition()]['sous_menus'][$this->getId()] = $datas; + + return $profil->setCfgMenus($cfg_menus)->save(); + } + + + public function getResourcesProvider() { + if(!parent::getResourcesProvider()) + $this->setResourcesProvider(new Class_Systeme_ModulesMenu()); + + return parent::getResourcesProvider(); + } + + + public function getSuccessSaveMessage() { + if($this->isMenu()) + return $this->_('La configuration du menu %s a été sauvegardée', + $this->getLabel()); + return $this->_('La configuration de l\'entrée de menu %s a été sauvegardée', + $this->getLabel()); + } + + + public function isMenu() { + return $this->_getWidgetResources()->isMenu(); + } + + + public function hasParent() { + return '' != (String) $this->getParent(); + } +} diff --git a/library/Class/Systeme/Widget/Widget.php b/library/Class/Systeme/Widget/Widget.php new file mode 100644 index 0000000000000000000000000000000000000000..a23e325cf6ecd7150c118cb01189a2b198b62753 --- /dev/null +++ b/library/Class/Systeme/Widget/Widget.php @@ -0,0 +1,74 @@ +<?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 Class_Systeme_Widget_Widget extends Class_Systeme_Widget_Abstract { + + protected function _load() { + return $this->_transmute($this->_findLeaf($this->getId())); + } + + + protected function _findLeaf($id) { + $cfg = $this->getProfile()->getCfgAccueilAsArray()['modules']; + return isset($cfg[$id]) ? $cfg[$id] : []; + } + + + protected function _update() { + $datas = array_merge($this->getLocalSettings(), + $this->getNewDatas()); + + if(isset($datas['preferences'])) + unset($datas['preferences']); + + $datas['preferences'] = $datas; + $datas['profile_id'] = $this->getProfileId(); + $datas = $this->_getWidgetResources()->updateHook($datas); + $sub_menus = null; + if(isset($datas['children'])) + $sub_menus = $this->_convertChildren($datas['children']); + + return $this->_save($datas); + } + + + protected function _save($datas) { + $profil = $this->getProfile(); + $cfg = $profil->getCfgAccueilAsArray(); + $cfg['modules'][$this->getId()] = $datas; + return $profil->setCfgAccueil($cfg)->save(); + } + + + public function getResourcesProvider() { + if(!parent::getResourcesProvider()) + $this->setResourcesProvider(new Class_Systeme_ModulesAccueil()); + + return parent::getResourcesProvider(); + } + + + public function getSuccessSaveMessage() { + return $this->_('La configuration de la boite %s a été sauvegardée', + $this->getLabel()); + } +} diff --git a/library/Class/ToutApprendreLink.php b/library/Class/ToutApprendreLink.php index 7fa528a32b937f6e1dfcd50ca0c7d56ae7bd59de..f7dfee40d0a3907004cbed3bc61ae6eaf6bfe2c9 100644 --- a/library/Class/ToutApprendreLink.php +++ b/library/Class/ToutApprendreLink.php @@ -50,8 +50,8 @@ class Class_ToutApprendreLink { public static function staticUrl() { - return Class_Url::assemble(['controller' => 'modules', - 'action' => 'toutapprendre']); + return ['controller' => 'modules', + 'action' => 'toutapprendre']; } diff --git a/library/Class/Users.php b/library/Class/Users.php index 613970a3bb224f6b6278953b3fecaa953e55b93b..1467aff8ce45768374761945828d1481139c2387 100644 --- a/library/Class/Users.php +++ b/library/Class/Users.php @@ -170,6 +170,21 @@ class UsersLoader extends Storm_Model_Loader { } + public function isCurrentUserAllowedToEditProfile($profile_id) { + if(!$profile = Class_Profil::find($profile_id)) + return false; + + if(!$user = $this->getIdentity()) + return false; + + if((!$user->isAdminBib() && !$user->hasRightConfigFront()) + || ($user->isAdminBib() && ($user->getIdSite() !== $profile->getIdSite()))) + return false; + + return true; + } + + /** * @param Class_Article * @return bool diff --git a/library/Class/VodeclicLink.php b/library/Class/VodeclicLink.php index 988dd3a4f8f44a802aa51811a67425bc51527950..91c60f94fd3c74b31aa61d5211c1f8267a955856 100644 --- a/library/Class/VodeclicLink.php +++ b/library/Class/VodeclicLink.php @@ -16,7 +16,7 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class Class_VodeclicLink { @@ -37,8 +37,8 @@ class Class_VodeclicLink { } public static function staticUrl() { - return Class_Url::assemble(['controller' => 'modules', - 'action' => 'vodeclic']); + return ['controller' => 'modules', + 'action' => 'vodeclic']; } diff --git a/library/ZendAfi/Acl/AdminControllerRoles.php b/library/ZendAfi/Acl/AdminControllerRoles.php index c03f1713d544ceaaf89189b045866929cc86e2b6..db6e94487edaaed5441c9b454bea9694c85be459 100644 --- a/library/ZendAfi/Acl/AdminControllerRoles.php +++ b/library/ZendAfi/Acl/AdminControllerRoles.php @@ -62,6 +62,7 @@ class ZendAfi_Acl_AdminControllerRoles extends Zend_Acl { $this->add(new Zend_Acl_Resource('menus')); $this->add(new Zend_Acl_Resource('catalogue')); $this->add(new Zend_Acl_Resource('accueil')); + $this->add(new Zend_Acl_Resource('widget')); $this->add(new Zend_Acl_Resource('redmine')); $this->add(new Zend_Acl_Resource('index')); @@ -116,6 +117,7 @@ class ZendAfi_Acl_AdminControllerRoles extends Zend_Acl { $this->allow('modo_bib','records'); $this->allow('modo_bib','modules'); $this->allow('modo_bib','redmine'); + $this->allow('modo_bib','widget'); $this->allow('modo_bib','users/change-admin-skin'); $this->allow('admin_bib','rss'); diff --git a/library/ZendAfi/Controller/Action.php b/library/ZendAfi/Controller/Action.php index 036bf0e00d3a7b5637c09b4de1b754222fdf7bb3..b02fb2f8d26820b92ad1e4110655212eb2d8f020 100644 --- a/library/ZendAfi/Controller/Action.php +++ b/library/ZendAfi/Controller/Action.php @@ -96,7 +96,7 @@ class ZendAfi_Controller_Action extends Zend_Controller_Action { } - protected function _redirectClose($url, array $options = array()) { + protected function _redirectClose($url, array $options = []) { if (!$this->isPopupRequest()) return $this->_redirect($url, $options); @@ -169,7 +169,6 @@ class ZendAfi_Controller_Action extends Zend_Controller_Action { } - protected function _stayOnPage() { $this->_redirect($this->_request->getServer('HTTP_REFERER')); } diff --git a/library/ZendAfi/Controller/Plugin/Manager/Album.php b/library/ZendAfi/Controller/Plugin/Manager/Album.php index a758f092aeb66a6a56e4ea8badd5af1fdacd7e3d..8f2e3c23c2249c64a791daf424aeab3a82472dd2 100644 --- a/library/ZendAfi/Controller/Plugin/Manager/Album.php +++ b/library/ZendAfi/Controller/Plugin/Manager/Album.php @@ -512,10 +512,10 @@ class ZendAfi_Controller_Plugin_Manager_Album extends ZendAfi_Controller_Plugin_ protected function _getEditUrl($model) { - return Class_Url::absolute(['action' => 'edit_album', - 'id' => $model->getId(), - 'page' => $this->_getParam('page'), - 'title_search' => $this->_getParam('title_search')]); + return array_merge(parent::_getEditUrl($model), + ['action' => 'edit_album', + 'page' => $this->_getParam('page', null), + 'title_search' => $this->_getParam('title_search', null)]); } diff --git a/library/ZendAfi/Controller/Plugin/Manager/Annexe.php b/library/ZendAfi/Controller/Plugin/Manager/Annexe.php index 2a845497d240f496fb645c54df83685e2ffdfc15..47a73019831925645f2246df215c291a97014683 100644 --- a/library/ZendAfi/Controller/Plugin/Manager/Annexe.php +++ b/library/ZendAfi/Controller/Plugin/Manager/Annexe.php @@ -33,5 +33,11 @@ class ZendAfi_Controller_Plugin_Manager_Annexe extends ZendAfi_Controller_Plugin 'anchorOptions' => ['onclick' => sprintf('return confirm(\'%s\')', $this->_('Etes-vous sûr de vouloir supprimer cette annexe ?'))]]]; } + + + protected function _redirectToEdit($model) { + $this->_redirectClose(sprintf('/cosmo/%s/edit/id/%s', + $this->_request->getControllerName(), $model->getId())); + } } ?> \ No newline at end of file diff --git a/library/ZendAfi/Controller/Plugin/Manager/Article.php b/library/ZendAfi/Controller/Plugin/Manager/Article.php index f2b4954a8b2a45b1b44138905db2831fe3660321..559de401a31b9bfd138803c40e4f0ffe086fdba7 100644 --- a/library/ZendAfi/Controller/Plugin/Manager/Article.php +++ b/library/ZendAfi/Controller/Plugin/Manager/Article.php @@ -229,10 +229,10 @@ class ZendAfi_Controller_Plugin_Manager_Article extends ZendAfi_Controller_Plugi protected function _getEditUrl($model) { $this->_request->setParamSources(['_GET']); - $url = parent::_getEditUrl($model) - . (($page = $this->_getParam('page')) ? '/page/'.$page : '') - . (($id_cat = $this->_getParam('id_cat')) ? '/id_cat/'.$id_cat : '') - . (($title_search = $this->_getParam('title_search')) ? '/title_search/' . $title_search : ''); + $url = array_merge(parent::_getEditUrl($model), + ['page' => $this->_getParam('page', null), + 'id_cat' => $this->_getParam('id_cat', null), + 'title_search' => $this->_getParam('title_search', null)]); $this->_request->setParamSources(['_GET', '_POST']); return $url; } diff --git a/library/ZendAfi/Controller/Plugin/Manager/DataProfile.php b/library/ZendAfi/Controller/Plugin/Manager/DataProfile.php index 5dd9ea36309c84bb13116be9d2d981ccdd0ef059..93122b347f3e9a4dd3a5d00846968b49e2df4021 100644 --- a/library/ZendAfi/Controller/Plugin/Manager/DataProfile.php +++ b/library/ZendAfi/Controller/Plugin/Manager/DataProfile.php @@ -76,9 +76,9 @@ class ZendAfi_Controller_Plugin_Manager_DataProfile extends ZendAfi_Controller_P } - protected function _getEditUrl($model) { - return sprintf('/cosmo/%s/edit/id/%s', - $this->_request->getControllerName(), $model->getId()); + protected function _redirectToEdit($model) { + $this->_redirectClose(sprintf('/cosmo/%s/edit/id/%s', + $this->_request->getControllerName(), $model->getId())); } } ?> \ No newline at end of file diff --git a/library/ZendAfi/Controller/Plugin/Manager/Manager.php b/library/ZendAfi/Controller/Plugin/Manager/Manager.php index 890c1b9b6ada86ea549be3c37e103b4b9c11fa92..da4180eb6c7ccfd6758fdc2957d9f72a5ee598db 100644 --- a/library/ZendAfi/Controller/Plugin/Manager/Manager.php +++ b/library/ZendAfi/Controller/Plugin/Manager/Manager.php @@ -165,15 +165,17 @@ class ZendAfi_Controller_Plugin_Manager_Manager extends ZendAfi_Controller_Plugi protected function _getEditUrl($model) { - return sprintf('/%s/%s/edit/id/%s', - $this->_request->getModuleName(), - $this->_request->getControllerName(), - $model->getId()); + return ['module' => 'admin', + 'action' => 'edit', + 'id' => $model->getId()]; } protected function _redirectToEdit($model) { - $this->_redirectClose($this->_getEditUrl($model)); + $url = $this->_view->absoluteUrl($this->_getEditUrl($model)); + return ('1' === $this->_getParam('styles_reload')) + ? $this->_redirect($url) + : $this->_redirectClose($url); } @@ -189,7 +191,7 @@ class ZendAfi_Controller_Plugin_Manager_Manager extends ZendAfi_Controller_Plugi array_merge($this->_getFormValues($model), $this->_request->getParams()), $custom_form ); - $form->setAction($this->_view->url()); + $form->setAction($this->_view->url(['styles_reload' => null])); return $form; } diff --git a/library/ZendAfi/Form.php b/library/ZendAfi/Form.php index da66f1ebe83276a16d1f5aff6eda127e7abe6eac..0b706baa4b1cec544672eec102d70d1a52234657 100644 --- a/library/ZendAfi/Form.php +++ b/library/ZendAfi/Form.php @@ -204,13 +204,73 @@ class ZendAfi_Form extends Zend_Form { } - public function addUniqDisplayGroup($name, $params) { + public function addUniqDisplayGroup($name, $params = []) { return $this->addDisplayGroup($this->getElementsNames(), $name, $params); } + public function addToDisplayGroup($elements, $name) { + if(!$group = $this->getDisplayGroup($name)) + return $this; + + $elements = array_map(function($element) + { + unset($this->_order[$element]); + return $this->getElement($element); + }, $elements); + + $group->addElements($elements); + $this->_order[$name] = $this->_displayGroups[$name]->getOrder(); + $this->_orderUpdated = true; + return $this; + } + + + public function addToSelectionGroup($elements) { + $key = 'selection_group'; + if($group = $this->getDisplayGroup($key)) + return $this->addToDisplayGroup($elements, $key); + + return $this->addDisplayGroup($elements, + $key, + ['legend' => $this->_('Sélection')]); + } + + + public function addToDisplaySettingsGroup($elements) { + $key = 'display_settings_group'; + if($group = $this->getDisplayGroup($key)) + return $this->addToDisplayGroup($elements, $key); + + return $this->addDisplayGroup($elements, + $key, + ['legend' => $this->_('Affichage')]); + } + + + public function addToStyleGroup($elements) { + $key = 'style_group'; + if($group = $this->getDisplayGroup($key)) + return $this->addToDisplayGroup($elements, $key); + + return $this->addDisplayGroup($elements, + $key, + ['legend' => $this->_('Style')]); + } + + + public function addToHeadGroup($elements) { + $key = 'head_group'; + if($group = $this->getDisplayGroup($key)) + return $this->addToDisplayGroup($elements, $key); + + return $this->addDisplayGroup($elements, + $key); + } + + public function beMultipleSelection() { foreach($this->getElements() as $element) { $this->addElement('hidden', diff --git a/library/ZendAfi/Form/Admin/News.php b/library/ZendAfi/Form/Admin/News.php index c44013ad14434cd7d16a56f2226f890de746fb1f..6bc382ef072dbfffd535ce90d6e04b08c168fb45 100644 --- a/library/ZendAfi/Form/Admin/News.php +++ b/library/ZendAfi/Form/Admin/News.php @@ -102,18 +102,22 @@ class ZendAfi_Form_Admin_News extends ZendAfi_Form { ->addElement('select', 'id_lieu', ['label' => $this->_('Lieu'), 'multiOptions' => $this->getLocations(), 'order' => 19]) + ->addElement('checkbox', + 'avis', + ['order' => 30, + 'label' => $this->_('Autoriser les commentaires d\'internautes (Mode blog) ?')]) + ->addElement('ckeditor', 'contenu') ->addElement('ckeditor', 'description') ->addElement('textarea', 'tags', - ['label' => $this->_('Tags ( Entrez la liste des mots-clefs et expressions qui caractérisent votre article séparés par " ; " )'), - 'rows' => 4, - 'cols' => 51]) - ->addElement('checkbox', 'avis', - ['label' => $this->_('Autoriser les commentaires d\'internautes (Mode blog) ?')]) + ['label' => $this->_('Tags séparés par des " ; "'), + 'rows' => 1, + 'cols' => 40]) + ->addElement('checkbox', 'indexation', ['label' => $this->_('Indexer l\'article dans le catalogue ?')]) - ->addDisplayGroup([ - 'titre', + + ->addDisplayGroup(['titre', 'cacher_titre', 'auteur', 'id_cat', @@ -121,7 +125,8 @@ class ZendAfi_Form_Admin_News extends ZendAfi_Form { 'event_range', 'pick_day', 'all_day', - 'id_lieu' ], + 'id_lieu', + 'avis'], 'publication', ['legend' => $this->_('Publication')]) ->addDisplayGroup(['contenu'], @@ -132,12 +137,6 @@ class ZendAfi_Form_Admin_News extends ZendAfi_Form { 'article_for_widget', ['legend' => $this->_('Résumé pour l\'affichage dans les boîtes')]) - ->addDisplayGroup(['tags', - 'avis', - 'indexation'], - 'options', - ['legend' => $this->_('Options')]) - ->addDomainIndexation(); $this->tags->getDecorator('label')->setOption('escape', false); @@ -276,9 +275,14 @@ EOT; protected function addDomainIndexation() { - if (defined('DEVELOPMENT')) - return $this->addElement('domainSelect', 'domaine_ids') - ->addDisplayGroup(['domaine_ids'], 'domains_set', ['legend' => $this->_('Indexation')]); + return $this->addElement('domainSelect', + 'domaine_ids', + ['label' => $this->_('Domaines')]) + ->addDisplayGroup(['tags', + 'indexation', + 'domaine_ids'], + 'domains_set', + ['legend' => $this->_('Indexation')]); return $this; } diff --git a/library/ZendAfi/Form/Configuration/Menu/Album.php b/library/ZendAfi/Form/Configuration/Menu/Album.php new file mode 100644 index 0000000000000000000000000000000000000000..71a16118c86f5e56a140848a7ac00ea23e7d0375 --- /dev/null +++ b/library/ZendAfi/Form/Configuration/Menu/Album.php @@ -0,0 +1,41 @@ +<?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 ZendAfi_Form_Configuration_Menu_Album extends ZendAfi_Form_Configuration_Menu_Entry { + + public function populate($datas) { + $albums = (new Storm_Model_Collection(Class_Album::getItemsOf(0))) + ->injectInto([], function($albums, $album) + { + $albums[$album->getId()] = $album->getLibelle(); + return $albums; + }); + $this + ->addElement('select', + 'album_id', + ['label' => $this->_('Lien vers l\'album'), + 'multiOptions' => $albums]) + + ->addToSelectionGroup(['album_id']); + + return parent::populate($datas); + } +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/Menu/Entry.php b/library/ZendAfi/Form/Configuration/Menu/Entry.php new file mode 100644 index 0000000000000000000000000000000000000000..f6910540291b2f9a4df492edd09e522678bd101b --- /dev/null +++ b/library/ZendAfi/Form/Configuration/Menu/Entry.php @@ -0,0 +1,49 @@ +<?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 ZendAfi_Form_Configuration_Menu_Entry extends ZendAfi_Form { + public function init() { + parent::init(); + + $this + ->addElement('text', + 'libelle', + ['label' => $this->_('Text du lien')]) + ->addElement('IcoPicker', + 'picto', + ['label' => $this->_('Icône du lien')]) + ->addElement('comboProfils', + 'use_profil', + ['label' => $this->_('Utiliser un profil particulier'), + 'empty_option' => true]); + } + + + public function populate($datas) { + $this + ->addToHeadGroup(['libelle', + 'use_profil']) + ->addToStyleGroup(['picto']); + + return parent::populate($datas); + } +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/Menu/LastReviews.php b/library/ZendAfi/Form/Configuration/Menu/LastReviews.php new file mode 100644 index 0000000000000000000000000000000000000000..99cd5c2968a390736804f1f85643eb60c333472b --- /dev/null +++ b/library/ZendAfi/Form/Configuration/Menu/LastReviews.php @@ -0,0 +1,32 @@ +<?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 ZendAfi_Form_Configuration_Menu_LastReviews extends ZendAfi_Form_Configuration_Menu_Entry { + public function init() { + parent::init(); + + $this + ->addElement('text', + 'nb', + ['label' => $this->_('Nombre d\'avis à afficher')]) + ->addToDisplaySettingsGroup(['nb']); + } +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/Menu/LatestNews.php b/library/ZendAfi/Form/Configuration/Menu/LatestNews.php new file mode 100644 index 0000000000000000000000000000000000000000..60308e39c86dd21c591998245968831eb9a005bd --- /dev/null +++ b/library/ZendAfi/Form/Configuration/Menu/LatestNews.php @@ -0,0 +1,33 @@ +<?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 ZendAfi_Form_Configuration_Menu_LatestNews extends ZendAfi_Form_Configuration_Menu_Entry { + + public function init() { + parent::init(); + $this + ->addElement('text', + 'nb', + ['label' => $this->_('Nombre d\'articles à afficher'), + 'value' => 5]) + ->addToDisplaySettingsGroup(['nb']); + } +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/Menu/Link.php b/library/ZendAfi/Form/Configuration/Menu/Link.php new file mode 100644 index 0000000000000000000000000000000000000000..87bf6decdb91e3b7a866afb0399aae9f0bb52230 --- /dev/null +++ b/library/ZendAfi/Form/Configuration/Menu/Link.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 ZendAfi_Form_Configuration_Menu_Link extends ZendAfi_Form_Configuration_Menu_Entry { + + public function init() { + parent::init(); + $this + ->addElement('url', + 'url', + ['placeholder' => 'https://www.bokeh-library-portal.org/', + 'label' => $this->_('Adresse web'), + 'allowEmpty' => false, + 'required' => true]) + ->addElement('select', + 'target', + ['label' => $this->_('Navigation'), + 'multiOptions' => [$this->_('Ouvrir dans un nouvel onglet'), + $this->_('Rester sur le même onglet')]]); + + $this->removeElement('use_profil'); + } + + public function populate($datas) { + parent::populate($datas); + $this->addToHeadGroup(['url']); + $this->addToStyleGroup(['target']); + return $this; + } +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/Login.php b/library/ZendAfi/Form/Configuration/Menu/LinkToProfile.php similarity index 61% rename from library/ZendAfi/Form/Configuration/Login.php rename to library/ZendAfi/Form/Configuration/Menu/LinkToProfile.php index 8ba0c90c7a270798cedb9ad5a30cda5431d029fc..562aaa22a3fd005ae45b1c11ec556ee29b39fdc3 100644 --- a/library/ZendAfi/Form/Configuration/Login.php +++ b/library/ZendAfi/Form/Configuration/Menu/LinkToProfile.php @@ -1,6 +1,6 @@ <?php /** - * Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved. + * 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 @@ -19,21 +19,24 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +class ZendAfi_Form_Configuration_Menu_LinkToProfile extends ZendAfi_Form_Configuration_Menu_Entry { -class ZendAfi_Form_Configuration_Login extends ZendAfi_Form_Configuration_BaseLogin { public function init() { parent::init(); $this - ->setAttrib('id', 'auth_login_conf') - ->addDisplayGroup($this->getElementsNames(), - 'auth_login_fieldset', - ['legend' => '']) + ->addElement('comboProfils', + 'clef_profil', + ['label' => $this->_('Lien vers le profil'), + 'empty_option' => true, + 'value' => 1]) + ->removeElement('use_profil'); + } - ->addElement('submit', 'submit', ['label' => $this->_('Valider'), - 'class' => 'bouton']) - ->addDisplayGroup(['submit'], 'auth_login_submit', ['legend' => '']) - ; + public function populate($datas) { + parent::populate($datas); + $this->addToHeadGroup(['clef_profil']); + return $this; } } \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/Menu/ListOfSites.php b/library/ZendAfi/Form/Configuration/Menu/ListOfSites.php new file mode 100644 index 0000000000000000000000000000000000000000..bd47adf332858ae3a580176494d01b7a643bccc6 --- /dev/null +++ b/library/ZendAfi/Form/Configuration/Menu/ListOfSites.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 ZendAfi_Form_Configuration_Menu_ListOfSites extends ZendAfi_Form_Configuration_Menu_Entry { + + public function populate($datas) { + $this + ->addElement('treeSelect', + 'listOfSites_source', + ['IdItems' => isset($datas['id_items']) ? $datas['id_items'] : '', + 'IdCategories' => isset($datas['id_categorie']) ? $datas['id_categorie'] : '', + 'UrlDataSource' => Class_Url::assemble(['module' => 'admin', + 'controller' => 'bib', + 'action' => 'allitems', + 'type' => 'sito', + 'id_bib' => isset($datas['id_bib']) ? $datas['id_bib'] : ''])]) + + ->addElement('text', + 'nb', + ['value' => 10, + 'label' => $this->_('Nombre de sites à afficher')]); + + $this->addToSelectionGroup(['listOfSites_source']); + $this->addToDisplaySettingsGroup(['nb']); + + return parent::populate($datas); + } +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/Menu/News.php b/library/ZendAfi/Form/Configuration/Menu/News.php new file mode 100644 index 0000000000000000000000000000000000000000..2214e794aa3a986ced6f6ac5ce9a98de570108c8 --- /dev/null +++ b/library/ZendAfi/Form/Configuration/Menu/News.php @@ -0,0 +1,79 @@ +<?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 ZendAfi_Form_Configuration_Menu_News extends ZendAfi_Form_Configuration_Menu_Entry { + + public function init() { + parent::init(); + $this->addElement('radio', + 'display_order', + ['label' => $this->_('Ordre d\'affichage'), + 'multiOptions' => (new Class_Systeme_ModulesAccueil_News())->getDisplayOrders()]) + + ->addElement('text', + 'nb_aff', + ['label' => $this->_('Nombre d\'articles à afficher'), + 'value' => 5]) + + ->addElement('text', + 'nb_analyse', + ['label' => $this->_('Nombre d\'articles à analyser'), + 'value' => 10]) + + ->addElement('select', + 'display_mode', + ['label' => $this->_('Cliquer sur le menu ouvre'), + 'value' => 'Submenu', + 'multiOptions' => ['Submenu' => $this->_('sous-menu'), + 'Summary' => $this->_('sommaire')]]) + + ->addElement('select', + 'summary_content', + ['label' => $this->_('Contenu du sommaire'), + 'value' => 'Summary', + 'multioptions' => ['Summary' => $this->_('résumé'), + 'TitlesOnly' => $this->_('titres seulement'), + 'FullContent' => $this->_('Articles complets')]]); + } + + + public function populate($datas) { + $this + ->addElement('treeSelect', + 'articles_selector', + ['IdItems' => isset($datas['id_items']) ? $datas['id_items'] : '', + 'IdCategories' => isset($datas['id_categorie']) ? $datas['id_categorie'] : '', + 'UrlDataSource' => Class_Url::assemble(['module' => 'admin', + 'controller' => 'bib', + 'action' => 'articles', + 'id_bib' => isset($datas['id_bib']) ? $datas['id_bib'] : ''])]); + + $this + ->addToSelectionGroup(['articles_selector']) + ->addToDisplaySettingsGroup(['display_order', + 'nb_aff', + 'nb_analyse', + 'display_mode', + 'summary_content']); + + return parent::populate($datas); + } +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/Menu/Rss.php b/library/ZendAfi/Form/Configuration/Menu/Rss.php new file mode 100644 index 0000000000000000000000000000000000000000..f22780acc7b0b47e3b3867f45ee84f0bd5413be7 --- /dev/null +++ b/library/ZendAfi/Form/Configuration/Menu/Rss.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 ZendAfi_Form_Configuration_Menu_Rss extends ZendAfi_Form_Configuration_Menu_Entry { + + public function populate($datas) { + $this + ->addElement('treeSelect', + 'feed_source', + ['IdItems' => isset($datas['id_items']) ? $datas['id_items'] : '', + 'IdCategories' => isset($datas['id_categorie']) ? $datas['id_categorie'] : '', + 'UrlDataSource' => Class_Url::assemble(['module' => 'admin', + 'controller' => 'bib', + 'action' => 'allitems', + 'type' => 'rss', + 'id_bib' => isset($datas['id_bib']) ? $datas['id_bib'] : ''])]) + + ->addElement('text', + 'nb', + ['value' => 10, + 'label' => $this->_('Nombre d\'articles à afficher')]) + + ->addToSelectionGroup(['feed_source']) + ->addToDisplaySettingsGroup(['nb']); + + return parent::populate($datas); + } +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/Menu/SearchResult.php b/library/ZendAfi/Form/Configuration/Menu/SearchResult.php new file mode 100644 index 0000000000000000000000000000000000000000..c38c0bf61e1e91fac22bba5cbd461552f6e4fd66 --- /dev/null +++ b/library/ZendAfi/Form/Configuration/Menu/SearchResult.php @@ -0,0 +1,79 @@ +<?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 ZendAfi_Form_Configuration_Menu_SearchResult extends ZendAfi_Form_Configuration_Menu_Entry { + + + public function init() { + parent::init(); + $this + ->addElement('text', + 'titre', + ['label' => $this->_('Titre'), + 'value' => $this->_('Résultat de recherche')]) + + ->addElement('checkbox', + 'aleatoire', + ['label' => $this->_('Tirage aléatoire'), + 'value' => 1]) + + ->addElement('select', + 'tri', + ['label' => $this->_('Tri du résultat par'), + 'value' => 1, + 'multiOptions' => [0 => $this->_('ordre alphabétique'), + 1 => $this->_('date de nouveauté'), + 2 => $this->_('nombre de visualisations')]]) + + ->addElement('text', + 'nb_notices', + ['label' => $this->_('Nombre de documents à afficher'), + 'value' => 10]) + + ->addElement('text', + 'nb_analyse', + ['label' => $this->_('Nombre de documents à analyser'), + 'value' => 50]); + } + + + public function populate($datas) { + $this + ->addElement('treeSelect', + 'data_source', + ['UrlDataSource' => Class_Url::assemble(['module' => 'admin', + 'controller' => 'catalogue', + 'action' => 'domaines-paniers']).'.json', + 'MultipleSelection' => false, + 'InputIdCategoriesName' => 'id_catalogue', + 'InputIdItemsName' => 'id_panier', + 'IdItems' => isset($datas['id_panier']) ? $datas['id_panier'] : '', + 'IdCategories' => isset($datas['id_catalogue']) ? $datas['id_catalogue'] : '']) + ->addToSelectionGroup(['data_source']) + ->addToDisplaySettingsGroup(['titre', + 'aleatoire', + 'tri', + 'nb_notices', + 'nb_analyse']); + + return parent::populate($datas); + } +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/NavWidget.php b/library/ZendAfi/Form/Configuration/NavWidget.php new file mode 100644 index 0000000000000000000000000000000000000000..d25b8b1677bdc74f4884b8d493b08887df547ca1 --- /dev/null +++ b/library/ZendAfi/Form/Configuration/NavWidget.php @@ -0,0 +1,58 @@ +<?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 ZendAfi_Form_Configuration_NavWidget extends ZendAfi_Form { + public function init() { + parent::init(); + + $this + ->addElement('text', + 'libelle', + ['label' => $this->_('Nom du menu')]) + + ->addElement('IcoPicker', + 'picto', + ['label' => $this->_('Icône')]) + + ->addElement('DragAndDrop', + 'children', + ['label' => $this->_('Eléments du menu')]); + } + + + public function populate($datas) { + $this->addToHeadGroup(['libelle']) + ->addToSelectionGroup(['children']) + ->addToStyleGroup(['picto']); + parent::populate($datas); + $this->getElement('children') + ->setValue((new Class_Entity()) + ->setId('children') + ->setOptions(['sticky_available' => true]) + ->setSelectedHeader($this->_('Sélectionnés')) + ->setSelected(isset($datas['Children']) ? $datas['Children'] : []) + ->setAvailableHeader($this->_('Disponibles')) + ->setAvailable((new Class_Systeme_ModulesMenu())->getEntries())); + return $this; + } +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/Record.php b/library/ZendAfi/Form/Configuration/Record.php new file mode 100644 index 0000000000000000000000000000000000000000..0a8cf85effcfe79506616a11e73f5c5995f9a0e1 --- /dev/null +++ b/library/ZendAfi/Form/Configuration/Record.php @@ -0,0 +1,105 @@ +<?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 ZendAfi_Form_Configuration_Record extends ZendAfi_Form { + + public function init() { + parent::init(); + $this + ->addElement('recordTabs', + 'record_tabs', + ['label' => $this->_('Composition de l\'affichage')]) + ->addElement('codeList', + 'champs', + ['label' => $this->_('Champs à afficher'), + 'field' => 'champs', + 'values' => '', + 'required' => true, + 'validators' => [['name' => 'notEmpty', + 'value' => false, + 'options' => [ 'messages' => $this->_('Indiquez au moins 1 champ à afficher pour la liste')]]]]) + + ->addElement('unimarc', + 'links_zones', + ['label' => $this->_('Zones de liens')]) + + ->addElement('unimarc', + 'thumbnail_fields', + ['label' => $this->_('Zones de vignette'), + 'validators' => [['name' => 'unimarc']]]) + + ->addElement('text', + 'analytics', + ['label' => $this->_('Zone de dépouillements')]) + ->addElement('text', + 'analytics_title', + ['label' => $this->_('Sous-zone de titre')]) + ->addElement('text', + 'analytics_authors', + ['label' => $this->_('Sous-zones d\'auteurs<br>(séparées par des ";")')]) + + ->addElement('select', + 'boite', + ['label' => $this->_('Style de la boite'), + 'multiOptions' => (new Class_Profil_Templates(Class_Profil::getCurrentProfil()))->toArray()]) + + ; + } + + + public function populate($datas) { + $this->getElement('record_tabs') + ->setSettings($datas['onglets']); + + $this->getElement('champs') + ->setValues($datas['entete']); + + $this->getElement('links_zones') + ->setSettings($datas) + ->setMessages($datas['links_zones_errors']); + + $this->getElement('thumbnail_fields') + ->setSettings($datas) + ->setMessages($datas['thumbnail_fields_errors']); + + $this + ->addDisplayGroup(['champs'], + 'head_group', + ['legend' => $this->_('Entête')]) + ->addDisplayGroup(['record_tabs'], + 'record_display_group', + ['legend' => $this->_('Affichage')]) + ->addDisplayGroup(['links_zones'], + 'unimarc_link_zones', + ['legend' => $this->_('Zones de liens')]) + ->addDisplayGroup(['thumbnail_fields'], + 'unimarc_thumbnails_zones', + ['legend' => $this->_('Zones de vignette')]) + ->addDisplayGroup(['analytics', + 'analytics_title', + 'analytics_authors'], + 'unimarc_zone_group', + ['legend' => $this->_('Dépouillements')]) + ->addToStyleGroup(['boite']); + return parent::populate($datas); + } +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/SearchResult.php b/library/ZendAfi/Form/Configuration/SearchResult.php index fc5b67962745d30f958d36bfa9904ac0d9526b95..ff4e64900e4d108e554204d1012fdb3beafbe0d1 100644 --- a/library/ZendAfi/Form/Configuration/SearchResult.php +++ b/library/ZendAfi/Form/Configuration/SearchResult.php @@ -41,20 +41,13 @@ class ZendAfi_Form_Configuration_SearchResult extends ZendAfi_Form { ->addValueTo('header_composition', (new Class_Profil_Preferences_SearchResult())->getHeaderComposition(Class_Profil::getCurrentProfil())) - ->addDisplayGroup(['titre', - 'boite', - 'search_term_editable', - 'suggestion_achat', - 'header_composition'], - 'Generalites', - ['legend' => $form->_('Généralités')]) - - ->addDisplayGroup(['liste_format', - 'liste_nb_par_page', - 'liste_codes', - 'zones_titre'], - 'liste', - ['legend' => $form->_('Liste')]) + ->addToDisplaySettingsGroup(['liste_format', + 'liste_nb_par_page', + 'liste_codes', + 'zones_titre', + 'suggests_enabled', + 'suggests_number', + 'bookmarks_enabled']) ->addDisplayGroup(['facettes_actif', 'multi_facettes', @@ -73,16 +66,12 @@ class ZendAfi_Form_Configuration_SearchResult extends ZendAfi_Form { 'tags', ['legend' => $form->_('Nuage de tags')]) - ->addDisplayGroup(['suggests_enabled', - 'suggests_number'], - 'suggests', - ['legend' => $form->_('Suggestions')]) - - ->addDisplayGroup(['bookmarks_enabled'], - 'bookmarks', - ['legend' => $form->_('Favoris utilisateur')]) - - ->addCvsGroup(); + ->addCvsGroup() + ->addToStyleGroup(['titre', + 'boite', + 'search_term_editable', + 'suggestion_achat', + 'header_composition']); return $form; } diff --git a/library/ZendAfi/Form/Configuration/Widget/Add.php b/library/ZendAfi/Form/Configuration/Widget/Add.php new file mode 100644 index 0000000000000000000000000000000000000000..f56116b4001ae4c8ba3b400d59cc4f7d1bc8a9b8 --- /dev/null +++ b/library/ZendAfi/Form/Configuration/Widget/Add.php @@ -0,0 +1,38 @@ +<?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 ZendAfi_Form_Configuration_Widget_Add extends ZendAfi_Form_Configuration_Widget_Base { + public function init() { + parent::init(); + + $widgets = Class_Systeme_ModulesAccueil::getWidgets(); + + $this->addElement('select', + 'module_type', + ['label' => $this->_('Type de boite à ajouter'), + 'required' => true, + 'registerInArrayValidator' => false, + 'multiOptions' => array_merge(['' => $this->_('Veuillez sélectionner une boite')], + $widgets)]) + ->addToSelectionGroup(['module_type']); + } +} diff --git a/library/ZendAfi/Form/Configuration/Widget/Albums.php b/library/ZendAfi/Form/Configuration/Widget/Albums.php new file mode 100644 index 0000000000000000000000000000000000000000..f2b4490ac8f70bf47352d22f6107568cfbf4d872 --- /dev/null +++ b/library/ZendAfi/Form/Configuration/Widget/Albums.php @@ -0,0 +1,154 @@ +<?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 ZendAfi_Form_Configuration_Widget_Albums extends ZendAfi_Form_Configuration_Widget_Base { + + public function init() { + parent::init(); + + Class_ScriptLoader::getInstance()->addJQueryReady($this->_getChangeDisplayScript()); + + $module = (new Class_Systeme_ModulesAccueil())->getModuleByCode('BIB_NUMERIQUE'); + + $this + ->setAttrib('id', 'configuration_bibnumerique') + + ->addElement('select', + 'type_aff', + ['label' => $this->_('Type d\'affichage'), + 'multiOptions' => $module->getDisplayModes()]) + + ->addElement('select', + 'id_categories', + ['label' => $this->_('Collection'), + 'multiOptions' => $this->_getCollections()]) + + ->addElement('select', + 'id_albums', + ['label' => $this->_('Album'), + 'multiOptions' => $this->_getAlbums()]) + + ->addElement('imagesViewer', + 'style_liste', + ['label' => $this->_('Style de représentation'), + 'preferences' => '']) + + ->addElement('text', + 'nb_aff', + ['label' => $this->_('Nb d\'images à afficher'), + 'size' => '4']) + + ->addElement('albumsCategoriesSelector', + 'id_categorie', + ['label' => $this->_('Choisissez les dossiers à afficher'), + 'selected_categories' => '']) + + ->addElement('radio', + 'display_order', + ['label' => $this->_('Ordre d\'affichage'), + 'multiOptions' => $module->getOrderModes()]) + + ->addElement('text', + 'nb_aff_by_page', + ['label' => $this->_('Nbre de sites par page'), + 'size' => '3', + 'maxlenght' => '3']); + } + + + public function populate($datas) { + $selected_categories = array_key_exists('id_categorie', $datas) ? $datas['id_categorie'] : ''; + + $this + ->populateAlbumsCategories('id_categorie', $selected_categories) + ->populateImageViewer('style_liste', $datas) + + ->addToDisplaySettingsGroup(['type_aff', + 'id_categories', + 'id_albums', + 'style_liste', + 'nb_aff', + 'id_categorie', + 'display_order', + 'nb_aff_by_page']); + + return parent::populate($datas); + } + + + public function populateAlbumsCategories($element, $selected_categories) { + $this->$element->setSelectedCategories($selected_categories); + return $this; + } + + + public function populateImageViewer($element, $preferences) { + $this->$element->setPreferences($preferences); + return $this; + } + + + protected function _getChangeDisplayScript() { + return + "$('select[name=\"type_aff\"]').change(function (event) { + if ($('select[name=\"type_aff\"]').val() == 'displayTree') + displayOnly($('#id_categories')); + + if ($('select[name=\"type_aff\"]').val() == 'displayAlbumTeaser') + displayOnly($('#id_albums, #nb_aff, [name=\"style_liste\"]')); + + if ($('select[name=\"type_aff\"]').val() == 'displayPaginated') + displayOnly($('#id_categorie, [name=\"display_order\"], #nb_aff_by_page')); + }); + + function displayOnly(selector) { + $('#fieldset-display tr').not(':first').hide(); + selector.closest('tr').show(); + } + + $('select[name=\"type_aff\"]').change();"; + } + + + protected function _getCollections() { + $collections = ['' => 'Toutes les collections']; + + foreach (Class_AlbumCategorie::getLoader()->getCollections() as $categorie) + $collections[$categorie->getId()] = $categorie->getLibelle(); + + return $collections; + } + + + protected function _getAlbums() { + $albums = []; + + foreach (Class_AlbumCategorie::getLoader()->findAlbumsRecursively() as $album) { + $hierarchy = array_reverse($album->getHierarchy()); + $parents = []; + foreach ($hierarchy as $parent) + $parents[] = $parent->getLibelle(); + $albums[$album->getId()] = implode(' > ', $parents) . ' > ' . $album->getTitre(); + } + + return $albums; + } +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/ArticleWidget.php b/library/ZendAfi/Form/Configuration/Widget/Articles.php similarity index 50% rename from library/ZendAfi/Form/Configuration/ArticleWidget.php rename to library/ZendAfi/Form/Configuration/Widget/Articles.php index 9ec116bc1ec13863bad7bfe579e93297325c950d..64e329955f59e40d0d3e550f11fe2d9130e2c4c4 100644 --- a/library/ZendAfi/Form/Configuration/ArticleWidget.php +++ b/library/ZendAfi/Form/Configuration/Widget/Articles.php @@ -19,9 +19,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +class ZendAfi_Form_Configuration_Widget_Articles extends ZendAfi_Form_Configuration_Widget_Base { - -class ZendAfi_Form_Configuration_ArticleWidget extends ZendAfi_Form { public function init() { Class_ScriptLoader::getInstance() ->addJQueryReady( @@ -35,49 +34,19 @@ class ZendAfi_Form_Configuration_ArticleWidget extends ZendAfi_Form { parent::init(); $this - ->setAttrib('id', - 'configuration_articleBrowser') - - ->setMethod('post') - - ->addElement('select', - 'boite', - ['label' => $this->_('Style de boite'), - 'multiOptions' => ( - new Class_Profil_Templates( - Class_Profil::getCurrentProfil()))->toArray()]) - - ->addElement('text', - 'titre', - ['label' => $this->_('Titre'), - 'size' => $this->_text_size]) - ->addElement('url', 'anchor', ['label' => $this->_('Personnaliser le lien du titre'), 'size' => $this->_text_size]) - ->addElement('checkbox', - 'rss_avis', - ['label' => $this->_('Proposer un fil RSS')]) - ->addElement('checkbox', 'allow_link_on_title', ['label' => $this->_('Rendre le titre de la boite cliquable')]) - ->addElement('treeSelect', - 'articles_selector', - ['IdItems' => $this->_attribs['id_items'], - 'IdCategories' => $this->_attribs['id_categorie'], - 'UrlDataSource' => Class_Url::assemble(['module' => 'admin', - 'controller' => 'bib', - 'action' => 'articles', - 'id_bib' => $this->_attribs['id_bib']])]) - ->addElement('radio', - 'display_order', - ['label' => $this->_('Ordre d\'affichage'), - 'multiOptions' => (new Class_Systeme_ModulesAccueil_News())->getDisplayOrders()]) + 'display_order', + ['label' => $this->_('Ordre d\'affichage'), + 'multiOptions' => (new Class_Systeme_ModulesAccueil_News())->getDisplayOrders()]) ->addElement('text', 'nb_aff', @@ -95,34 +64,34 @@ class ZendAfi_Form_Configuration_ArticleWidget extends ZendAfi_Form { ->addElement('imagesViewer', 'style_liste', - ['label' => $this->_('Style de représentation')]) + ['label' => $this->_('Style de représentation')]); + } - ->addDisplayGroup(['titre', - 'rss_avis'], - 'general', - ['legend' => $this->_('Généralités')]) - ->addDisplayGroup(['articles_selector'], - 'articles', - ['legend' => $this->_('Articles à afficher')]) + public function populate($datas) { + $this->getElement('style_liste') + ->setPreferences($datas); + $this->addElement('treeSelect', + 'articles_selector', + ['IdItems' => isset($datas['id_items']) ? $datas['id_items'] : '', + 'IdCategories' => isset($datas['id_categorie']) ? $datas['id_categorie'] : '', + 'UrlDataSource' => Class_Url::assemble(['module' => 'admin', + 'controller' => 'bib', + 'action' => 'articles', + 'id_bib' => isset($datas['id_bib']) ? $datas['id_bib'] : ''])]) - ->addDisplayGroup(['display_order', 'nb_aff', 'nb_analyse'], - 'datas', - ['legend' => $this->_('Mode sélection')]) + ->addToSelectionGroup(['articles_selector']) - ->addDisplayGroup(['boite', - 'display_titles_only', - 'allow_link_on_title', - 'anchor', - 'style_liste'], - 'affichage', - ['legend' => $this->_('Style de boite')]); - } + ->addToDisplaySettingsGroup(['display_order', + 'nb_aff', + 'nb_analyse']); + + parent::populate($datas); + return $this->addToStyleGroup(['display_titles_only', + 'allow_link_on_title', + 'anchor']); - public function populate($values) { - $this->getElement('style_liste')->setPreferences($values); - return parent::populate($values); } } \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/Widget/Base.php b/library/ZendAfi/Form/Configuration/Widget/Base.php new file mode 100644 index 0000000000000000000000000000000000000000..42ea2b41da2a0e4c4867d589a395063edd752f3a --- /dev/null +++ b/library/ZendAfi/Form/Configuration/Widget/Base.php @@ -0,0 +1,56 @@ +<?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 ZendAfi_Form_Configuration_Widget_Base extends ZendAfi_Form { + + public function init() { + parent::init(); + + $this + ->addElement('text', + 'titre', + ['label' => $this->_('Titre de la boite'), + 'placeholder' => $this->_('Titre de la boite')]) + + ->addElement('select', + 'boite', + ['label' => $this->_('Style de la boite'), + 'multiOptions' => (new Class_Profil_Templates(Class_Profil::getCurrentProfil()))->toArray()]) + + ->addElement('checkbox', + 'rss_avis', + ['label' => $this->_('Proposer un fil RSS'), + 'value' => 0]); + } + + + public function populate($datas) { + $this + ->addToHeadGroup(['titre', + 'style_liste']) + + ->addToStyleGroup(['boite', + 'rss_avis']); + + return parent::populate($datas); + } +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/Widget/Calendar.php b/library/ZendAfi/Form/Configuration/Widget/Calendar.php new file mode 100644 index 0000000000000000000000000000000000000000..c3d935ecece3fe289645eed56196f0ec526a2e3c --- /dev/null +++ b/library/ZendAfi/Form/Configuration/Widget/Calendar.php @@ -0,0 +1,131 @@ +<?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 ZendAfi_Form_Configuration_Widget_Calendar extends ZendAfi_Form_Configuration_Widget_Base { + + public function init() { + Class_ScriptLoader::getInstance() + ->addJQueryReady('formSelectToggleVisibilityForElement("#mode-affichage", $("#display_event_info").closest("tr"), ["simple"]);'); + + parent::init(); + + $this + ->addElement('text', + 'nb_events', + ['label' => $this->_('Nombre d\'événements à afficher'), + 'size' => 2]) + + ->addElement('select', + 'display_calendar', + ['label' => $this->_('Afficher le calendrier'), + 'multiOptions' => [0 => $this->_('non'), + 1 => $this->_('tableau'), + 2 => $this->_('liste des mois')]]) + + ->addElement('DisplayMode', + 'mode-affichage', + ['label' => $this->_('Mode d\'affichage des événements')]) + + ->addElement('select', + 'event_filter', + ['label' => $this->_('Filtrer les évènements'), + 'multiOptions' => ['none' => $this->_('non'), + 'month' => $this->_('par mois')]]) + + ->addElement('select', + 'display_event_info', + ['label' => $this->_('Mode d\'affichage des titres'), + 'multiOptions' => ['bib' => $this->_('Nom de la bibliothèque'), + 'cat' => $this->_('Catégorie de l\'article'), + 'none' => $this->_('Titre seulement')]]) + + ->addElement('checkbox', + 'display_full_page', + ['label' => $this->_('Activer la redirection vers la liste d\'articles')]) + + ->addElement('radio', + 'display_mode', + ['label' => $this->_('Afficher'), + 'multiOptions' => ['Title' => $this->_('date et titre seulement'), + 'Summary' => $this->_('date et résumé de l\'article'), + 'FullArticle' => $this->_('date et article')]]) + + ->addElement('radio', + 'display_order', + ['label' => $this->_('Ordre'), + 'multiOptions' => ['EventDebut' => $this->_('par date de début d\'événement (plus ancien en premier)'), + 'DebutPublicationDesc' => $this->_('par date de début de publication (plus récent en premier)'), + 'DateCreationDesc' => $this->_('par date de création (plus récent en premier)')]]) + + ->addElement('sortableConnectLists', + 'enabled_filters', + ['label' => $this->_('Affichage des filtres'), + 'multiOptions' => (new Class_Systeme_ModulesAccueil_Calendrier())->getAvailableFilters(), + 'displayInline' => true, + 'selectedLabel' => $this->_('Filtres activés'), + 'availableLabel' => $this->_('Filtres disponibles')]) + + ->addElement('checkbox', + 'display_cat_select', + ['label' => $this->_('Afficher sélection')]); + } + + + public function populate($datas) { + $this->getElement('mode-affichage') + ->setSettings($datas) + ->setMultiOptions(['simple' => $this->_('mode liste simple'), + 'article' => $this->_('mode résumé d\'article'), + 'wall' => $this->_('mode mur'), + 'diaporama_navigation' => $this->_('Diaporama avec navigation'), + 'none' => $this->_('Ne pas afficher')]); + + $this->addElement('treeSelect', + 'data_source', + ['UrlDataSource' => Class_Url::assemble(['module' => 'admin', + 'controller' => 'bib', + 'action' => 'articles', + 'id_bib' => isset($datas['id_bib']) ? $datas['id_bib'] : '', + 'categories_only' => 1]), + 'InputIdCategoriesName' => 'id_categorie', + 'IdItems' => '', + 'IdCategories' => isset($datas['id_categorie']) ? $datas['id_categorie'] : '']); + + $this + ->addToSelectionGroup(['data_source']) + + ->addToDisplaySettingsGroup(['display_cat_select', + 'nb_events', + 'display_calendar', + 'mode-affichage', + 'display_event_info', + 'event_filter', + 'enabled_filters']) + + ->addDisplayGroup(['display_full_page', + 'display_mode', + 'display_order'], + 'page_display_settings', + ['legend' => $this->_('Affichage en pleine page')]); + + return parent::populate($datas); + } +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/Widget/Carousel.php b/library/ZendAfi/Form/Configuration/Widget/Carousel.php new file mode 100644 index 0000000000000000000000000000000000000000..eea603567186568ed73871badac8661cb815ef0d --- /dev/null +++ b/library/ZendAfi/Form/Configuration/Widget/Carousel.php @@ -0,0 +1,100 @@ +<?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 ZendAfi_Form_Configuration_Widget_Carousel extends ZendAfi_Form_Configuration_Widget_Base { + + public function populate($datas) { + $this->getElement('style_liste') + ->setSettings($datas) + ->setMultiOptions(Class_Systeme_ModulesAccueil::moduleByCode('KIOSQUE')->getStylesListes()); + + $this->addElement('treeSelect', + 'data_source', + ['UrlDataSource' => Class_Url::assemble(['module' => 'admin', + 'controller' => 'catalogue', + 'action' => 'domaines-paniers']).'.json', + 'MultipleSelection' => false, + 'InputIdCategoriesName' => 'id_catalogue', + 'InputIdItemsName' => 'id_panier', + 'IdItems' => isset($datas['id_panier']) ? $datas['id_panier'] : '', + 'IdCategories' => isset($datas['id_catalogue']) ? $datas['id_catalogue'] : '']) + + ->addToSelectionGroup(['data_source']) + ->addToDisplaySettingsGroup(['aleatoire', + 'tri', + 'nb_notices', + 'nb_analyse', + 'only_img']); + + parent::populate($datas); + + return $this->addToHeadGroup(['profil_redirect']); + } + + + public function init() { + Class_ScriptLoader::getInstance() + ->addJqueryReady('formSelectToggleVisibilityForElement("#aleatoire", $("#nb_analyse").closest("tr"), "1")'); + + parent::init(); + + $this + ->addElement('TagObjetsImgProperties', + 'style_liste', + ['label' => $this->_('Style de représentation')]) + + ->addElement('comboProfils', + 'profil_redirect', + ['label' => $this->_('Basculer automatiquement sur le profil'), + 'empty_option' => true]) + + ->addElement('select', + 'aleatoire', + ['label' => $this->_('Tirage aléatoire'), + 'multiOptions' => [0 => $this->_('non'), + 1 => $this->_('oui')]]) + ->addElement('select', + 'tri', + ['label' => $this->_('Tri du résultat'), + 'multiOptions' => ['0' => $this->_('par ordre alphabétique'), + '1' => $this->_('par date de nouveauté'), + '2' => $this->_('par nombre de visualisations'), + '3' => $this->_('par date de publication'), + '4' => $this->_('par l\'ordre du panier')]]) + ->addElement('text', + 'nb_notices', + ['label' => $this->_('Nombre de documents à afficher'), + 'size' => 2]) + + ->addElement('text', + 'nb_analyse', + ['label' => $this->_('Nombre de documents les plus récents à analyser'), + 'size' => 2]) + + ->addElement('select', + 'only_img', + ['label' => $this->_('Vignettes'), + 'multiOptions' => [0 => $this->_('Afficher le titre dans une image'), + 1 => $this->_('Afficher uniquement les documents avec une vignette')]]) + ; + } +} +?> \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/DomainWidget.php b/library/ZendAfi/Form/Configuration/Widget/Domains.php similarity index 56% rename from library/ZendAfi/Form/Configuration/DomainWidget.php rename to library/ZendAfi/Form/Configuration/Widget/Domains.php index f301cdca0806480ab7da3d79ae97b42ff68dd5b5..15cca0e2584ee1e0343183954ad846c81e638221 100644 --- a/library/ZendAfi/Form/Configuration/DomainWidget.php +++ b/library/ZendAfi/Form/Configuration/Widget/Domains.php @@ -19,41 +19,11 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class ZendAfi_Form_Configuration_DomainWidget extends ZendAfi_Form { - - public static function newWith($datas = [], $custom_form = null) { - $form = parent::newWith($datas, $custom_form); - $form - ->addDisplayGroup(['titre', - 'boite', - 'display_mode'], - 'Base', - ['legend' => $form->_('Généralités')]) - ->addDisplayGroup(['root_domain_id'], - 'advanced', - ['legend' => '']) - ->addDisplayGroup(['submit'], - 'submit', - ['legend' => '']); - return $form; - } - +class ZendAfi_Form_Configuration_Widget_Domains extends ZendAfi_Form_Configuration_Widget_Base { public function init() { parent::init(); $this - ->setAttrib('id', - 'configuration_domainBrowser') - ->addElement('text', - 'titre', - ['label' => $this->_('Titre'), - 'size' => $this->_text_size]) - ->addElement('select', - 'boite', - ['label' => $this->_('Style de boite'), - 'multiOptions' => ( - new Class_Profil_Templates( - Class_Profil::getCurrentProfil()))->toArray()]) ->addElement('domainSelect', 'root_domain_id', ['label' => $this->_('Choisissez le domaine de départ. Les domaines sélectionnables sont ceux qui ont des sous-domaines.'), @@ -67,9 +37,8 @@ class ZendAfi_Form_Configuration_DomainWidget extends ZendAfi_Form { ['label' => $this->_('Format'), 'multiOptions' => Class_Systeme_ModulesAppli::getAvailableListeDomainsFormat()]) - ->addElement('submit', - 'submit', - ['label' => $this->_('Valider')]); + ->addToSelectionGroup(['root_domain_id']) + + ->addToDisplaySettingsGroup(['display_mode']); } -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/FormationsWidget.php b/library/ZendAfi/Form/Configuration/Widget/Formations.php similarity index 62% rename from library/ZendAfi/Form/Configuration/FormationsWidget.php rename to library/ZendAfi/Form/Configuration/Widget/Formations.php index 82661689736ce715a53852b20615e06061605134..985be22fdb311dd381248e54a33fdd5a6a759d06 100644 --- a/library/ZendAfi/Form/Configuration/FormationsWidget.php +++ b/library/ZendAfi/Form/Configuration/Widget/Formations.php @@ -19,55 +19,30 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +class ZendAfi_Form_Configuration_Widget_Formations extends ZendAfi_Form_Configuration_Widget_Base { -class ZendAfi_Form_Configuration_FormationsWidget extends ZendAfi_Form { - public static function newWith($module_settings = [], $custom_form = null) { - $form = new self(); + public function populate($datas) { + $this + ->addElement('formationsSelector', + 'formations_selector', + ['label' => $this->_('Choisissez les formations à afficher'), + 'selected_formations'=> isset($datas['selected_formations']) ? $datas['selected_formations'] : '', + 'categories_selectable' => false]) - $selected_formations = array_key_exists('selected_formations', $module_settings) ? $module_settings['selected_formations'] : ''; + ->addToSelectionGroup(['formations_selector']) - $form - ->populate($module_settings) - ->addToWith('formations_selector', $selected_formations) - ->addDisplayGroup(['titre', - 'boite'], - 'Base', - ['legend' => $form->_('Généralités')]) + ->addToDisplaySettingsGroup(['display_number', + 'display_order', + 'display_group_mode', + 'display_mode']); - ->addDisplayGroup(['formations_selector', - 'display_number', - 'display_order', - 'display_group_mode', - 'display_mode'], - 'advanced', - ['legend' => '']); - return $form; + return parent::populate($datas); } public function init() { parent::init(); $this - ->setAttrib('id', - 'configuration_formationsWidget') - ->addElement('text', - 'titre', - ['label' => $this->_('Titre'), - 'size' => $this->_text_size]) - - ->addElement('select', - 'boite', - ['label' => $this->_('Style de boite'), - 'multiOptions' => ( - new Class_Profil_Templates( - Class_Profil::getCurrentProfil()))->toArray()]) - - ->addElement('formationsSelector', - 'formations_selector', - ['label' => $this->_('Choisissez les formations à afficher'), - 'selected_formations'=> '', - 'categories_selectable' => false]) - ->addElement('text', 'display_number', ['label' => $this->_('Nombre à afficher')]) @@ -91,11 +66,4 @@ class ZendAfi_Form_Configuration_FormationsWidget extends ZendAfi_Form { Class_Systeme_ModulesAccueil_Formations::DISPLAY_GROUP_BY_YEAR =>$this->_('groupé par année') ]]); } - - - public function addToWith($element, $selected_formations) { - $this->$element->setSelectedFormations($selected_formations); - return $this; - } -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/LibraryWidget.php b/library/ZendAfi/Form/Configuration/Widget/Libraries.php similarity index 56% rename from library/ZendAfi/Form/Configuration/LibraryWidget.php rename to library/ZendAfi/Form/Configuration/Widget/Libraries.php index 2e5ddea16cf4cc8152c0abe14c75b247964994fc..4b101cbbda04ae063cb954b26126505f6af05656 100644 --- a/library/ZendAfi/Form/Configuration/LibraryWidget.php +++ b/library/ZendAfi/Form/Configuration/Widget/Libraries.php @@ -19,46 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class ZendAfi_Form_Configuration_LibraryWidget extends ZendAfi_Form { - - public static function newWith($datas = [], $custom_form = null) { - $form = parent::newWith($datas, $custom_form); - - $form - ->addDisplayGroup(['titre', - 'boite'], - 'base', - ['legend' => $form->_('Généralités')]) - - ->addDisplayGroup(['libraries', - 'order', - 'pagination', - 'nb_aff'], - 'bibs_display', - ['legend' => $form->_('Affichage des bibliothèques')]) - - ->addDisplayGroup(['fields', - 'linked'], - 'fields_display', - ['legend' => $form->_('Affichage des champs')]) - - ->addDisplayGroup(['filters', - 'filters_display_modes', - 'filters_position'], - 'filters_display', - ['legend' => $form->_('Affichage des filtres')]) - - ->addDisplayGroup(['osm_map'], - 'map', - ['legend' => $form->_('Affichage de la carte')]) - - ->addDisplayGroup(['submit'], - 'submit', - ['legend' => '']); - return $form; - } - - +class ZendAfi_Form_Configuration_Widget_Libraries extends ZendAfi_Form_Configuration_Widget_Base { public function init() { parent::init(); @@ -66,36 +27,22 @@ class ZendAfi_Form_Configuration_LibraryWidget extends ZendAfi_Form { $module = (new Class_Systeme_ModulesAccueil())->getModuleByCode('LIBRARY'); $this - ->setAttrib('id', 'configuration_library') - - ->addElement('text', - 'titre', - ['label' => $this->_('Titre'), - 'size' => $this->_text_size]) - - ->addElement('select', - 'boite', - ['label' => $this->_('Style de boite'), - 'multiOptions' => ( - new Class_Profil_Templates( - Class_Profil::getCurrentProfil()))->toArray()]) - ->addElement('sortableConnectLists', 'libraries', - ['label' => $this->_('Bibliothèque à afficher'), + ['label' => $this->_('Bibliothèques à afficher'), 'multiOptions' => Class_Bib::findAllLabels(), 'selectedLabel' => $this->_('Bibliothèques affichées'), 'availableLabel' => $this->_('Bibliothèques disponibles')]) ->addElement('text', 'nb_aff', - ['label' => $this->_('Nombres par page'), + ['label' => $this->_('Nombres de biliothèques par page'), 'size' => '3', 'maxlenght' => '3']) ->addElement('select', 'order', - ['label' => $this->_('Ordre d\'affichage'), + ['label' => $this->_('Ordre d\'affichage des biliothèques'), 'multiOptions' => $module->getOrderModes()]) ->addElement('select', @@ -106,20 +53,22 @@ class ZendAfi_Form_Configuration_LibraryWidget extends ZendAfi_Form { ->addElement('sortableConnectLists', 'fields', ['label' => $this->_('Champs à afficher'), + 'displayInline' => true, 'multiOptions' => $module->getFieldModes(), 'selectedLabel' => $this->_('Champs affichées'), 'availableLabel' => $this->_('Champs disponibles')]) ->addElement('sortableConnectLists', 'filters', - ['label' => '', + ['label' => $this->_('Filtres à afficher'), + 'displayInline' => true, 'multiOptions' => $module->getAvailableFilters(), 'selectedLabel' => $this->_('Filtres affichées'), 'availableLabel' => $this->_('Filtres disponibles')]) ->addElement('select', 'filters_display_modes', - ['label' => $this->_('Style d\'affichage'), + ['label' => $this->_('Style d\'affichage des filtres'), 'multiOptions' => ($module->getFiltersDisplayModes())]) ->addElement('select', @@ -133,11 +82,25 @@ class ZendAfi_Form_Configuration_LibraryWidget extends ZendAfi_Form { ->addElement('checkbox', 'osm_map', - ['label' => $this->_('Afficher la carte')]) + ['label' => $this->_('Afficher la carte interactive')]); + } + + + public function populate($datas) { + $this + ->addToSelectionGroup(['libraries']) + + ->addToDisplaySettingsGroup(['osm_map', + 'order', + 'nb_aff', + 'fields', + 'filters', + 'filters_display_modes', + 'filters_position']); + + parent::populate($datas); - ->addElement('submit', - 'submit', - ['label' => $this->_('Valider'), - 'class' => 'bouton']); + return $this->addToStyleGroup(['pagination', + 'linked']); } } diff --git a/library/ZendAfi/Form/Configuration/Widget/ListOfSites.php b/library/ZendAfi/Form/Configuration/Widget/ListOfSites.php new file mode 100644 index 0000000000000000000000000000000000000000..eaae89ca277acebf4e1ea51dec02c22d658aec1c --- /dev/null +++ b/library/ZendAfi/Form/Configuration/Widget/ListOfSites.php @@ -0,0 +1,69 @@ +<?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 ZendAfi_Form_Configuration_Widget_ListOfSites extends ZendAfi_Form_Configuration_Widget_Base { + public function init() { + parent::init(); + + $this->addElement('select', + 'type_aff', + ['label' => $this->_('Type'), + 'multiOptions' => ['1' => $this->_('Affichage paginé'), + '2' => $this->_('Affichage groupé par catégorie'), + '3' => $this->_('Affichage hiérarchique par catégorie')], + 'value' => 1]) + + ->addElement('select', + 'display_order', + ['label' => $this->_('Ordre d\'affichage'), + 'multiOptions' => ['Random' => $this->_('Par ordre aléatoire'), + 'Selection' => $this->_('Par ordre de sélection'), + 'Recent' => $this->_('Les sites les plus récents')], + 'value' => 'Random']) + + ->addElement('text', + 'nb_aff', + ['value' => 2, + 'label' => $this->_('Nombre de sites par page')]); + } + + + public function populate($datas) { + $this + ->addElement('treeSelect', + 'listOfSites_source', + ['IdItems' => isset($datas['id_items']) ? $datas['id_items'] : '', + 'IdCategories' => isset($datas['id_categorie']) ? $datas['id_categorie'] : '', + 'UrlDataSource' => Class_Url::assemble(['module' => 'admin', + 'controller' => 'bib', + 'action' => 'allitems', + 'type' => 'sito', + 'id_bib' => isset($datas['id_bib']) ? $datas['id_bib'] : ''])]); + + $this + ->addToSelectionGroup(['listOfSites_source']) + ->addToDisplaySettingsGroup(['type_aff', + 'display_order', + 'nb_aff']); + return parent::populate($datas); + } +} diff --git a/library/ZendAfi/Form/Configuration/BaseLogin.php b/library/ZendAfi/Form/Configuration/Widget/Login.php similarity index 75% rename from library/ZendAfi/Form/Configuration/BaseLogin.php rename to library/ZendAfi/Form/Configuration/Widget/Login.php index b4b0e75c5d642bbea6df0d174c909249bfdf5426..88bcee8d50347a55bb6a696f13f9683674b9b8a2 100644 --- a/library/ZendAfi/Form/Configuration/BaseLogin.php +++ b/library/ZendAfi/Form/Configuration/Widget/Login.php @@ -19,71 +19,94 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -class ZendAfi_Form_Configuration_BaseLogin extends ZendAfi_Form { +class ZendAfi_Form_Configuration_Widget_Login extends ZendAfi_Form_Configuration_Widget_Base { public function init() { parent::init(); $this - ->setAttrib('id', 'configuration_login_widget') - - ->addElement('select', - 'boite', - ['label' => $this->_('Style de boite'), - 'multiOptions' => ( - new Class_Profil_Templates( - Class_Profil::getCurrentProfil()))->toArray()]) - - ->addElement('text', - 'titre', - ['label' => $this->_('Titre')]) ->addElement('text', 'titre_connecte', ['label' => $this->_('Titre une fois connecté')]) + ->addElement('text', 'message_connecte', ['label' => $this->_('Message de bienvenue')]) + ->addElement('text', 'identifiant', ['label' => $this->_('Libellé identifiant')]) + ->addElement('text', 'identifiant_exemple', ['label' => $this->_('Texte dans le champ de saisie de l\'identifiant')]) + ->addElement('text', 'mot_de_passe', ['label' => $this->_('Libellé mot de passe')]) + ->addElement('text', 'mot_de_passe_exemple', ['label' => $this->_('Texte dans le champ de saisie du mot de passe')]) + ->addElement('checkbox', 'autocomplete_off', ['label' => $this->_('Désactiver l\'auto-complétion'), 'multiOptions' => [1,0]]) + ->addElement('text', 'lien_connexion', ['label' => $this->_('Libellé du lien de connexion')]) + ->addElement('text', 'lien_deconnection', ['label' => $this->_('Libellé du lien de déconnexion')]) + ->addElement('text', 'lien_mot_de_passe_oublie', ['label' => $this->_('Libellé du lien de mot de passe oublié')]) + ->addElement('text', 'lien_compte', ['label' => $this->_('Libellé du lien d\'accès au compte')]) + ->addElement('text', 'lien_creer_compte', ['label' => $this->_('Libellé du lien de création d\'un compte')]) + ->addElement('text', 'pre_registration', ['label' => $this->_('Libellé du lien de préinscription')]) + ->addElement('comboProfils', 'profil_redirect', ['label' => $this->_('À la connextion : basculer automatiquement sur le profil'), 'empty_option' => true]) + ->addElement('comboProfils', 'profil_logout_redirect', ['label' => $this->_('À la déconnextion : basculer automatiquement sur le profil'), - 'empty_option' => true]); + 'empty_option' => true]) + + ->addToDisplaySettingsGroup(['titre_connecte', + 'message_connecte', + 'identifiant', + 'identifiant_exemple', + 'mot_de_passe', + 'mot_de_passe_exemple', + 'lien_connexion', + 'lien_deconnection', + 'lien_mot_de_passe_oublie', + 'lien_compte', + 'lien_creer_compte', + 'pre_registration']); + } + + + public function populate($datas) { + parent::populate($datas); + return $this + ->addToStyleGroup(['autocomplete_off']) + ->addToHeadGroup(['profil_redirect', + 'profil_logout_redirect']); } } diff --git a/library/ZendAfi/Form/Configuration/Widget/Menu.php b/library/ZendAfi/Form/Configuration/Widget/Menu.php new file mode 100644 index 0000000000000000000000000000000000000000..23ee882b94e07bad627c6e3548c9b5506b48c811 --- /dev/null +++ b/library/ZendAfi/Form/Configuration/Widget/Menu.php @@ -0,0 +1,56 @@ +<?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 ZendAfi_Form_Configuration_Widget_Menu extends ZendAfi_Form_Configuration_Widget_Base { + public function init() { + parent::init(); + $this->addElement('checkbox', + 'afficher_titre', + ['label' => $this->_('Afficher le titre du menu'), + 'value' => 1]) + + ->addElement('checkbox', + 'menu_deplie', + ['label' => $this->_('Menu déplié par défaut')]) + + ->addElement('checkbox', + 'new_html', + ['label' => $this->_('Structure HTML simplifiée pour la css')]) + + ->addElement('checkbox', + 'toggle_menu', + ['label' => $this->_('Interrupteur à basule')]) + + ->addElement('select', + 'menu', + ['label' => $this->_('Menu utilisé'), + 'registerInArrayValidator' => false, + 'multiOptions' => (new Class_Systeme_ModulesAccueil_MenuVertical())->getMenus()]) + + ->addToSelectionGroup(['menu']) + + ->addToDisplaySettingsGroup(['afficher_titre', + 'menu_deplie', + 'new_html', + 'toggle_menu']); + } +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/Widget/PremierChapitre.php b/library/ZendAfi/Form/Configuration/Widget/PremierChapitre.php new file mode 100644 index 0000000000000000000000000000000000000000..a869481bf68c367948b6351cef49070e2687e2be --- /dev/null +++ b/library/ZendAfi/Form/Configuration/Widget/PremierChapitre.php @@ -0,0 +1,79 @@ +<?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 ZendAfi_Form_Configuration_Widget_PremierChapitre extends ZendAfi_Form_Configuration_Widget_Base { + public function init() { + parent::init(); + + $this + ->addElement('text', + 'intro', + ['label' => $this->_('Texte d\'introduction')]) + + ->addElement('select', + 'type', + ['label' => $this->_('Type de sélection'), + 'multiOptions' => [$this->_('aléatoire'), + $this->_('Panier'), + $this->_('Tous les documents')]]) + + ->addElement('text', + 'nb_aff', + ['label' => $this->_('Nombre à afficher')]) + + ->addElement('select', + 'format', + ['label' => $this->_('Format d\'affichage'), + 'multiOptions' => [$this->_('vignette seule'), + $this->_('vignette + frame'), + $this->_('Vignette + frame + lien vers le document')], + 'value' => 2]) + + ->addElement('text', + 'pc_ref_url', + ['label' => $this->_('Url d\'accès direct')]); + } + + + public function populate($datas) { + $this->addElement('treeSelect', + 'data_source', + ['UrlDataSource' => Class_Url::assemble(['module' => 'admin', + 'controller' => 'catalogue', + 'action' => 'domaines-paniers']).'.json', + 'MultipleSelection' => false, + 'InputIdCategoriesName' => 'id_catalogue', + 'InputIdItemsName' => 'id_panier', + 'IdItems' => isset($datas['id_panier']) ? $datas['id_panier'] : '', + 'IdCategories' => isset($datas['id_catalogue']) ? $datas['id_catalogue'] : '']); + + $this + ->addToSelectionGroup(['data_source']) + ->addToDisplaySettingsGroup(['intro', + 'type', + 'nb_aff', + 'format', + 'pc_ref_url']); + + return parent::populate($datas); + } +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/Widget/RSS.php b/library/ZendAfi/Form/Configuration/Widget/RSS.php new file mode 100644 index 0000000000000000000000000000000000000000..8b0b9f47f16eb085e8b198cee838a74aab8fd207 --- /dev/null +++ b/library/ZendAfi/Form/Configuration/Widget/RSS.php @@ -0,0 +1,59 @@ +<?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 ZendAfi_Form_Configuration_Widget_RSS extends ZendAfi_Form_Configuration_Widget_Base { + public function init() { + parent::init(); + + $this->addElement('select', + 'type_aff', + ['label' => $this->_('Type'), + 'multiOptions' => [1 => $this->_('Une sélection de catégories ou de fils Rss'), + 2 => $this->_('Les fils Rss les plus récents')], + 'value' => 1]) + + ->addElement('text', + 'nb_aff', + ['value' => 2, + 'label' => $this->_('Nombre d\'articles à afficher')]); + } + + + public function populate($datas) { + $this->addElement('treeSelect', + 'feed_source', + ['IdItems' => isset($datas['id_items']) ? $datas['id_items'] : '', + 'IdCategories' => isset($datas['id_categorie']) ? $datas['id_categorie'] : '', + 'UrlDataSource' => Class_Url::assemble(['module' => 'admin', + 'controller' => 'bib', + 'action' => 'allitems', + 'type' => 'rss', + 'id_bib' => isset($datas['id_bib']) ? $datas['id_bib'] : ''])]); + + $this + ->addToSelectionGroup(['feed_source']) + ->addToDisplaySettingsGroup(['type_aff', + 'nb_aff']); + + return parent::populate($datas); + } +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/Widget/Reviews.php b/library/ZendAfi/Form/Configuration/Widget/Reviews.php new file mode 100644 index 0000000000000000000000000000000000000000..b804930999421f08e0442114a3d0da99270f5ef3 --- /dev/null +++ b/library/ZendAfi/Form/Configuration/Widget/Reviews.php @@ -0,0 +1,91 @@ +<?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 ZendAfi_Form_Configuration_Widget_Reviews extends ZendAfi_Form_Configuration_Widget_Base { + + public function init() { + parent::init(); + + $this + ->addElement('select', + 'abon_ou_bib', + ['label' => $this->_('Origine des critiques'), + 'value' => 0, + 'multioptions' => [1 => $this->_('bibliothécaire'), + 0 => $this->_('abonné ou utilisateur du site'), + 'all' => $this->_('tout le monde')]]) + ->addElement('checkbox', + 'hierarchical', + ['label' => $this->_('Navigation hiérarchique')]) + + ->addElement('text', + 'nb_aff_avis', + ['label' => $this->_('Nombre à afficher'), + 'value' => 2]) + + ->addElement('select', + 'display_order', + ['label' => $this->_('Ordre d\'affichage'), + 'value' => 'Random', + 'multiOptions' => ['CreationDesc' => $this->_('par date de création (plus récent en premier)'), + 'Random' => $this->_('Aléatoire')]]) + + ->addElement('text', + 'nb_words', + ['label' => $this->_('Afficher les premiers mots'), + 'value' => 30]) + + ->addElement('select', + 'only_img', + ['label' => $this->_('Filtrer les critiques affichées'), + 'value' => 1, + 'multiOptions' => [$this->_('non'), + $this->_('avec une vignette')]]); + } + + + public function populate($datas) { + $this->addElement('treeSelect', + 'data_source', + ['label' => $this->_('Filtrer avec une sélection'), + 'UrlDataSource' => Class_Url::assemble(['module' => 'admin', + 'controller' => 'catalogue', + 'action' => 'domaines-paniers']).'.json', + 'MultipleSelection' => false, + 'InputIdCategoriesName' => 'id_catalogue', + 'InputIdItemsName' => 'id_panier', + 'IdItems' => isset($datas['id_panier']) ? $datas['id_panier'] : '', + 'IdCategories' => isset($datas['id_catalogue']) ? $datas['id_catalogue'] : '']); + + $this + ->addToSelectionGroup(['abon_ou_bib', + 'only_img', + 'data_source']) + + ->addToDisplaySettingsGroup(['hierarchical', + 'nb_aff_avis', + 'display_order', + 'nb_words']); + + return parent::populate($datas); + } +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/SearchWidget.php b/library/ZendAfi/Form/Configuration/Widget/Search.php similarity index 68% rename from library/ZendAfi/Form/Configuration/SearchWidget.php rename to library/ZendAfi/Form/Configuration/Widget/Search.php index 50e440d21fc1f37245b72e6184746ab88abbcd9e..6b7468572bc3b9ab5d514b6cdd66eb42f6ce759d 100644 --- a/library/ZendAfi/Form/Configuration/SearchWidget.php +++ b/library/ZendAfi/Form/Configuration/Widget/Search.php @@ -19,28 +19,17 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class ZendAfi_Form_Configuration_SearchWidget extends ZendAfi_Form { +class ZendAfi_Form_Configuration_Widget_Search extends ZendAfi_Form_Configuration_Widget_Base { public function init() { parent::init(); $this - ->setAttrib('id', - 'configuration_searchWidget') - ->addElement('select', - 'boite', - ['label' => $this->_('Style de boite'), - 'multiOptions' => ( - new Class_Profil_Templates( - Class_Profil::getCurrentProfil()))->toArray()]) ->addElement('slider', 'largeur', ['label' => $this->_('Largeur du champ de saisie'), 'min' => 100, 'max' => 300, 'step' => 1]) - ->addElement('text', - 'titre', - ['label' => $this->_('Titre'), - 'size' => '55']) + ->addElement('checkbox', 'select_bib', ['label' => $this->_('Proposer la sélection de bibliothèques'), @@ -91,7 +80,8 @@ class ZendAfi_Form_Configuration_SearchWidget extends ZendAfi_Form { ->addElement('comboProfils', 'profil_redirect', - ['label' => $this->_('Basculer automatiquement sur le profil')]) + ['label' => $this->_('Basculer automatiquement sur le profil'), + 'empty_option' => true]) ->addElement('select', 'type_doc', @@ -107,40 +97,32 @@ class ZendAfi_Form_Configuration_SearchWidget extends ZendAfi_Form { ->addElement('radio', 'domain_select_style', - ['label' => $this->_('Mode de sélection'), - 'multiOptions' => [Class_Systeme_ModulesAccueil_RechercheSimple::DOMAIN_SELECT_SELECT => $this->_('Sélection dans une liste déroulante'), - Class_Systeme_ModulesAccueil_RechercheSimple::DOMAIN_SELECT_CHECKBOX => $this->_('Sélection multiple par cases à cocher')]]) - - ->addDisplayGroup(['boite', 'largeur'], - 'display', - ['legend' => $this->_('Affichage')]) - - ->addDisplayGroup(['titre', - 'select_bib', - 'select_annexe', - 'select_doc', - 'search_button', - 'message', - 'placeholder', - 'exemple', - 'recherche_avancee', - 'tri', - 'profil_redirect'], - 'general', - ['legend' => $this->_('Généralités')]) - - ->addDisplayGroup(['type_doc'], - 'filters', - ['legend' => $this->_('Filtres')]) - - ->addDisplayGroup(['domain_ids', - 'domain_select_style'], - 'domains', - ['legend' => '']); + ['label' => $this->_('Mode de sélection des domaines'), + 'multiOptions' => [Class_Systeme_ModulesAccueil_RechercheSimple::DOMAIN_SELECT_SELECT => $this->_('liste déroulante'), + Class_Systeme_ModulesAccueil_RechercheSimple::DOMAIN_SELECT_CHECKBOX => $this->_('cases à cocher')], + 'value' => Class_Systeme_ModulesAccueil_RechercheSimple::DOMAIN_SELECT_SELECT]); + } - } + public function populate($datas) { + $this + ->addToSelectionGroup(['type_doc', + 'tri']) + ->addToDisplaySettingsGroup(['search_button', + 'message', + 'placeholder', + 'exemple', + 'recherche_avancee', + 'select_bib', + 'select_annexe', + 'select_doc', + 'domain_ids']); + parent::populate($datas); + + return $this + ->addToStyleGroup(['largeur', + 'domain_select_style']) + ->addToHeadGroup(['profil_redirect']); + } } - -?> \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/Widget/Statistics.php b/library/ZendAfi/Form/Configuration/Widget/Statistics.php new file mode 100644 index 0000000000000000000000000000000000000000..aca6c13ca400cb64823582410d19ae955829bd89 --- /dev/null +++ b/library/ZendAfi/Form/Configuration/Widget/Statistics.php @@ -0,0 +1,34 @@ +<?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 ZendAfi_Form_Configuration_Widget_Statistics extends ZendAfi_Form_Configuration_Widget_Base { + public function init() { + parent::init(); + $this->addElement('select', + 'nb_notices', + ['value' => 1, + 'label' => $this->_('Nombre de documents'), + 'multiOptions' => [$this->_('non'), + $this->_('oui')]]); + $this->addToDisplaySettingsGroup(['nb_notices']); + } +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/Widget/Tags.php b/library/ZendAfi/Form/Configuration/Widget/Tags.php new file mode 100644 index 0000000000000000000000000000000000000000..ea9b0e1ae31e13d6f5a1ba39cf85f8d47b94ebc1 --- /dev/null +++ b/library/ZendAfi/Form/Configuration/Widget/Tags.php @@ -0,0 +1,78 @@ +<?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 ZendAfi_Form_Configuration_Widget_Tags extends ZendAfi_Form_Configuration_Widget_Base { + + public function init() { + parent::init(); + + $this->addElement('select', + 'notices', + ['label' => $this->_('Filtre'), + 'multiOptions' => [$this->_('non'), + $this->_('uniquement les nouveautés'), + $this->_('uniquement les plus consulés')], + 'value' => 1]) + + ->addElement('text', + 'limite', + ['label' => $this->_('Nombre de documents à analyser')]) + + ->addElement('text', + 'nombre', + ['label' => $this->_('Nombre de tags à afficher')]); + } + + + public function populate($datas) { + $this + ->addElement('codeList', + 'type_tags', + ['label' => $this->_('Types de tags'), + 'field' => 'type_tags', + 'values' => isset($datas['type_tags']) ? $datas['type_tags'] : '', + 'required' => true, + 'validators' => [['name' => 'notEmpty', + 'value' => false, + 'options' => [ 'messages' => $this->_('Indiquez au moins 1 type de tag à afficher')]]]]) + ->addElement('treeSelect', + 'data_source', + ['label' => $this->_('Source'), + 'UrlDataSource' => Class_Url::assemble(['module' => 'admin', + 'controller' => 'catalogue', + 'action' => 'domaines-paniers']).'.json', + 'MultipleSelection' => false, + 'InputIdCategoriesName' => 'id_catalogue', + 'InputIdItemsName' => 'id_panier', + 'IdItems' => isset($datas['id_panier']) ? $datas['id_panier'] : '', + 'IdCategories' => isset($datas['id_catalogue']) ? $datas['id_catalogue'] : '']); + + $this + ->addToSelectionGroup(['notices', + 'type_tags', + 'data_source']) + ->addToDisplaySettingsGroup(['limite', + 'nombre']); + + return parent::populate($datas); + } +} diff --git a/library/ZendAfi/Form/Configuration/Widget/TwoWidgets.php b/library/ZendAfi/Form/Configuration/Widget/TwoWidgets.php new file mode 100644 index 0000000000000000000000000000000000000000..1762753e7cff11ece3ca891b19a8029668b73353 --- /dev/null +++ b/library/ZendAfi/Form/Configuration/Widget/TwoWidgets.php @@ -0,0 +1,42 @@ +<?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 ZendAfi_Form_Configuration_Widget_TwoWidgets extends ZendAfi_Form_Configuration_Widget_Base { + public function init() { + parent::init(); + + $widgets = Class_Systeme_ModulesAccueil::getWidgets(); + + $this->addElement('select', + 'col_gauche_type', + ['label' => $this->_('Première boite'), + 'registerInArrayValidator' => false, + 'multiOptions' => $widgets]) + ->addElement('select', + 'col_droite_type', + ['label' => $this->_('Seconde boite'), + 'registerInArrayValidator' => false, + 'multiOptions' => $widgets]) + ->addToSelectionGroup(['col_gauche_type', + 'col_droite_type']); + } +} diff --git a/library/ZendAfi/Form/Configuration/Widget/Zones.php b/library/ZendAfi/Form/Configuration/Widget/Zones.php new file mode 100644 index 0000000000000000000000000000000000000000..beacc685915eea0e63cb4d100e07ea8fb5f5cff9 --- /dev/null +++ b/library/ZendAfi/Form/Configuration/Widget/Zones.php @@ -0,0 +1,33 @@ +<?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 ZendAfi_Form_Configuration_Widget_Zones extends ZendAfi_Form_Configuration_Widget_Base { + public function init() { + parent::init(); + + $this->addElement('text', + 'message_carte', + ['label' => $this->_('Message sous la carte')]) + + ->addToDisplaySettingsGroup(['message_carte']); + } +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Decorator/DisplayMode.php b/library/ZendAfi/Form/Decorator/DisplayMode.php new file mode 100644 index 0000000000000000000000000000000000000000..144926f348689bb9e4b72870e15c923417233d79 --- /dev/null +++ b/library/ZendAfi/Form/Decorator/DisplayMode.php @@ -0,0 +1,56 @@ +<?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 ZendAfi_Form_Decorator_DisplayMode extends Zend_Form_Decorator_Abstract { + public function render($content) { + $view = $this->_element->getView(); + + $submit_script = sprintf('$("select[name=\'%s\']").change(function() {$("#styles_reload").val("1");var form=$(this).closest("form"); %s form.submit();});', + 'mode-affichage', + $view->isPopup() + ? 'initializeAjaxFormSubmit(form);' + : ''); + + Class_ScriptLoader::getInstance() + ->addJQueryReady($submit_script); + + $select = $view->formSelect('mode-affichage', + $this->_element->getValue(), + '', + $this->_element->getMultiOptions()); + + $properties = (new ZendAfi_View_Helper_Admin_PropertiesReader()) + ->setView($view) + ->propertiesReader($this->_element->getValue(), + $this->_element->getSettings()); + + $reload = $view->tag('input', + null, + ['type' => 'hidden', + 'id' => 'styles_reload', + 'name' => 'styles_reload', + 'value' => '0']); + + return $select . $properties . $reload; + } +} +?> \ No newline at end of file diff --git a/library/ZendAfi/Form/Decorator/IcoPicker.php b/library/ZendAfi/Form/Decorator/IcoPicker.php new file mode 100644 index 0000000000000000000000000000000000000000..6a10136cfb1c8027acf10d832b5db081d8689879 --- /dev/null +++ b/library/ZendAfi/Form/Decorator/IcoPicker.php @@ -0,0 +1,31 @@ +<?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 ZendAfi_Form_Decorator_IcoPicker extends Zend_Form_Decorator_Abstract { + public function render($content) { + return $this->_element->getView()->ChoixPictogramme('menus', + $this->_element->getName(), + Class_Profil::getCurrentProfil()->getId(), + $this->_element->getValue()); + } +} +?> \ No newline at end of file diff --git a/library/ZendAfi/Form/Decorator/RecordTabs.php b/library/ZendAfi/Form/Decorator/RecordTabs.php new file mode 100644 index 0000000000000000000000000000000000000000..6bb9bb4aec3fbc76fe03a701b6b059c20069a1df --- /dev/null +++ b/library/ZendAfi/Form/Decorator/RecordTabs.php @@ -0,0 +1,31 @@ +<?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 ZendAfi_Form_Decorator_RecordTabs extends Zend_Form_Decorator_Abstract { + /** + * @param string $content + * @return string + */ + public function render($content) { + return $this->_element->getView()->recordTabs($this->_element->getSettings()); + } +} \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/AccueilControllerTagsTest.php b/library/ZendAfi/Form/Decorator/TagObjetsImgProperties.php similarity index 64% rename from tests/application/modules/admin/controllers/AccueilControllerTagsTest.php rename to library/ZendAfi/Form/Decorator/TagObjetsImgProperties.php index 4feaff408f4a8a14bf77df6e018d4aa7fa4dea98..08892bfb2e75600d244cd19c42f4aa0181f01a73 100644 --- a/tests/application/modules/admin/controllers/AccueilControllerTagsTest.php +++ b/library/ZendAfi/Form/Decorator/TagObjetsImgProperties.php @@ -1,6 +1,6 @@ <?php /** - * Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved. + * 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 @@ -20,16 +20,14 @@ */ -class AccueilControllerTagsDispatchTest extends Admin_AbstractControllerTestCase { - public function setUp() { - parent::setUp(); - $this->dispatch('/admin/accueil/tags?config=accueil&id_profil=1&id_module=1&type_module=TAGS'); - } - - - /** @test */ - public function tagSelectionChampsShouldBePresent() { - $this->assertXPathContentContains('//h2', 'Facettes disponibles'); +class ZendAfi_Form_Decorator_TagObjetsImgProperties extends Zend_Form_Decorator_Abstract { + /** + * @param string $content + * @return string + */ + public function render($content) { + return $this->_element->getView()->tagObjetsImgProperties($this->_element->getMultiOptions(), + $this->_element->getSettings()); } } ?> \ No newline at end of file diff --git a/library/ZendAfi/Form/Decorator/Unimarc.php b/library/ZendAfi/Form/Decorator/Unimarc.php new file mode 100644 index 0000000000000000000000000000000000000000..43f9815f26a5d255835976f3c1db4991d9a94078 --- /dev/null +++ b/library/ZendAfi/Form/Decorator/Unimarc.php @@ -0,0 +1,33 @@ +<?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 ZendAfi_Form_Decorator_Unimarc extends Zend_Form_Decorator_Abstract { + /** + * @param string $content + * @return string + */ + public function render($content) { + return $this->_element->getView()->unimarcZoneConfig($this->_element->getSettings(), + $this->_element->getId(), + $this->_element->getMessages()); + } +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Element/DisplayMode.php b/library/ZendAfi/Form/Element/DisplayMode.php new file mode 100644 index 0000000000000000000000000000000000000000..17a222d37f0f2e8aea698737fc3a59165f236150 --- /dev/null +++ b/library/ZendAfi/Form/Element/DisplayMode.php @@ -0,0 +1,61 @@ +<?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 ZendAfi_Form_Element_DisplayMode extends Zend_Form_Element { + protected + $_multi_options, + $_settings; + + public function __construct($spec, $options = null) { + parent::__construct($spec, $options); + + $decorators = $this->_decorators; + $this->_decorators = ['ImageViewer' => new ZendAfi_Form_Decorator_DisplayMode()]; + + foreach ($decorators as $name => $value) + $this->_decorators[$name] = $value; + $this->removeDecorator('ViewHelper'); + } + + + public function setMultiOptions($multi_options) { + $this->_multi_options = $multi_options; + return $this; + } + + + public function getMultiOptions() { + return $this->_multi_options; + } + + + public function setSettings($settings) { + $this->_settings = $settings; + return $this; + } + + + public function getSettings() { + return $this->_settings; + } +} +?> \ No newline at end of file diff --git a/library/ZendAfi/Form/Element/IcoPicker.php b/library/ZendAfi/Form/Element/IcoPicker.php new file mode 100644 index 0000000000000000000000000000000000000000..fc6ee5d5de020fc176de0ef6d47eb3235999ad0d --- /dev/null +++ b/library/ZendAfi/Form/Element/IcoPicker.php @@ -0,0 +1,35 @@ +<?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 ZendAfi_Form_Element_IcoPicker extends Zend_Form_Element { + public function __construct($spec, $options = null) { + parent::__construct($spec, $options); + + $decorators = $this->_decorators; + $this->_decorators = ['Image' => new ZendAfi_Form_Decorator_IcoPicker()]; + + foreach ($decorators as $name => $value) + $this->_decorators[$name] = $value; + $this->removeDecorator('ViewHelper'); + } +} +?> \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/AccueilControllerLoginTest.php b/library/ZendAfi/Form/Element/RecordTabs.php similarity index 59% rename from tests/application/modules/admin/controllers/AccueilControllerLoginTest.php rename to library/ZendAfi/Form/Element/RecordTabs.php index 6fcc09b2c5e884ab7b17ddc85740595df8e9653c..6b2bec7c3b55d7e6f68ec0dfb4b169b844d3bd2c 100644 --- a/tests/application/modules/admin/controllers/AccueilControllerLoginTest.php +++ b/library/ZendAfi/Form/Element/RecordTabs.php @@ -20,22 +20,29 @@ */ -class Admin_AccueilControllerLoginDispatchTest extends Admin_AbstractControllerTestCase { - public function setUp() { - parent::setUp(); - $this->dispatch('admin/accueil/login/config/accueil/id_module/2/type_module/LOGIN', true); +class ZendAfi_Form_Element_RecordTabs extends Zend_Form_Element { + protected + $_settings; + + public function __construct($spec, $options = null) { + parent::__construct($spec, $options); + + $decorators = $this->_decorators; + $this->_decorators = ['ImageViewer' => new ZendAfi_Form_Decorator_RecordTabs()]; + + foreach ($decorators as $name => $value) + $this->_decorators[$name] = $value; + $this->removeDecorator('ViewHelper'); } - /** @test */ - public function welcomeInputShouldBePresent() { - $this->assertXPath('//form//input[@name="titre_connecte"]'); + public function setSettings($settings) { + $this->_settings = $settings; + return $this; } - /** @test */ - public function preSubscriptionInputValueShouldBeEmpty() { - $this->assertXPath('//form//input[@name="pre_registration"][@value=""]'); + public function getSettings() { + return $this->_settings; } -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Element/TagObjetsImgProperties.php b/library/ZendAfi/Form/Element/TagObjetsImgProperties.php new file mode 100644 index 0000000000000000000000000000000000000000..96be2cba0bd87c2cd7594fe31daa74bc69a43dab --- /dev/null +++ b/library/ZendAfi/Form/Element/TagObjetsImgProperties.php @@ -0,0 +1,61 @@ +<?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 ZendAfi_Form_Element_TagObjetsImgProperties extends Zend_Form_Element { + protected + $_multi_options, + $_settings; + + public function __construct($spec, $options = null) { + parent::__construct($spec, $options); + + $decorators = $this->_decorators; + $this->_decorators = ['ImageViewer' => new ZendAfi_Form_Decorator_TagObjetsImgProperties()]; + + foreach ($decorators as $name => $value) + $this->_decorators[$name] = $value; + $this->removeDecorator('ViewHelper'); + } + + + public function setMultiOptions($multi_options) { + $this->_multi_options = $multi_options; + return $this; + } + + + public function getMultiOptions() { + return $this->_multi_options; + } + + + public function setSettings($settings) { + $this->_settings = $settings; + return $this; + } + + + public function getSettings() { + return $this->_settings; + } +} +?> \ No newline at end of file diff --git a/library/ZendAfi/Form/Element/Unimarc.php b/library/ZendAfi/Form/Element/Unimarc.php new file mode 100644 index 0000000000000000000000000000000000000000..3aa3c86880e904cb54f367bdf2550f756c6b8f4c --- /dev/null +++ b/library/ZendAfi/Form/Element/Unimarc.php @@ -0,0 +1,60 @@ +<?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 ZendAfi_Form_Element_Unimarc extends Zend_Form_Element { + protected + $_settings, + $_error_messages; + + public function __construct($spec, $options = null) { + parent::__construct($spec, $options); + + $decorators = $this->_decorators; + $this->_decorators = ['ImageViewer' => new ZendAfi_Form_Decorator_Unimarc()]; + + foreach ($decorators as $name => $value) + $this->_decorators[$name] = $value; + $this->removeDecorator('ViewHelper'); + } + + + public function setSettings($settings) { + $this->_settings = $settings; + return $this; + } + + + public function getSettings() { + return $this->_settings; + } + + + public function setMessages($errors) { + $this->_error_messages = $errors; + return $this; + } + + + public function getMessages() { + return $this->_error_messages; + } +} \ 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 631f2f6f7a73cf06e8718d777f24ba6e325eab78..19d6c64a9616afcd3a351ef181df7139c2d3ea6e 100644 --- a/library/ZendAfi/View/Helper/Accueil/Base.php +++ b/library/ZendAfi/View/Helper/Accueil/Base.php @@ -148,10 +148,10 @@ class ZendAfi_View_Helper_Accueil_Base extends ZendAfi_View_Helper_ModuleAbstrac } -//--------------------------------------------------------------------- -// Rend l'objet d'acces aux proprietes -//--------------------------------------------------------------------- + protected function getFonctionAdmin() { + if(!$this->_fonction_admin_helper) + return ''; $helper = $this->view->getHelper($this->_fonction_admin_helper); return $helper->fonctionsAdmin($this->id_module, $this->type_module, $this->division); } @@ -302,6 +302,9 @@ class ZendAfi_View_Helper_Accueil_Base extends ZendAfi_View_Helper_ModuleAbstrac $classname = self::getModuleHelperClass($type_module); if (class_exists($classname)) { + /* if($id_module == 39) { */ + /* var_dump($module_params);exit; */ + /* } */ $helper = new $classname($id_module, $module_params); $helper->setView($view); return $helper; diff --git a/library/ZendAfi/View/Helper/Accueil/Kiosque.php b/library/ZendAfi/View/Helper/Accueil/Kiosque.php index 2bcb93e59fc0c8f918c0a5026e0cf5726beb450d..84d936ae977585884a7ab2e14d1309bc0f46563d 100644 --- a/library/ZendAfi/View/Helper/Accueil/Kiosque.php +++ b/library/ZendAfi/View/Helper/Accueil/Kiosque.php @@ -239,12 +239,15 @@ class ZendAfi_View_Helper_Accueil_Kiosque extends ZendAfi_View_Helper_Accueil_Ba $titre = $this->preferences['titre']; $this->preferences['titre'] = str_replace(['/', '%2F'], ' ', $this->preferences['titre']); - $url_options = array_merge(['controller' => 'recherche', 'action' => 'simple'], + $url_options = array_merge(['controller' => 'recherche', + 'action' => 'simple'], $this->preferences); - $url_options['tri'] = ($this->preferences['tri']) ? $tris[$this->preferences['tri']] : $tris[0]; - return sprintf('<a href="%s">%s</a>', - $this->view->url($url_options, null, true), - htmlentities($titre)); + $url_options['tri'] = ($this->preferences['tri']) + ? $tris[$this->preferences['tri']] + : $tris[0]; + unset($url_options['preferences']); + return $this->view->tagAnchor($this->view->url($url_options, null, true), + htmlentities($titre)); } diff --git a/library/ZendAfi/View/Helper/Accueil/MenuVertical.php b/library/ZendAfi/View/Helper/Accueil/MenuVertical.php index 942106905fb347e01f7dabc26fff7b7e7462a9ae..69c170da16f6d2fc838d3af474e74624c5dce217 100644 --- a/library/ZendAfi/View/Helper/Accueil/MenuVertical.php +++ b/library/ZendAfi/View/Helper/Accueil/MenuVertical.php @@ -18,7 +18,13 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + class ZendAfi_View_Helper_Accueil_MenuVertical extends ZendAfi_View_Helper_Accueil_Base { + + protected + $_menu_id_profil, + $_menu_id; + /** @var Class_Systeme_ModulesMenu */ private $_cls_menu; @@ -47,8 +53,10 @@ class ZendAfi_View_Helper_Accueil_MenuVertical extends ZendAfi_View_Helper_Accue : [Class_Profil::getCurrentProfil()->getId(), $menu]; if (!$profil = Class_profil::find($id_profil)) - return $this->retourErreur($this->translate()->_('Ce menu ne contient aucune entrée.')); + return $this->retourErreur($this->_('Ce menu ne contient aucune entrée.')); + $this->_menu_id_profil = $id_profil; + $this->_menu_id = $menu; $this->_loadToggleMenuJsAndCss($toggle_menu); $this->_cls_menu = new Class_Systeme_ModulesMenu(); @@ -56,13 +64,13 @@ class ZendAfi_View_Helper_Accueil_MenuVertical extends ZendAfi_View_Helper_Accue $menu_deplie ? "" : "display:none"); $id_profil = $profil->getId(); - $menus = $profil->getCfgMenusAsArray(); + $menus = Class_Systeme_Widget_Menu::findAllAsArray($id_profil); if (!isset($menus[$menu])) $menus = Class_Profil::getPortail()->getCfgMenusAsArray(); if (!isset($menus[$menu])) - return $this->retourErreur($this->translate()->_('Ce menu ne contient aucune entrée.')); + return $this->retourErreur($this->_('Ce menu ne contient aucune entrée.')); $config = $menus[$menu]; @@ -77,11 +85,17 @@ class ZendAfi_View_Helper_Accueil_MenuVertical extends ZendAfi_View_Helper_Accue : $this->_getContentAsOldHtml($config); $this->titre = $titre; - $this->contenu = $contenu; + $this->contenu = $this->_editMenu() . $contenu; return $this->getHtmlArray(); } + protected function _editMenu() { + return $this->view->tagEditMenu($this->_menu_id, + $this->_menu_id_profil); + } + + protected function _loadToggleMenuJsAndCss($on) { if(!$on) return ''; @@ -109,6 +123,16 @@ class ZendAfi_View_Helper_Accueil_MenuVertical extends ZendAfi_View_Helper_Accue } + protected function _editEntry($params) { + if(!isset($params['id_module'])) + return ''; + + return $this->view->tagEditMenu($params['id_module'], + $this->_menu_id_profil, + $this->_menu_id); + } + + /** * @param array $menuitem * @return string @@ -207,9 +231,10 @@ class ZendAfi_View_Helper_Accueil_MenuVertical extends ZendAfi_View_Helper_Accue ? $this->afficherSousMenu($url) : []; - return $this->view->tagAnchor($url, - $this->getMenuPicto($item) . htmlspecialchars($item['libelle']), - array_merge($target, $sub_menu)); + return $this->_editEntry($item) + . $this->view->tagAnchor($url, + $this->getMenuPicto($item) . htmlspecialchars($item['libelle']), + array_merge($target, $sub_menu)); } @@ -312,6 +337,7 @@ class ZendAfi_View_Helper_Accueil_MenuVertical extends ZendAfi_View_Helper_Accue $profil_key = isset($menuitem["preferences"]["clef_profil"]) ? (int) $menuitem["preferences"]['clef_profil'] : '0'; + $class[] = $this->_getContextClass($profil_key); $class[] = $this->_getContextClassByUrl($url); @@ -344,7 +370,6 @@ class ZendAfi_View_Helper_Accueil_MenuVertical extends ZendAfi_View_Helper_Accue $param_url = $this->_cls_menu->getUrl($menuitem["type_menu"], $preferences); $url = $param_url["url"]; $target = ($param_url["target"] > "") ? $param_url["target"] : null; - return $this->_renderListItem($menuitem, $param_url["url"], $target); } @@ -363,12 +388,15 @@ class ZendAfi_View_Helper_Accueil_MenuVertical extends ZendAfi_View_Helper_Accue protected function _getContentAsOldHtml($config) { $contenu = '<div class="menuGauche"><ul class="menuGauche">'; - foreach ($config['menus'] as $entree) { + foreach ($config['menus'] as $key => $entree) { + $entree['id_module'] = $key; $contenu .= $this->_getLigne($entree); if (array_isset('sous_menus', $entree)) { $contenu .= sprintf('<li class="menuGauche" %s><ul>', $this->_li_style); - foreach ($entree["sous_menus"] as $sous_menu) + foreach ($entree["sous_menus"] as $sub_key => $sous_menu) { + $sous_menu['id_module'] = $sub_key; $contenu .= $this->_getLigne($sous_menu); + } $contenu .= '</ul></li>'; } } @@ -379,7 +407,8 @@ class ZendAfi_View_Helper_Accueil_MenuVertical extends ZendAfi_View_Helper_Accue protected function _getContentHtml($menus) { $menus_li = ''; - foreach($menus as $item) { + foreach($menus as $key => $item) { + $item['id_module'] = $key; $menus_li.= $this->_getLigne($item); } diff --git a/tests/application/modules/admin/controllers/AccueilControllerKiosqueTest.php b/library/ZendAfi/View/Helper/Admin/Button/Continue.php similarity index 53% rename from tests/application/modules/admin/controllers/AccueilControllerKiosqueTest.php rename to library/ZendAfi/View/Helper/Admin/Button/Continue.php index a7ec0aad71b3034f59a04d0b732ad2377d18f8ed..88c427d0b6574e02871b0c15a2aa8236f81797e9 100644 --- a/tests/application/modules/admin/controllers/AccueilControllerKiosqueTest.php +++ b/library/ZendAfi/View/Helper/Admin/Button/Continue.php @@ -1,6 +1,6 @@ <?php /** - * Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved. + * 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 @@ -20,22 +20,19 @@ */ -class Admin_AccueilControllerKiosqueDispatchTest extends Admin_AbstractControllerTestCase { - - public function setUp() { - parent::setUp(); - $this->dispatch('/admin/accueil/kiosque/type_module/KIOSQUE', true); - } - - - /** @test */ - public function randomSortShouldContainsBasketOrder() { - $this->assertXPathContentContains('//fieldset//td//select[@id="tri"]/option[@value="4"]', 'par l\'ordre du panier', $this->_response->getBody()); +class ZendAfi_View_Helper_Admin_Button_Continue extends ZendAfi_View_Helper_Button_Continue { + protected function _getDefaultAttribs() { + return array_merge(parent::_getDefaultAttribs(), + ['class' => 'continue', + 'disabled' => 'disabled']); } - /** @test */ - public function domainesPaniersJsonUrlShouldResetActionParameters() { - $this->assertXPathContentContains('//script', 'getJSON("/admin/catalogue/domaines-paniers.json",', $this->_response->getBody()); + protected function _getDefaultButton($attribs) { + return parent::_getDefaultButton($attribs) + ->setImage($this->view->tagImg(Class_Admin_Skin::current() + ->renderIconUrlOn('buttons', + 'validate'))) + ->setOnFormChange('$(\'button.continue\').removeAttr(\'disabled\');'); } } \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Admin/ChoixPictogramme.php b/library/ZendAfi/View/Helper/Admin/ChoixPictogramme.php index 91c482d4e638819007339031683aa353632e15af..f35a3f45b30816645a5d4f5f9057d36cb25ecb29 100644 --- a/library/ZendAfi/View/Helper/Admin/ChoixPictogramme.php +++ b/library/ZendAfi/View/Helper/Admin/ChoixPictogramme.php @@ -64,7 +64,7 @@ class ZendAfi_View_Helper_ChoixPictogramme extends ZendAfi_View_Helper_BaseHelpe if($scroll==true) $scroll='window.scrollTo(0,2000);'; - $oListe = "var oListe = $(this).closest('.formTable').find('#liste_picto_".$name."').get(0);"; + $oListe = "var oListe = $(this).closest('form').find('#liste_picto_".$name."').get(0);"; $onclick= $oListe . "if(oListe.style.display=='block') oListe.style.display='none'; else oListe.style.display='block';" . $scroll; @@ -81,9 +81,9 @@ class ZendAfi_View_Helper_ChoixPictogramme extends ZendAfi_View_Helper_BaseHelpe foreach($pictos as $picto) { if($nb >= $this->nb_par_ligne) {$html.='</tr><tr>'; $nb=0;} - $name_value = " $(this).closest('.formTable').find('#" . $name . "').val(this.id);"; + $name_value = " $(this).closest('form').find('#" . $name . "').val(this.id);"; - $src_value = "$(this).closest('.formTable').find('#select_" . $name . "').attr('src', this.src);"; + $src_value = "$(this).closest('form').find('#select_" . $name . "').attr('src', this.src);"; $onclick= $name_value . $src_value . $oListe . "oListe.style.display='none';$(this).closest('form').find('input').first().change();"; diff --git a/library/ZendAfi/View/Helper/Admin/Menus.php b/library/ZendAfi/View/Helper/Admin/Menus.php new file mode 100644 index 0000000000000000000000000000000000000000..6b2a7545b059c53db0e40020eec2c1fe8a5818d9 --- /dev/null +++ b/library/ZendAfi/View/Helper/Admin/Menus.php @@ -0,0 +1,107 @@ +<?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 ZendAfi_View_Helper_Admin_Menus extends Zendafi_View_Helper_Basehelper { + protected $_profil; + + public function menus() { + $this->_profil = Class_Profil::getCurrentProfil(); + + $datas = Class_Systeme_Widget_Menu::findAllAsArray($this->_profil->getId()); + + $html = [$this->_renderNav($datas['H'])]; + unset($datas['H']); + + foreach($datas as $id => $params) { + $params['libelle'] .= $this->_tagDeleteMenu($id); + $html[] = $this->_renderMenu($id, $params); + } + + return $this->_tag('div', + implode($html), + ['class' => 'menus']); + } + + + protected function _renderNav($params) { + $params['libelle'] = $params['libelle'] . $this->_tagDuplicateNav(); + return $this->_renderMenu('H', $params); + } + + + protected function _tagDuplicateNav() { + return $this->view->tagAnchor($this->view->url(['action' => 'duplicate-horizontal-menu']), + $this->view->tagImg(Class_Admin_Skin::current() + ->renderIconUrlOn('actions', + 'copy_module')), + ['onclick' => sprintf('if(!confirm(\'%s\'))return false;', + $this->_('Êtes vous sûr de vouloir dupliquer la configuration du menu horizontal à tous les autres profils ? Cela supprimera la configuration existante pour les autres profils')), + 'title' => $this->_('Dupliquer le menu horizontal à tous les autres profils')]); + } + + + protected function _tagDeleteMenu($id) { + return $this->view->tagAnchor($this->view->url(['controller' => 'widget', + 'action' => 'delete-menu', + 'id' => $id, + 'id_profil' => $this->_profil->getId()]), + $this->view->tagImg(Class_Admin_Skin::current() + ->renderIconUrlOn('actions', + 'delete')), + ['onclick' => sprintf('if(!confirm(\'%s\'))return false;', + $this->_('Êtes vous sûr de vouloir supprimer le menu ?')), + 'title' => $this->_('Supprimer le menu')]); + } + + + protected function _renderMenu($id, $params) { + return $this->_tag('div', $this->_tag('h4', + $this->view->tagEditMenu($id, $this->_profil->getId()) . + $params['libelle']) + . $this->_renderChildren($params['menus'], $id)); + } + + + protected function _renderChildren($children, $parent) { + if(empty($children)) + return ''; + + $html = []; + foreach($children as $key => $child) { + if(isset($child['id_module'])) + $key = $child['id_module']; + + $entry = + $this->view->tagEditMenu($key, $this->_profil->getId(), $parent) . + $child['libelle']; + + if(isset($child['sous_menus']) && (!empty($child['sous_menus']))) { + $entry .= $this->_renderChildren($child['sous_menus'], $parent); + } + + $html[] = $this->_tag('li', $entry); + } + + return $this->_tag('ul', + implode($html)); + } +} diff --git a/library/ZendAfi/View/Helper/Admin/PropertiesReader.php b/library/ZendAfi/View/Helper/Admin/PropertiesReader.php index 17282685ae6442c136a7466c8ede856170c7a3cb..bc01247514ec6ff69d30e4d8f3711b04012aa72a 100644 --- a/library/ZendAfi/View/Helper/Admin/PropertiesReader.php +++ b/library/ZendAfi/View/Helper/Admin/PropertiesReader.php @@ -55,7 +55,8 @@ class ZendAfi_View_Helper_Admin_PropertiesReader extends ZendAfi_View_Helper_Bas 'onclick' => "$(this).next().slideToggle();"]) . $this->_tag('div', $html, - ['id' => 'objet_props']); + ['id' => 'objet_props', + 'style' => 'display: none;']); } diff --git a/library/ZendAfi/View/Helper/Admin/RenderForm.php b/library/ZendAfi/View/Helper/Admin/RenderForm.php index a9df2bc23942a67c53841529d0475df5a89cef25..3fa8de0489ddf1bee4ccff9741a6398c187cbdb8 100644 --- a/library/ZendAfi/View/Helper/Admin/RenderForm.php +++ b/library/ZendAfi/View/Helper/Admin/RenderForm.php @@ -32,16 +32,31 @@ class ZendAfi_View_Helper_Admin_RenderForm extends ZendAfi_View_Helper_RenderFor $this->_tabify($form); + $this->_customizeRendering(); + return parent::renderForm($form, $buttons); } + protected function _tabify($form) { Class_ScriptLoader::getInstance()->formToTabs('#' . $form->getId()); } + protected function _customizeRendering() { + Class_Admin_Skin::current() + ->renderFormCssOn(Class_ScriptLoader::getInstance()) + ->renderJQueryCssOn(Class_ScriptLoader::getInstance()); + + return $this; + } + + protected function _cloneButtons($form) { + if($this->view->isPopup()) + return ''; + if(1 >= count($form->getDisplayGroups())) return $this; @@ -53,6 +68,9 @@ class ZendAfi_View_Helper_Admin_RenderForm extends ZendAfi_View_Helper_RenderFor protected function _renderDefaultButtons($form, $buttons = []) { + if($this->view->isPopup()) + $buttons = array_merge([$this->view->Button_Continue()], + $buttons); return $this->_tag('div', implode($buttons), ['class' => 'admin-buttons']); diff --git a/library/ZendAfi/View/Helper/AjaxRedirect.php b/library/ZendAfi/View/Helper/AjaxRedirect.php index b5b5732ec01201b46acb3a71a31e93660299416e..4e130b5c3d337a164e794a046deed8182cebcecf 100644 --- a/library/ZendAfi/View/Helper/AjaxRedirect.php +++ b/library/ZendAfi/View/Helper/AjaxRedirect.php @@ -22,6 +22,9 @@ class ZendAfi_View_Helper_AjaxRedirect extends ZendAfi_View_Helper_BaseHelper { public function ajaxRedirect() { + Class_Admin_Skin::current() + ->renderJQueryCssOn(Class_ScriptLoader::getInstance()); + return $this->_tag('div', $this->_tag('p', @@ -30,7 +33,7 @@ class ZendAfi_View_Helper_AjaxRedirect extends ZendAfi_View_Helper_BaseHelper { ['class' => 'saving-process']) . $this->_tag('script', - 'document.location.href = document.location.href;'); + 'location.reload();'); } } ?> \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Button/Continue.php b/library/ZendAfi/View/Helper/Button/Continue.php new file mode 100644 index 0000000000000000000000000000000000000000..765b91449119ef3b94136e83d31eed52175f343b --- /dev/null +++ b/library/ZendAfi/View/Helper/Button/Continue.php @@ -0,0 +1,53 @@ +<?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 ZendAfi_View_Helper_Button_Continue extends ZendAfi_View_Helper_Button_Submit { + public function Button_Continue($settings = null) { + $button = $this->_getDefaultButton($this->_getDefaultAttribs()); + + if($settings) + $button->updateAttributes($settings->toArray()); + + return $this->view->button($button); + } + + + protected function _getDefaultButton($attribs) { + return parent::_getDefaultButton($attribs) + ->setText($this->_('Valider et continuer')); + } + + + protected function _getDefaultAttribs() { + return array_merge(parent::_getDefaultAttribs(), + ['title' => $this->_('Enregistrer mes modifications et poursuivre mes modifications'), + 'class' => 'bouton continue']); + } + + + protected function _getAjax() { + return $this->view->isPopup() + ? sprintf('form.attr(\'action\', form.attr(\'action\') + \'/styles_reload/1\');%s', + parent::_getAjax()) + : ''; + } +} \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Button/Submit.php b/library/ZendAfi/View/Helper/Button/Submit.php index f74fe9736c2e318dca845516bd9d4df24b45fbc6..951cb26c75c6edde1b5a168a394463f732f04c40 100644 --- a/library/ZendAfi/View/Helper/Button/Submit.php +++ b/library/ZendAfi/View/Helper/Button/Submit.php @@ -32,18 +32,20 @@ class ZendAfi_View_Helper_Button_Submit extends ZendAfi_View_Helper_BaseHelper { protected function _getDefaultAttribs() { - $ajax = $this->view->isPopup() - ? 'initializeAjaxFormSubmit(form);' - : ''; - - return ['onclick' => sprintf("var form=$(this).parents('form'); if (!form.size()) form=$(this).parents('.boutons, .admin-buttons').prevAll('form');if (!form.size()) form=$(this).parents('.boutons, .admin-buttons').nextAll('form');%sform.submit(); return false;", - $ajax), + return ['onclick' => sprintf("var form=$(this).parents('form'); if (!form.size()) form=$(this).parents('.boutons, .admin-buttons').prevAll('form');if (!form.size()) form=$(this).parents('.boutons, .admin-buttons').nextAll('form');%sform.submit(); return false;", $this->_getAjax()), 'class' => 'bouton validate', 'type' => 'submit', 'title' => $this->_('Enregistrer mes modifications')]; } + protected function _getAjax() { + return $this->view->isPopup() + ? 'initializeAjaxFormSubmit(form);' + : ''; + } + + protected function _getDefaultButton($attribs) { return (new Class_Entity()) ->setText($this->_('Valider')) diff --git a/library/ZendAfi/View/Helper/DragAndDrop.php b/library/ZendAfi/View/Helper/DragAndDrop.php index 8ec3b164cbf89b93fea0bfdd6f828591ae23a5fc..26d4bf1b144fd9df8fc9a1f6d84f709e34fa3943 100644 --- a/library/ZendAfi/View/Helper/DragAndDrop.php +++ b/library/ZendAfi/View/Helper/DragAndDrop.php @@ -29,10 +29,15 @@ class ZendAfi_View_Helper_DragAndDrop extends ZendAfi_View_Helper_BaseHelper { $this->_entity = $entity; + if(!$this->_entity->getOptions()) + $this->_entity->setOptions(['sticky_available' => false]); + Class_ScriptLoader::getInstance() ->addOPACScript('input_connect_list/input_connect_list') ->addOPACStyleSheet('../js/input_connect_list/input_connect_list') - ->addJQueryReady(sprintf('$("[data-heading=%s]").draggableList();', $this->_entity->getId())); + ->addJQueryReady(sprintf('$("[data-heading=%s]").draggableList(%s);', + $this->_entity->getId(), + json_encode($this->_entity->getOptions()))); $html = [$this->_selectedItemsInline(), @@ -51,11 +56,13 @@ class ZendAfi_View_Helper_DragAndDrop extends ZendAfi_View_Helper_BaseHelper { protected function _selectedItemsInline() { $renderer = function($item) { - return $item->getLabel(); + return $this->_tag('span', + $item->getLabel(), + ['class' => 'selected']); }; return $this->_tag('p', - implode(',', $this->_eachDo($this->_entity->getSelected(), $renderer)), + implode($this->_eachDo($this->_entity->getSelected(), $renderer)), ['class' => 'show_drag_and_drop']); } @@ -111,6 +118,6 @@ class ZendAfi_View_Helper_DragAndDrop extends ZendAfi_View_Helper_BaseHelper { protected function _eachDo($items, $callback) { if(!$items) return []; - return array_unique(array_map($callback, $items)); + return array_map($callback, $items); } } \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/FonctionsAdmin.php b/library/ZendAfi/View/Helper/FonctionsAdmin.php index 48776671a5c19f9e5cb922b91674b8d8dc12c16f..808f9410bc4f8d6b7dcf840cecc085ee72325e8c 100644 --- a/library/ZendAfi/View/Helper/FonctionsAdmin.php +++ b/library/ZendAfi/View/Helper/FonctionsAdmin.php @@ -99,11 +99,11 @@ class ZendAfi_View_Helper_FonctionsAdmin extends ZendAfi_View_Helper_BaseHelper return ''; $url = $this->view->url(['module' => 'admin', - 'controller' => 'accueil', - 'action' => 'add-block', - 'id_module' => $this->id_module, + 'controller' => 'widget', + 'action' => 'add', + 'after' => $this->id_module, 'division' => $this->division, - 'id_profil' => $this->id_profil], + 'id_profil' => $this->_getIdProfil()], null, true); return $this->_renderActionLink('add_box', @@ -118,11 +118,11 @@ class ZendAfi_View_Helper_FonctionsAdmin extends ZendAfi_View_Helper_BaseHelper $label = $this->_('Supprimer'); $url = $this->view->url(['module' => 'admin', - 'controller' => 'accueil', - 'action' => 'delete-block', - 'id_module' => $this->id_module, + 'controller' => 'widget', + 'action' => 'delete', + 'id' => $this->id_module, 'division' => $this->division, - 'id_profil' => $this->id_profil], + 'id_profil' => $this->_getIdProfil()], null, true); $onclick = "return confirm('". htmlspecialchars($this->_('Êtes-vous sur de vouloir supprimer cette boîte ?')) . "');"; @@ -150,4 +150,15 @@ class ZendAfi_View_Helper_FonctionsAdmin extends ZendAfi_View_Helper_BaseHelper ['data-popup' => 'true', 'title' => $label]); } + + + protected function _getIdProfil() { + $id_profil = $this->id_profil; + + if(Class_Profil::DIV_BANNIERE == $this->division + && ($parent = Class_Profil::getCurrentProfil()->getParentProfil())) + $id_profil = $parent->getId(); + + return $id_profil; + } } \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/FonctionsAdmin/Boite.php b/library/ZendAfi/View/Helper/FonctionsAdmin/Boite.php index 778252e30fc337c88edac84d9a10ac2d3fc8019f..184e37485a7e5d2dd7ae14fcebbd9bfddf43d3e8 100644 --- a/library/ZendAfi/View/Helper/FonctionsAdmin/Boite.php +++ b/library/ZendAfi/View/Helper/FonctionsAdmin/Boite.php @@ -20,22 +20,11 @@ */ class ZendAfi_View_Helper_FonctionsAdmin_Boite extends ZendAfi_View_Helper_FonctionsAdmin { - public function fonctionsAdmin_Boite($id_module=0, $type_module=false) { - return parent::fonctionsAdmin($id_module, $type_module); - } - - protected function getPopupUrlParams() { - $module = Class_Systeme_ModulesAccueil::moduleByCode($this->type_module); - return ['module' => 'admin', - 'controller' => 'accueil', - 'action' => $module->getAction(), - 'config' => 'accueil', - 'id_profil' => $this->id_profil, - 'id_module' => $this->id_module, - 'type_module' => $this->type_module]; + 'controller' => 'widget', + 'action' => 'edit-widget', + 'id' => $this->id_module, + 'id_profil' => $this->_getIdProfil()]; } -} - -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/IframeContainer.php b/library/ZendAfi/View/Helper/IframeContainer.php index 2d42153059eb74d8cea9bdcc23ccdb4ddb6f7494..c54576baf1bb68af063a9530d8d60c460263a26d 100644 --- a/library/ZendAfi/View/Helper/IframeContainer.php +++ b/library/ZendAfi/View/Helper/IframeContainer.php @@ -28,10 +28,11 @@ class ZendAfi_View_Helper_IframeContainer extends ZendAfi_View_Helper_BaseHelper public function iframeContainer($largeur, $hauteur, $url_array, $preferences = []) { if ($preferences) { + unset($preferences['preferences']); foreach($preferences as $clef => $valeur) $this->_src_args[$clef] = urlencode($valeur); } - + unset($url_array['preferences']); $this->_url = $this->view->url($url_array, null, true); $this->_params = ['height' => $hauteur, diff --git a/library/ZendAfi/View/Helper/Menu/Boite.php b/library/ZendAfi/View/Helper/Menu/Boite.php index ed6d667281b5b046e896d5b126a95568130102ec..e701bbe9890f1b4a17f134a6e571b21741e4e145 100644 --- a/library/ZendAfi/View/Helper/Menu/Boite.php +++ b/library/ZendAfi/View/Helper/Menu/Boite.php @@ -16,17 +16,19 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class ZendAfi_View_Helper_Menu_Boite extends ZendAfi_View_Helper_BaseHelper { - protected + protected $_id_module, $_id_menu, - $_params; + $_params, + $_menu; public function __construct($id_module, $params) { parent::__construct(); + $this->_menu = $params; $this->_id_module = $id_module; $this->_params = $params; $this->_params['type_module'] = Class_Systeme_ModulesMenu::moduleAccueilType($params); @@ -40,16 +42,24 @@ class ZendAfi_View_Helper_Menu_Boite extends ZendAfi_View_Helper_BaseHelper { public function getBoite($li_class='') { - $helper = ZendAfi_View_Helper_Accueil_Base::getModuleHelperFromParams($this->_id_module, + $helper = ZendAfi_View_Helper_Accueil_Base::getModuleHelperFromParams($this->_id_module, $this->_params, $this->view); $helper->setView($this->view); - $helper->setFonctionAdminHelper('FonctionsAdmin_Menu'); + $helper->setFonctionAdminHelper(null); $helper->setIdMenu($this->_id_menu); - + $class = $li_class ? $li_class.' boite' : 'boite'; - return '<li class="'.$class.'">'.$helper->getBoite().'</li>'; + + return $this->_tag('li', + $helper->getBoite() . $this->_getEditLink(), + ['class' => $class]); } -} -?> \ No newline at end of file + + protected function _getEditLink() { + return $this->view->tagEditMenu($this->_menu['id_module'], + Class_Profil::getCurrentProfil()->getId(), + $this->_id_menu); + } +} \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Menu/Entry.php b/library/ZendAfi/View/Helper/Menu/Entry.php index e8c6b536fdc0f5f448287133f1573ccf4a7ebf76..22d5ec40d4157bd7c5bd85d30a9940d40891a1fd 100644 --- a/library/ZendAfi/View/Helper/Menu/Entry.php +++ b/library/ZendAfi/View/Helper/Menu/Entry.php @@ -20,12 +20,14 @@ */ class ZendAfi_View_Helper_Menu_Entry extends ZendAfi_View_Helper_Menu_Base { - protected $_type_module; - protected $_preferences; - protected $_sous_menus; + protected $_type_module, + $_preferences, + $_sous_menus, + $_menu; public function __construct($id_module,$params) { parent::__construct(); + $this->_menu = $params; $this->_type_module = $params['type_menu']; $this->_preferences = isset($params['preferences']) ? $params['preferences'] : []; $this->_picto = $params['picto']; @@ -47,15 +49,25 @@ class ZendAfi_View_Helper_Menu_Entry extends ZendAfi_View_Helper_Menu_Base { $li_class.= strpos($html,'selected_profil')>0 ? ' selected_profil' :''; - return $li_class - ? '<li class="'.$li_class.'">'.$html.'</li>' - : '<li>'.$html.'</li>'; + return $this->_tag('li', $html . $this->_getEditLink(), ['class' => $li_class]); + } + + + protected function _getEditLink() { + return $this->view->tagEditMenu($this->_menu['id_module'], + Class_Profil::getCurrentProfil()->getId(), + $this->_id_menu); } public function getTagAnchor() { $modMenus = new Class_Systeme_ModulesMenu(); - $params = $modMenus->getUrl($this->_type_module, $this->_preferences); + $preferences = $this->_menu; + + if(isset($preferences['preferences'])) + $preferences = array_merge($preferences, $preferences['preferences']); + + $params = $modMenus->getUrl($this->_type_module, $preferences); $url = $params['url']; $img_URL = URL_IMG.'menus/'; diff --git a/library/ZendAfi/View/Helper/MenuHorizontal.php b/library/ZendAfi/View/Helper/MenuHorizontal.php index 08cfb62b6e38329a2825f9512a76e4f4cec842fd..bba0b0381382897c95353a883d7f7c5c70eb93b0 100644 --- a/library/ZendAfi/View/Helper/MenuHorizontal.php +++ b/library/ZendAfi/View/Helper/MenuHorizontal.php @@ -18,11 +18,7 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// OPAC3 - Menu horizontal javascript -// -// Ressources : - Javascript : menu.js -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + class ZendAfi_View_Helper_MenuHorizontal extends ZendAfi_View_Helper_BaseHelper { private $profil; @@ -37,41 +33,27 @@ class ZendAfi_View_Helper_MenuHorizontal extends ZendAfi_View_Helper_BaseHelper public function renderMenus($menus, $tag_id="menu_horizontal") { + return $this->_tag('div', + $this->_editMenu() . $this->_getMenu($menus), + ['id' => $tag_id, + 'class' => 'menu_horizontal', + 'role' => 'navigation']); + } + + + protected function _getMenu($menus) { if(!count($menus)) - return $this->retourErreur($this->translate()->_("Ce menu ne contient aucune entrée.")); + return $this->_tag('p', $this->_("Ce menu ne contient aucune entrée.")); $helper = new ZendAfi_View_Helper_Menu_Menus($menus); $helper->setIdMenu('H'); $helper->setView($this->view); - - return '<div id="'.$tag_id.'" class="menu_horizontal" role="navigation">' - .$this->tagEditMenu() - .$helper->getBoite() - .'</div>'; + return $helper->getBoite(); } - public function tagEditMenu() { - if (!Class_Users::isCurrentUserAdmin()) - return ''; - - return $this->view->tagAnchor($this->view->url(['module' => 'admin', - 'controller' => 'profil', - 'action' => 'menusmaj', - 'id_profil' => $this->profil->getId(), - 'id_menu' => 'H', - 'mode' => 'edit']), - Class_Admin_Skin::current()->renderActionIconOn('edit', $this->view, - ['alt' => $this->view->translate("Modifier le menu"), - 'title' => $this->view->translate("Modifier le menu")]), - ['class' => 'edit_menu']); - } -//--------------------------------------------------------------------- -// Retour en erreur -//--------------------------------------------------------------------- - protected function retourErreur($erreur) { - return '<br/><span style="background-color:red;color:#FFFFFF;padding:3px;font-size:12px;font-weight:bold;width:auto">'.$erreur.'</span><br/>'; + protected function _editMenu() { + return $this->view->tagEditMenu('H', + $this->profil->getId()); } -} - -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/ModuleAbstract.php b/library/ZendAfi/View/Helper/ModuleAbstract.php index 3ebd2681723791d7278ec03aa4a239d3d56f1edb..5fe8d39f4cd693c4ed612353a9667883c7ac5769 100644 --- a/library/ZendAfi/View/Helper/ModuleAbstract.php +++ b/library/ZendAfi/View/Helper/ModuleAbstract.php @@ -31,7 +31,8 @@ abstract class ZendAfi_View_Helper_ModuleAbstract extends ZendAfi_View_Helper_Ba public function __construct($id_module,$params) { parent::__construct(); $this->id_module = $id_module; - $this->preferences = $params["preferences"]; + $this->preferences = array_merge($params['preferences'], + $params); } diff --git a/library/ZendAfi/View/Helper/RecordTabs.php b/library/ZendAfi/View/Helper/RecordTabs.php new file mode 100644 index 0000000000000000000000000000000000000000..ab48f6738ee4d851a734b0c69f10871bd76244f4 --- /dev/null +++ b/library/ZendAfi/View/Helper/RecordTabs.php @@ -0,0 +1,80 @@ +<?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 ZendAfi_View_Helper_RecordTabs extends ZendAfi_View_Helper_BaseHelper { + protected $_tabs; + + + public function recordTabs($tabs) { + if(!$this->_tabs = $tabs) + return ''; + + return $this->_tag('div', + $this->_tag('table', $this->_getTableHeader() . $this->_getTableContent())); + } + + + protected function _getTableHeader() { + $columns = [$this->_('Rubrique'), + $this->_('Style'), + $this->_('Ordre'), + $this->_('Titre'), + $this->_('Largeur')]; + $columns = array_map(function($title) {return $this->_tag('th', $title);}, $columns); + return $this->_tag('tr', implode($columns)); + } + + + protected function _getTableContent() { + $codif = Class_Codification::getInstance(); + foreach($this->_tabs as $clef => $valeurs) { + $nom_onglet = $codif->getNomOnglet($clef); + if (!$valeurs['titre']) + $valeurs['titre'] = $nom_onglet; + + $input = function($name, $size) use ($clef, $valeurs) { + return $this->_tag('input', null, + ['type' => 'text', + 'name' => $clef . '_' . $name, + 'size' => $size, + 'value' => $valeurs[$name]]); + }; + + $content = [$nom_onglet, + $this->view->formSelect($clef . '_aff', + $valeurs['aff'], + '', + [$this->_('Ne pas afficher'), + $this->_('Bloc déplié'), + $this->_('Bloc fermé'), + $this->_('Dans un onglet')]), + $input('ordre', 3), + $input('titre', 20), + $input('largeur', 3)]; + + $content = array_map(function($td) { return $this->_tag('td', $td);}, $content); + $html[] = $this->_tag('tr', implode($content)); + } + + return implode($html); + } +} diff --git a/library/ZendAfi/View/Helper/TagEditMenu.php b/library/ZendAfi/View/Helper/TagEditMenu.php new file mode 100644 index 0000000000000000000000000000000000000000..77c51d43b4457c79185d0935c408dd53c5199248 --- /dev/null +++ b/library/ZendAfi/View/Helper/TagEditMenu.php @@ -0,0 +1,61 @@ +<?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 ZendAfi_View_Helper_TagEditMenu extends ZendAfi_View_Helper_BaseHelper { + public function tagEditMenu($menu_id, $profile_id, $parent_id = null, $params = []) { + if (!Class_Users::isCurrentUserAllowedToEditProfile($profile_id)) + return ''; + + $menu = new Class_Systeme_Widget_Menu(); + if(!$menu + ->setId($menu_id) + ->setProfileId($profile_id) + ->setParent($parent_id) + ->load()) + return ''; + + if(!isset($params['backUrl'])) + $params['backUrl'] = $this->view->url(); + + $url_params = array_merge(['module' => 'admin', + 'controller' => 'widget', + 'action' => 'edit-menu', + 'id' => $menu->getId(), + 'id_profil' => $menu->getProfileId(), + 'parent' => $menu->getParent()], + $params); + + $ico = 'edit'; + $title = $this->_('Modifier l\'entrée : %s', $menu->getLabel()); + + if($menu->isMenu()) { + $title = $this->_('Modifier le menu : %s', $menu->getLabel()); + $ico = 'menu_configuration'; + } + + return $this->view->tagAnchor($this->view->url($url_params, null, true), + Class_Admin_Skin::current()->renderActionIconOn($ico, $this->view), + ['title' => $title, + 'data-popup' => 'true', + 'class' => 'edit_menu']); + } +} \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/TagObjetsImgProperties.php b/library/ZendAfi/View/Helper/TagObjetsImgProperties.php index 062b2d116082d3307e94ebaf72bf571e592fcc81..a8f1cec34cc3deb6826c4678007bcd3513945434 100644 --- a/library/ZendAfi/View/Helper/TagObjetsImgProperties.php +++ b/library/ZendAfi/View/Helper/TagObjetsImgProperties.php @@ -66,11 +66,13 @@ class ZendAfi_View_Helper_TagObjetsImgProperties extends ZendAfi_View_Helper_Bas private function getComboStyles($styles, $valeur_select) { - $onchange = 'var form=$(this).parents(\'form\'); if (!form.size()) form=$(this).parents(\'.boutons\').prevAll(\'form\');'; - $onchange .= 'initializeAjaxFormSubmit(form);'; - $onchange .= 'form.submit(); return false;'; + $submit_script = sprintf('$("select[name=\'style_liste\']").change(function() {$("#styles_reload").val("1");var form=$(this).closest("form"); %s form.submit();});', + $this->view->isPopup() ? 'initializeAjaxFormSubmit(form);' : ''); - $combo = '<select name="style_liste" onchange="'.$onchange.'">'; + Class_ScriptLoader::getInstance() + ->addJQueryReady($submit_script); + + $combo = '<select name="style_liste">'; $combo = $this->addOptGroupOn($combo, $this->translate()->_('Objets javascript'), diff --git a/library/ZendAfi/View/Helper/TagSlider.php b/library/ZendAfi/View/Helper/TagSlider.php index 5b5b211e9487678b1b3d224d05297e9125f4bbf6..6c895c456beacd576bfc7d07f4ee048c72bc6676 100644 --- a/library/ZendAfi/View/Helper/TagSlider.php +++ b/library/ZendAfi/View/Helper/TagSlider.php @@ -16,10 +16,10 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class ZendAfi_View_Helper_TagSlider extends ZendAfi_View_Helper_BaseHelper { - /** + /** * @param string $name * @param string $valeur_select * @param int $min @@ -43,7 +43,7 @@ class ZendAfi_View_Helper_TagSlider extends ZendAfi_View_Helper_BaseHelper { min: ' . $min . ', max: ' . $max . ', step: ' . $step . ', - slide: function(event, ui) {$("#' . $name . '").val(ui.value);' . $action . '} + slide: function(event, ui) {$("#' . $name . '").val(ui.value);' . $action . ';$(this).closest("form").find("input").change();} }); $("#' . $name . '").val($("#' . $id_slider . '").slider("value"));'); diff --git a/library/ZendAfi/View/Helper/UnimarcZoneConfig.php b/library/ZendAfi/View/Helper/UnimarcZoneConfig.php index a5b5eb4d0f681611bafbbb41d717a38ecf0dc5f9..42ed7c346a29e1a179c080f542daf3a7421b9dbf 100644 --- a/library/ZendAfi/View/Helper/UnimarcZoneConfig.php +++ b/library/ZendAfi/View/Helper/UnimarcZoneConfig.php @@ -24,13 +24,11 @@ class ZendAfi_View_Helper_UnimarcZoneConfig extends ZendAfi_View_Helper_BaseHelp protected $unimarc_type='links'; - public function unimarcZoneConfig($title,$preferences,$preference_field, $errors) { + public function unimarcZoneConfig($preferences,$preference_field, $errors) { if ($preference_field == 'thumbnail_fields') $this->unimarc_type='thumbnails'; - $content = $this->_tag('legend', $title); - $content .= $this->displayErrors($errors); - $content .= $this->renderMultiInput($preferences,$preference_field); - return $this->_tag('fieldset', $content); + + return $this->displayErrors($errors) . $this->renderMultiInput($preferences,$preference_field); } protected function displayErrors($errors) { diff --git a/library/digital_resources/Assimil/tests/AssimilTest.php b/library/digital_resources/Assimil/tests/AssimilTest.php index 97944a276e226ac9ffefa1ed487f7b2228257929..3c4dadecf3ca1e4b5dec3aa91b933dd9a18df06c 100644 --- a/library/digital_resources/Assimil/tests/AssimilTest.php +++ b/library/digital_resources/Assimil/tests/AssimilTest.php @@ -218,15 +218,6 @@ class AssimilActivatedAdminTest extends Admin_AbstractControllerTestCase { $this->assertEmpty(Class_UserGroup_Permission::findAllBy(['id_group' => 1])); $this->assertEquals([0,1], Class_UserGroup::find(1)->getRights()); } - - - /** @test */ - public function profilAvailableMenusShouldContainsAssimil() { - $this->dispatch('admin/profil/menusmaj/id_profil/5/id_menu/H/mode/edit', true); - $this->assertXPathContentContains('//option[@value="Assimil"]', - 'Lien vers Assimil', - $this->_response->getBody()); - } } diff --git a/public/admin/css/subModal.css b/public/admin/css/subModal.css index e5e3cec05dfed1eed5ed2e918c440d2de588c0a2..8a70a5cdc3715f05be6721e1a6b5e274b7bf43a9 100644 --- a/public/admin/css/subModal.css +++ b/public/admin/css/subModal.css @@ -58,22 +58,21 @@ cursor: pointer; } -body.admin a[data-popup="true"].image-loading-status { - display: inline-block; -} - a[data-popup="true"].image-loading-status { background-image: url(../images/patience.gif); - background-size: 1em; + background-size: 16px; background-position: center; background-repeat: no-repeat; + display: inline-block !important; min-width: 16px; min-height: 16px; overflow: hidden; color: transparent; -moz-transition: all 0s ease-out; -webkit-transition: all 0s ease-out; - + margin: 0 !important; + padding: 0 !important; + cursor: progress; } a[data-popup="true"].image-loading-status img { diff --git a/public/admin/js/config_menu.js b/public/admin/js/config_menu.js deleted file mode 100644 index dbacfbeb507a6397423bd9c8a4ad32c86351622c..0000000000000000000000000000000000000000 --- a/public/admin/js/config_menu.js +++ /dev/null @@ -1,277 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// OPAC 3 - Constitution du menu -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -//-------------------------------------------------------------------------- -// Variables initialisees dans menusMaj.phtml -//-------------------------------------------------------------------------- -var nIdMax=0; -var sPathIco; -var nIdProfil; -var nIdBib; -var sModules = new Array(); - -//-------------------------------------------------------------------------- -// Initialisation : attribution d'identifiants uniques -//-------------------------------------------------------------------------- -function initMenus() -{ - initModules(); - menu_container=getId("menu_container") - - var listItems = menu_container.getElementsByTagName('DIV'); - for(var no=0;no<listItems.length;no++) - { - if(listItems[no].id=="module") - { - nIdMax++; - listItems[no].id=nIdMax; - } - } -} - -//-------------------------------------------------------------------------- -// Mise a jour des proprietes -//-------------------------------------------------------------------------- -function majProprietes(oBouton,sUrl) { - oMenu=getDivMenu(oBouton); - sTypeMenu=oMenu.getAttribute("type_menu"); - sModule=sModules[sTypeMenu]; - if(!sModule || !sModule['action']) sModule=sModules['vide']; - - // Completer l'url avec l'id_module et les proprietes - sUrl+=sModule['action'] + '/render/popup'; - sUrl+='?id_profil='+ nIdProfil; - sUrl+='&id_bib=' + nIdBib; - sUrl+='&type_menu='+ sTypeMenu; - sUrl+='&id_module=' + oMenu.id; - sUrl+='&libelle=' + oMenu.getAttribute("libelle"); - sUrl+='&picto=' + oMenu.getAttribute("picto"); - sUrl+='&preferences=' + oMenu.getAttribute("preferences"); - opacDialogFromUrl(sUrl); -} - -//-------------------------------------------------------------------------- -// Retour de mise a jour des proprietes -//-------------------------------------------------------------------------- -function retourMajProprietes(nIdModule,sLibelle,sPicto,sPreferences) -{ - setFlagMaj(true); - oMenu=getId(nIdModule); - oMenu.setAttribute("libelle",sLibelle); - oMenu.setAttribute("picto",sPicto); - oMenu.setAttribute("preferences",sPreferences); - - oSpans=oMenu.getElementsByTagName('SPAN'); - for(i=0; i < oSpans.length; i++) if(oSpans[i].id=="libelle") break; - oSpans[i].innerHTML=sLibelle; - - oPictos=oMenu.getElementsByTagName('IMG'); - for(i=0; i < oPictos.length; i++) if(oPictos[i].id=="picto") break; - oPictos[i].src=sPathIco + sPicto; -} - -//---------------------------------------------------------------------------- -// Rend le noeud parent de type div -//---------------------------------------------------------------------------- -function getDivMenu(oObjet) -{ - oParent=oObjet; - while(true) - { - oParent=oParent.parentNode; - if(!oParent) { - alert("Erreur javascript : config_menu - Fonction : getDivMenu"); - return; - } - if(oParent.nodeName =="DIV") break; - } - return oParent; -} - -//---------------------------------------------------------------------------- -// Ajout d'une entree de menu -//---------------------------------------------------------------------------- -function addMenu() -{ - setFlagMaj(true); - oContainer=getId("menu_container"); - oMenu=getNewMenu("menu_vide"); - oContainer.appendChild(oMenu); -} -//---------------------------------------------------------------------------- -// Ajout d'une entree de sous-menu -//---------------------------------------------------------------------------- -function addSousMenu(oObjet) -{ - setFlagMaj(true); - oContainer=oObjet.parentNode; - oMenu=getNewMenu("sous_menu_vide"); - oContainer.appendChild(oMenu); -} -//---------------------------------------------------------------------------- -// Creation d'un nouveau menu ou sous_menu -//---------------------------------------------------------------------------- -function getNewMenu(sModele) -{ - oMenuVide=getId(sModele); - oMenu=document.createElement('div'); - oMenu.style.display="block"; - nIdMax++; - oMenu.id=nIdMax; - oMenu.setAttribute("type_menu",oMenuVide.getAttribute("type_menu")); - oMenu.setAttribute("picto",oMenuVide.getAttribute("picto")); - oMenu.setAttribute("libelle",oMenuVide.getAttribute("libelle")); - oMenu.setAttribute("preferences",oMenuVide.getAttribute("preferences")); - oMenu.innerHTML=oMenuVide.innerHTML; - return oMenu; -} - -//---------------------------------------------------------------------------- -// Supression d'une entree de menu -//---------------------------------------------------------------------------- -function deleteMenu(oBouton) -{ - setFlagMaj(true); - oMenu=getDivMenu(oBouton); - oNode=oMenu.parentNode; - oNode.removeChild(oMenu); -} - -//---------------------------------------------------------------------------- -// Monter une entree de menu -//---------------------------------------------------------------------------- -function monterMenu(oBouton) -{ - oMenu=getDivMenu(oBouton); - oPrecedent=oMenu.previousSibling; - if(!oPrecedent.id) return; - swapMenus(oMenu,oPrecedent); - setFlagMaj(true); -} - -//---------------------------------------------------------------------------- -// Descendre une entree de menu -//---------------------------------------------------------------------------- -function descendreMenu(oBouton) -{ - oMenu=getDivMenu(oBouton); - oSuivant=oMenu.nextSibling; - if(!oSuivant.id) return; - swapMenus(oMenu,oSuivant); - setFlagMaj(true); -} - -//---------------------------------------------------------------------------- -// Swapper 2 entrees de menu -//---------------------------------------------------------------------------- -function swapMenus(oMenu1,oMenu2) -{ - oSaveMenu1=oMenu1.cloneNode(true); - oSaveMenu2=oMenu2.cloneNode(true); - oContainer=oMenu1.parentNode; - oContainer.replaceChild(oSaveMenu2,oMenu1); - oContainer.replaceChild(oSaveMenu1,oMenu2); -} - -//---------------------------------------------------------------------------- -// Supression d'une entree de menu -//---------------------------------------------------------------------------- -function setTypeMenu(oCombo) -{ - setFlagMaj(true); - oMenu=getDivMenu(oCombo); - sLibelle=oCombo.options[oCombo.selectedIndex].text; - oMenu.setAttribute("type_menu",oCombo.value); - oMenu.setAttribute("preferences",""); - - // Maj du libelle - oSpans=oMenu.getElementsByTagName('SPAN'); - for(i=0; i < oSpans.length; i++) if(oSpans[i].id=="libelle") break; - - //on ne change le libelle que si il n'a jamais été changé - var currentLibelle = oSpans[i].innerHTML; - if (currentLibelle == getId("menu_vide").getAttribute("libelle") || - currentLibelle == getId("sous_menu_vide").getAttribute("libelle")) { - oMenu.setAttribute("libelle",sLibelle); - oSpans[i].innerHTML=sLibelle; - } - - // Affichage bloc des sous-menus - oContainer=oMenu.firstChild; - while(oContainer != null) - { - oContainer=oContainer.nextSibling; - if(!oContainer || !oContainer.getAttribute) continue; - if(oContainer.id == "sous_menu") break; - } - if(oCombo.value =="MENU") sDisplay="block"; else sDisplay="none"; - oContainer.style.display=sDisplay; -} - -//-------------------------------------------------------------------------- -// Recup des donnees -//-------------------------------------------------------------------------- -function saveMenu() -{ - setFlagMaj(false); - // Entrées principales - oMenu=menu_container.firstChild; - var nIndexMenu=0; - while(oMenu != null) - { - oMenu=oMenu.nextSibling; - if(!oMenu || !oMenu.getAttribute) continue; - sTypeMenu=oMenu.getAttribute("type_menu"); - if(!sTypeMenu) continue; - - nIndexMenu++; - sName="menu_properties[" + nIndexMenu + "]"; - getItemMenu(sName,oMenu); - - // Sous-menus - if(sTypeMenu != "MENU") continue; - - // Cherche le container - oContainer=oMenu.firstChild; - while(oContainer != null) - { - oContainer=oContainer.nextSibling; - if(!oContainer || !oContainer.getAttribute) continue; - if(oContainer.id == "sous_menu") break; - } - - // Parser les entrees - var nIndexSousMenu=0; - oSousMenu=oContainer.firstChild; - while(oSousMenu != null) - { - oSousMenu=oSousMenu.nextSibling; - if(!oSousMenu || !oSousMenu.getAttribute) continue; - sTypeMenu=oSousMenu.getAttribute("type_menu"); - if(!sTypeMenu) continue; - - nIndexSousMenu++; - sName="sous_menu_properties[" + nIndexMenu + "][" + nIndexSousMenu + "]"; - getItemMenu(sName,oSousMenu); - } - } -} - -function getItemMenu(sName,oDiv) -{ - // On cree un element <input hidden> pour renvoyer au php - oProperty=document.createElement('input'); - oProperty.setAttribute('type','hidden'); - oProperty.name=sName; - oProperty.value ="type_menu=" + oDiv.getAttribute("type_menu") + ";"; - oProperty.value +="libelle=" + oDiv.getAttribute("libelle") + ";"; - oProperty.value +="picto=" + oDiv.getAttribute("picto") + ";"; - oProperty.value +="preferences=" + oDiv.getAttribute("preferences"); - - oForm=getId("form_menu"); - oForm.appendChild(oProperty); -} - -// Initialiser les objets au form load -$(document).ready(initMenus); diff --git a/public/admin/js/onload_utils.js b/public/admin/js/onload_utils.js index d2ef3bd4f457bf595f4530d7d0a738549435fe87..ab4611e15f4d691ba464da45f60de3f32801ee6c 100644 --- a/public/admin/js/onload_utils.js +++ b/public/admin/js/onload_utils.js @@ -73,6 +73,7 @@ var setupAnchorsTarget = function() { var autoHideShowConfigurationModule = function() { autoHideShowTagOnParentHover('.configuration_module', 'div.boite'); autoHideShowTagOnParentHover('a[class^="edit_"]', 'div.boite'); + autoHideShowTagOnParentHover('a[class^="edit_"]', 'div.menu_horizontal'); autoHideShowTagOnParentHover('.select_kiosque_form', 'div.boite'); autoHideShowTagOnParentHover('.newsadd', 'div.boite'); autoHideShowTagOnParentHover('.default_filters', 'div.boite'); diff --git a/public/admin/js/treeselect/treeselect.css b/public/admin/js/treeselect/treeselect.css index ca6a88f4a5391bb5463fc8748af7c2c5d42f4565..f6006b35717ae6bc0a3ed1c16446c28baf9bde57 100644 --- a/public/admin/js/treeselect/treeselect.css +++ b/public/admin/js/treeselect/treeselect.css @@ -9,13 +9,19 @@ vertical-align: top; } +.ui-treeselect-items-tree, +.ui-treeselect-selected-items { + max-height: 300px; + overflow-y: auto; +} + + .ui-treeselect-items-tree { width: 65%; } .ui-treeselect-selected-items { width: 35%; - margin-top: 2.5em; } .ui-treeselect ul { @@ -39,14 +45,6 @@ text-decoration: none; } -.ui-treeselect-selected-items > div, -.ui-treeselect-items-tree > div { - margin: 0px; - max-height: 300px; - overflow: auto; - padding: 0.5em !important; -} - .ui-treeselect-selected-items li:hover { cursor: pointer; } @@ -88,8 +86,7 @@ } .ui-treeselect-selected-items-inner { - padding: 10px; - overflow-y: auto; + margin-left: 1em; } .ui-treeselect-selected-items-inner ul { diff --git a/public/admin/js/treeselect/treeselect.js b/public/admin/js/treeselect/treeselect.js index a54010fce3faabfbd1c641d01b18e26834c842ad..1927395e9f12a8f612b83673c9fad67524ce5ed6 100644 --- a/public/admin/js/treeselect/treeselect.js +++ b/public/admin/js/treeselect/treeselect.js @@ -298,7 +298,7 @@ this._findConnectedIn(li, this.selectedItems). hide('fast', function(){ $(this).remove()}); - + li.children('input').removeAttr('checked'); li.find("li input").removeAttr('disabled'); li.children('a').removeClass('ui-state-active'); @@ -372,6 +372,7 @@ self._deselect( self._findConnectedIn($(event.target).parent(), self.itemsTree)); + self.itemsTree.closest('form').find('input').first().change(); }); li.parents('li').andSelf().children('a').addClass('ui-state-active'); diff --git a/public/admin/skins/bokeh74/buttons.css b/public/admin/skins/bokeh74/buttons.css index d04b72838543d2daa9c6cfd9ef9e7e244140278f..fa600ef0b99267ec8b7a3f207d62afa9206e65ef 100644 --- a/public/admin/skins/bokeh74/buttons.css +++ b/public/admin/skins/bokeh74/buttons.css @@ -1,5 +1,6 @@ .admin-button:disabled, .admin-button:disabled:hover { + color: var(--anchor); background-color: var(--button-disabled); cursor: no-drop; } @@ -18,9 +19,9 @@ .admin-button { display: inline-block; - margin: 0.5em 1em; + margin: 0.3em 1em; line-height: 2em; - padding: 0 2em; + padding: 0 1em; text-align: center; transition: background 0.4s; border: none; @@ -28,7 +29,7 @@ } .admin-button > img { - margin-right: 1.5em; + margin-right: 1em; vertical-align: middle; } @@ -39,4 +40,4 @@ div.admin-buttons { .admin-button.image-loading-status { background-position: 1em; overflow: visible; -} \ No newline at end of file +} diff --git a/public/admin/skins/bokeh74/colors.css b/public/admin/skins/bokeh74/colors.css index 7176818a1f43cb61de509bbaa37fa24330ec958e..2d7af7a0ff29f24310628558a84d9f5e0165a995 100644 --- a/public/admin/skins/bokeh74/colors.css +++ b/public/admin/skins/bokeh74/colors.css @@ -41,4 +41,6 @@ --current-version-background: rgba(0, 255, 0, 0.33); --previous-version-background: rgba(255, 0, 0, 0.33); + + --edition-background: rgba(255, 255, 0, 0.5); } diff --git a/public/admin/skins/bokeh74/colors/blue.css b/public/admin/skins/bokeh74/colors/blue.css index 27752a76faee0a0918dc5e42473712bb661886a8..26d103ab556fb8804ae5fc5bdf0c1ef13c8625c8 100644 --- a/public/admin/skins/bokeh74/colors/blue.css +++ b/public/admin/skins/bokeh74/colors/blue.css @@ -3,4 +3,7 @@ --line-highlight: rgba(0, 80, 175, 0.15); --anchor: rgba(0, 80, 175, 0.6); --nav-background: rgba(0, 80, 175, 0.8); + --button-background: var(--anchor); + --button-background-highlight: var(--nav-background); + --button-disabled: var(--line-highlight); } \ No newline at end of file diff --git a/public/admin/skins/bokeh74/colors/green.css b/public/admin/skins/bokeh74/colors/green.css index d515786b59411c4754d5875b36a06df0a0697c38..8d186dbb08ca3decf6ceea2ef7f252c6a77a8d07 100644 --- a/public/admin/skins/bokeh74/colors/green.css +++ b/public/admin/skins/bokeh74/colors/green.css @@ -3,4 +3,7 @@ --line-highlight: rgba(7, 111, 21, 0.15); --anchor: rgba(7, 111, 21, 0.6); --nav-background: rgba(7, 111, 21, 0.8); + --button-background: var(--anchor); + --button-background-highlight: var(--nav-background); + --button-disabled: var(--line-highlight); } \ No newline at end of file diff --git a/public/admin/skins/bokeh74/colors/orange.css b/public/admin/skins/bokeh74/colors/orange.css index f22ca64c5018cbaffa74b2f760fda98d4172636f..9ee0e3c7b5f9a638fc2f464b996b368a2de7e324 100644 --- a/public/admin/skins/bokeh74/colors/orange.css +++ b/public/admin/skins/bokeh74/colors/orange.css @@ -3,4 +3,7 @@ --line-highlight: rgba(159, 104, 9, 0.15); --anchor: rgba(159, 104, 9, 0.6); --nav-background: rgba(159, 104, 9, 0.8); + --button-background: var(--anchor); + --button-background-highlight: var(--nav-background); + --button-disabled: var(--line-highlight); } \ No newline at end of file diff --git a/public/admin/skins/bokeh74/colors/purple.css b/public/admin/skins/bokeh74/colors/purple.css index 901eb5beb455d32470eba82081771c9cc6b2ff73..523a86df60037db40f151482fa3c7a6ca8b73c30 100644 --- a/public/admin/skins/bokeh74/colors/purple.css +++ b/public/admin/skins/bokeh74/colors/purple.css @@ -3,4 +3,7 @@ --line-highlight: rgba(127, 7, 113, 0.15); --anchor: rgba(127, 7, 113, 0.6); --nav-background: rgba(127, 7, 113, 0.8); + --button-background: var(--anchor); + --button-background-highlight: var(--nav-background); + --button-disabled: var(--line-highlight); } \ No newline at end of file diff --git a/public/admin/skins/bokeh74/colors/red.css b/public/admin/skins/bokeh74/colors/red.css index 3a7acca6e01c4c71138ed5a665c020e1a88a1012..ef42339cd6c4d5d3a1cc665e2104e1f8ac383275 100644 --- a/public/admin/skins/bokeh74/colors/red.css +++ b/public/admin/skins/bokeh74/colors/red.css @@ -3,4 +3,7 @@ --line-highlight: rgba(143, 17, 17, 0.15); --anchor: rgba(143, 17, 17, 0.6); --nav-background: rgba(143, 17, 17, 0.8); + --button-background: var(--anchor); + --button-background-highlight: var(--nav-background); + --button-disabled: var(--line-highlight); } \ No newline at end of file diff --git a/public/admin/skins/bokeh74/colors/solarized_dark.css b/public/admin/skins/bokeh74/colors/solarized_dark.css index 94b468fe242c114c71384a18150b13201851ab34..9bfdc66c948c2f76a23f26b9b1dc459943598414 100644 --- a/public/admin/skins/bokeh74/colors/solarized_dark.css +++ b/public/admin/skins/bokeh74/colors/solarized_dark.css @@ -26,4 +26,8 @@ .modules .tablesorter-default { background-color: #fdf6e3; -} \ No newline at end of file +} + +.admin-form .cke_button_icon { + filter: invert(); +} diff --git a/public/admin/skins/bokeh74/config.json b/public/admin/skins/bokeh74/config.json index 8fdbc9676f5af39003cac62597b95fc0cf668ce0..ec94399f11f409aa9a8b5406b1f25c0d0eb511bf 100644 --- a/public/admin/skins/bokeh74/config.json +++ b/public/admin/skins/bokeh74/config.json @@ -100,7 +100,7 @@ "admin_configuration": "icons/actions/fonctions_admin_24.png", "box_configuration": "icons/actions/fonctions_admin_16.png", - "menu_configuration": "../../images/picto/menus.png", + "menu_configuration": "icons/actions/menus.png", "module_configuration": "icons/actions/module_16.png", "help": "icons/actions/help_16.png", diff --git a/public/admin/skins/bokeh74/form.css b/public/admin/skins/bokeh74/form.css new file mode 100644 index 0000000000000000000000000000000000000000..d5cf63bc54b97c6efe04577dd11682398d13f874 --- /dev/null +++ b/public/admin/skins/bokeh74/form.css @@ -0,0 +1,132 @@ +.admin-form [class^="cke_"], +.admin-form, +.admin-form a, +.admin-form h4, +.admin-form ul, +.admin-form fieldset, +.admin-form select, +.admin-form input { + color: var(--main-text); + background: var(--widget-background); +} + +.admin-form .input_connect_list h2 { + color: var(--main-text); + background: var(--main-background); +} + +.admin-form input { + height: auto; + width: auto; +} + +.admin-form * { + font-family: arial, sans-serif; + font-size: 1em; +} + +.admin-form fieldset { + border: 0; + margin: 0; +} + +.admin-form select, +.admin-form td > input[type='text'] { + width: 15em; +} + +.admin-form [size] { + width: auto !important; +} + +.admin-form tr { + line-height: 1.5em; +} + +.admin-form { + padding: 0; +} + +.admin-form td.droite { + width: 15em; +} + +.admin-form fieldset { + overflow-y: auto; +} + +.admin-form table { + width: 100%; +} + +.admin-form [type="checkbox"] { + -webkit-appearance: checkbox; +} + +.content_edit_head dt, +.content_edit_head dd { + display: inline-block; + margin: 0; +} + +.content_edit_head dt { + font-weight: bold; + padding-right: 0.3em; +} + +.content_edit_head dd { + padding-right: 1em; +} + +.content_edit_head dl { + margin: 0.3em 0; +} + +.content_edit_head img { + height: 16px; + margin: 0 0.3em; +} + +.current_edition:after { + content: ''; + cursor: progress; + height: 100%; + width: 100%; + position: absolute; + background: var(--edition-background); + background-position: center; + background-repeat: no-repeat; + z-index: 100; + display: block; + top: 0; + left: 0; + filter: blur(2px); +} + +.admin-form #liste_picto_picto td { + width: 20px; +} + +.admin-form #liste_picto_picto td img { + width: 16px; + height: 16px; +} + +.admin-form table td { + border: none !important; +} + +.admin-form table td.gauche > *, +.admin-form table td.gauche { + text-align: left !important; +} + +.admin-form table td.droite > *, +.admin-form table td.droite { + text-align: right !important; +} + +.current_edition .configuration_module { + display: block !important; + opacity: 1 !important; +} \ No newline at end of file diff --git a/public/admin/skins/bokeh74/global.css b/public/admin/skins/bokeh74/global.css index b7e376e9ba1db51714ee6d1c78f28274af2731e0..280ab9bf27f6289b1a9bf7e36846b30f7e079289 100755 --- a/public/admin/skins/bokeh74/global.css +++ b/public/admin/skins/bokeh74/global.css @@ -62,6 +62,8 @@ td[id*="menu_item"] { background-color: var(--even-line-highlight); } +.modules .menus > div:hover, +.modules .menus > div li:hover, [class*=edit-multiple] .modules form tr:hover, .modules .profils ul li li:hover, .modules [class*="models"] tbody tr:hover, @@ -142,6 +144,7 @@ td[id*="menu_item"] { /* shadows */ +.modules .menus > div, .selected_items_widget > div, .main > .left > *, .main > .modules { @@ -876,3 +879,44 @@ tr.modified label, .toggle_video.on { background-image: url('icons/actions/fermer_24.png'); } + +.modules .menus ul { + padding-left: 2em; +} + +.modules .menus > div img { + height: 16px; + width: 16px; +} + +.modules .menus { + text-align: center; +} + +.modules .menus > div { + display: inline-block; + width: 40%; + overflow: hidden; + vertical-align: top; + text-align: left; +} + +.profils.form { + margin: 1em 0; + max-height: 15em; + overflow-y: auto; + overflow-x: hidden; +} + +.modules .menus h4 { + margin: 0.5em; +} + +.modules .menus a { + margin: 0 0.3em; +} + +.modules .menus > div { + padding: 0.5em; + margin: 0.5em; +} diff --git a/public/admin/skins/bokeh74/icons/actions/menus.png b/public/admin/skins/bokeh74/icons/actions/menus.png new file mode 100644 index 0000000000000000000000000000000000000000..7a84a7bb65128d1acbfc445b533c54b71500e44f Binary files /dev/null and b/public/admin/skins/bokeh74/icons/actions/menus.png differ diff --git a/public/admin/skins/bokeh74/jquery.css b/public/admin/skins/bokeh74/jquery.css new file mode 100644 index 0000000000000000000000000000000000000000..af98161df7ec68d72bc483138e52b6d4f498b542 --- /dev/null +++ b/public/admin/skins/bokeh74/jquery.css @@ -0,0 +1,171 @@ +body .ui-dialog , +body .ui-accordion-header, +body .ui-widget-content, +body .ui-widget-content .ui-state-active, +body .ui-widget-content .ui-state-default, +body .ui-accordion .ui-accordion-header, +body .ui-accordion .ui-accordion-header a { + color: var(--main-text); + background: var(--widget-background); +} + +body .ui-tabs .ui-tabs-panel { + background: var(--main-background); +} + +body .ui-dialog-titlebar { + background: var(--nav-background) !important; +} + +body .ui-dialog-titlebar .ui-dialog-title { + color: var(--nav-text); +} + +body .ui-treeselect-search span { + color: var(--main-text); +} + +body .ui-widget-content { + padding: 0; +} + +body .ui-dialog { + box-shadow: 0 0 15px var(--widget-shadow); + border: 2px solid var(--nav-background); + border-radius: 0; +} + +body .ui-tabs .ui-tabs-panel, +body [class*='ui-corner']:not(.ui-dialog) { + border: none; + border-radius: 0; +} + +body .ui-tabs .ui-tabs-nav { + background: var(--main-background); +} + +body .ui-tabs .ui-tabs-nav > .ui-state-default > a { + color: var(--anchor); + cursor: pointer; + line-height: 1em; + margin: 0; + padding: 0.3em; + padding-left: 1.5em; +} + +body .ui-tabs .ui-tabs-nav > .ui-tabs-active > a { + background: var(--anchor); + color: var(--button-highlight); +} + +body .ui-tabs .ui-tabs-nav > .ui-state-default > a:before { + background-image: url('icons/actions/ouvrir_24.png'); + background-repeat: no-repeat; + background-size: 0.8em; + background-position: left center; + content: ''; + display: inline; + filter: opacity(50%); + height: 1em; + position: absolute; + width: 1em; + left: 5px; + top: 3px; + transition: all 0.4s; + transform: rotate(-90deg); +} + +body .ui-tabs .ui-tabs-nav > .ui-tabs-active > a:before { + filter: invert(); + transform: rotate(0deg); +} + +.ui-dialog .zend_form, +.ui-dialog fieldset { + margin: 0; + padding: 0; + text-align:center; +} + +.ui-dialog form label { + margin-right: 10px; +} + + +.ui-dialog fieldset td.gauche { + text-align: left; +} + +.ui-dialog fieldset td.droite { + text-align: right; +} + + +.ui-dialog fieldset legend { + text-align: left; +} + +.ui-dialog .zend_form dd{ + margin-left:0px; +} + +.ui-dialog .ajout-result { + text-align:center; +} + +.ui-dialog .ajout-result span { + display:block; + padding:5px; +} + +.ui-dialog .ajout-result a, .ui-dialog .ajout-result a:visited { + padding:5px; + text-decoration: underline; + border:none; + display:inline-block; +} + +.ui-dialog .ajout-result span a:first-child { + display:none; +} + +#opac-dialog div.popup-content { + padding: 5px; + max-width: 500px; + text-align: center; +} + +#opac-dialog div.popup-content p { + text-align: justify; +} + +#opac-dialog div.popup-content, +#opac-dialog div.popup-content * { + vertical-align: middle; +} + +#opac-dialog .boutons { + margin-top: 2em; + text-align: center; +} + +body .ui-accordion .ui-accordion-header { + border-radius: 0; + padding: 0.2em; + margin: 0; + padding-left: 1.5em; +} + + +body .ui-state-active .ui-accordion-header-icon { + transform: rotate(-90deg); +} + +body .ui-front { + z-index: 101; +} + +body .ui-dialog .show_drag_and_drop { + max-height: 2em; +} \ No newline at end of file diff --git a/public/opac/css/global.css b/public/opac/css/global.css index e74c0c0387484d5987f604f0ef9d9e25d8cf70b0..7d61e668e972dd13654b453abb6c0715cb502503 100644 --- a/public/opac/css/global.css +++ b/public/opac/css/global.css @@ -38,7 +38,7 @@ a { .configuration_module, .configuration_module + .newsadd, .configuration_module + .default_filters { - z-index: 1000; + z-index: 101; position: relative; height: 0px; float: right; @@ -54,7 +54,7 @@ a { margin-right:25px; position:relative; height:0px; - z-index:1000; + z-index:100; } .select_kiosque_form form input[type="submit"] { @@ -403,6 +403,10 @@ table.calendar_table td { /* Menu vertical */ +.boite.menu_vertical ul li { + position: relative; +} + ul.menuGauche { overflow: hidden; } @@ -452,7 +456,7 @@ div.conteneur2colonnes>div>div { position: relative; top: -35px; margin-right: 10px; - z-index: 110; + z-index: 101; } div#open_accessibility { @@ -971,7 +975,8 @@ a[class^="edit_"] { .edit_menu { - left: 0px; + left: 0; + top: 0; } .edit_album { @@ -1054,6 +1059,9 @@ a[class^="edit_"] { } +.boite, +article, +.colContenu, .kiosque .titre, .kiosque .contenu, .boite.kiosque { @@ -1362,7 +1370,7 @@ div.ui-sortable-placeholder { display: block; width: 20px; height: 80px; - z-index: 100; + z-index: 101; position: absolute; } @@ -1394,7 +1402,7 @@ div.ui-sortable-placeholder { text-align: center; line-height: 2em; position: absolute; - z-index: 1000; + z-index: 101; background-color: #ddd; width: 100%; box-shadow: 5px 0px 10px rgba(0,0,0,0.5); @@ -1581,6 +1589,7 @@ body.abonne_multimedia-hold-view .actions a { text-align:right; } +.boite.menu_vertical, #menu_horizontal { position: relative; } @@ -1656,7 +1665,7 @@ body.abonne_multimedia-hold-view .actions a { /** liste mur **/ .liste_mur { - float: left; + display: inline-block; width: 100%; } @@ -1671,7 +1680,8 @@ body.abonne_multimedia-hold-view .actions a { .liste_mur .notice_wrapper, .domains.liste_mur > div > div { - float: left; + display: inline-block; + vertical-align: top; height: 150px; width: 100px; margin: 10px auto 0px auto; @@ -1728,7 +1738,7 @@ body.abonne_multimedia-hold-view .actions a { top: 86px; left: 0px; background-color: white; - z-index: 100; + z-index: 101; padding: 5px; border-radius: 0 5px 5px 5px; min-width: 400px; @@ -2289,7 +2299,7 @@ button.vodeclic_link + img { .notice-mur-tooltip { position:absolute; - z-index:90; + z-index: 101; overflow:hidden; width: 110px; } @@ -2546,8 +2556,6 @@ form.zend_form.reservation_pickup label { margin-bottom: 5px; } - - div table.tablesorter thead tr th { background-color: rgb(230, 238, 238); border: none; @@ -2555,19 +2563,6 @@ div table.tablesorter thead tr th { padding: 0px 15px 0px 0px; } -div.ui-dalog.ajout-panier { - background-color: #ccc; -} - -div.ui-dialog-titlebar { - font-size:1.2em; - color: inherit; -} - -.ui-dialog #opac-dialog { - font-size:1em; -} - .ajout-panier .zend_form { border: none; vertical-align:middle; @@ -2594,84 +2589,10 @@ div.ui-dialog-titlebar { margin-left:15px; } -.ui-dialog.ui-widget { - z-index: 1001; -} - -.ui-dialog .zend_form, -.ui-dialog fieldset { - margin:5px 0px; - text-align:center; -} - -.ui-dialog form label { - margin-right: 10px; -} - - -.ui-dialog fieldset td.gauche { - text-align: left; -} - -.ui-dialog fieldset td.droite { - text-align: right; -} - - -.ui-dialog fieldset legend { - text-align: left; -} - -.ui-dialog .zend_form dd{ - margin-left:0px; -} - -.ui-dialog .zend_form select { - font-size:1.250em; - width:350px; -} - -.ui-dialog input, -.ui-dialog button { - font-size: 1.2em; -} - -.ui-dialog h1{ - font-size:1.3em; -} - -.ui-dialog input:hover{ - color:black; -} - -.ui-dialog .ajout-result { - text-align:center; -} - -.ui-dialog .ajout-result span { - display:block; - padding:5px; - font-size:1.2em; -} - -.ui-dialog .ajout-result a, .ui-dialog .ajout-result a:visited { - padding:5px; - text-decoration: underline; - border:none; - display:inline-block; -} - -.ui-dialog .ajout-result span a:first-child { - display:none; -} - -.ui-widget-header { - color: black; -} div#ZFDebug { - z-index: 900; + z-index: 101; display: none; } @@ -2696,7 +2617,7 @@ table.tablesorter span { #menuAdmin { position: fixed; top: 0px; - z-index: 500; + z-index: 101; padding: 5px; border-bottom-right-radius: 5px; box-shadow: 2px 2px 5px; @@ -2920,7 +2841,7 @@ div.boite.panier #maj_titre_panier form input { .colFlottant { position: fixed; overflow:visible!important; - z-index:1000; + z-index: 100; top: 100px; left: 0px; } @@ -3252,59 +3173,6 @@ a.loan-export { padding: 0 20px; } - -#opac-dialog a.button { - display: inline-block; - text-align: center; - padding: 2px 5px; - border-radius: 5px; - line-height: 2em; - margin: 5px; - font-size: 1.2em; - font-weight: bold; - min-width: 60px; - text-transform: uppercase; - text-shadow: 0px -1px 1px rgba(0, 0, 0, 0.25); - cursor: pointer; - color: #FFF; - white-space: nowrap; -} - -#opac-dialog a.button.blue { - background: #008CFF; -} - - -#opac-dialog a.button.red { - background: #DF1B1B; -} - - -#opac-dialog a.button.blue:hover { - background: #004F8F; -} - - -#opac-dialog a.button.red:hover { - background: #8F1111; -} - -#opac-dialog div.popup-content { - padding: 5px; - max-width: 500px; - text-align: center; -} - -#opac-dialog div.popup-content p { - text-align: justify; -} - -#opac-dialog div.popup-content, -#opac-dialog div.popup-content * { - vertical-align: middle; -} - - .dilicom-action { padding: 5px; margin: 10px; @@ -3372,35 +3240,6 @@ dd.picture { width: 69%; } -#opac-dialog .boutons { - margin-top: 2em; - text-align: center; -} - - -#opac-dialog .boutons > div { - display: inline-block; - text-align: center; - background-color: rgba(0,0,0,0.6); - margin: 0.5em 10px; - max-width: 300px; - height:30px; -} - -#opac-dialog .boutons > div:hover { - background-color:rgba(0, 0 , 0 , 0.8); -} - -#opac-dialog .boutons > div a { - display: inline-block; - color:white; - vertical-align:middle; -} - -#opac-dialog .boutons .bouton td { - background:transparent!important; -} - div.bouton > * { visibility: hidden; } @@ -3479,7 +3318,7 @@ th.actions { position: absolute; transition-duration: .5s; transition-property: max-height; - z-index: 101; + z-index: 100; width: 95%; } @@ -3661,4 +3500,27 @@ th.actions { .boutons { text-align: center; padding: 1em; +} + +a.edit_menu:focus, +a.edit_menu:hover, +a.edit_menu { + display: block; + margin: 0 !important; + padding: 0 !important; + left: 0; + top: 3px; + z-index: 101; + background-color: transparent !important; + margin: 0 !important; + padding: 0 !important; + height: auto !important; + width: auto !important; +} + +a.edit_menu img { + height: 16px !important; + width: 16px !important; + margin: 0 !important; + padding: 0 !important; } \ No newline at end of file diff --git a/public/opac/java/on_form_change_do/on_form_change_do.js b/public/opac/java/on_form_change_do/on_form_change_do.js index caca32a3137413df457c54623a6ba04b664f6d4d..dfc05f9d4bfaa879e0feb06561bc991618fbc79d 100644 --- a/public/opac/java/on_form_change_do/on_form_change_do.js +++ b/public/opac/java/on_form_change_do/on_form_change_do.js @@ -21,20 +21,21 @@ (function ( $ ) { $.fn.on_form_change_do = function(options) { var button = $(this); + var callback = options.callback; - var form = button.closest('form'); + var form = button.parent().nextAll('form'); if (!form.size()) - form = button.parent().nextAll('form'); + form = button.parent().prevAll('form'); if (!form.size()) - form = button.parent().prevAll('form'); + form = button.closest('form'); if(!form.size()) return; - form.on('keyup change paste input', + form.on('change paste input', 'input:not([id^="multiple-selection"]), select, textarea', function() { diff --git a/public/opac/js/abonne.js b/public/opac/js/abonne.js deleted file mode 100644 index b6c3479da0923b2c09c7c900d8756d5be5110d10..0000000000000000000000000000000000000000 --- a/public/opac/js/abonne.js +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// AIGUILLAGE ABONNE AVEC IDENTIFICATION -/////////////////////////////////////////////////////////////////////////////// -var sUrlToAbonne; -var bAbonneConnected=0; - -function fonction_abonne(nIdAbon,sUrl) -{ - if(nIdAbon > 0 || bAbonneConnected==true) - { - if (nIdAbon == 0) sUrl = baseUrl + '/admin/'; - redirection_abonne(sUrl); - return; - } - else - { - sUrlToAbonne=sUrl; - sUrl=baseUrl + '/opac/auth/ajax-login'; - showPopWin(sUrl, 700, 450, null); - } -} - -function logout() -{ - document.location= baseUrl + '/auth/logout'; -} - -function abonne_ok(idAbon, varAbonneNom, varTradDeconnecter) -{ - //alert(sUrlToAbonne); - bAbonneConnected=true; - if ((varAbonneNom!=undefined) && (varAbonneNom!='')) - { - e = document.getElementById("barreNavNom"); - if (e!=undefined) e.innerHTML = varAbonneNom; - } - e = document.getElementById("connecterMenu"); - if (e!=undefined) - { - e.innerHTML = varTradDeconnecter; - e.onclick = logout; - } - - e1 = document.getElementById("connecterMenuH"); - if (e1!=undefined) - { - e1.innerHTML = varTradDeconnecter; - e1.onclick = logout; - } - if(sUrlToAbonne)fonction_abonne(idAbon,sUrlToAbonne); -} - -function redirection_abonne( sAction ) -{ - varLength = baseUrl.length; - if( sAction.slice(0,varLength) == baseUrl) - { - document.location.replace(sAction); - return; - } - else showPopWin(baseUrl + sAction, 500, 345, null); -} diff --git a/public/opac/js/bib.js b/public/opac/js/bib.js deleted file mode 100644 index bfe804eeecb531b70a4a25de55eeb454346d625c..0000000000000000000000000000000000000000 --- a/public/opac/js/bib.js +++ /dev/null @@ -1,11 +0,0 @@ -function selectall() -{ - elm=document.selection.length; - for(var i=0;i<elm;i++) document.selection[i].checked="checked"; -} - -function deselectall() -{ - elm=document.selection.length; - for(var i=0;i<elm;i++) document.selection[i].checked=""; -} diff --git a/public/opac/js/input_connect_list/input_connect_list.css b/public/opac/js/input_connect_list/input_connect_list.css index 57a768ebe134e2a5e5a5cb9684da909aa2dcf4b3..76f5bcebb43c59c17532331521c2d7c484c44605 100644 --- a/public/opac/js/input_connect_list/input_connect_list.css +++ b/public/opac/js/input_connect_list/input_connect_list.css @@ -1,44 +1,65 @@ +.drag_and_drop_widget { + width: 550px; +} + .input_connect_list > div { - border: 1px solid #738ead; - display: inline-block; - margin: 5px; - vertical-align: top; + border: 1px solid #738ead; + display: inline-block; + margin: 5px; + vertical-align: top; } .input_connect_list h2 { - background-color: #738ead; - color: white; - font-size: 0.9em; - padding: 5px; - margin: 0; + background-color: #738ead; + color: white; + font-size: 0.9em; + padding: 5px; + margin: 0; } .input_connect_list ul { - list-style-type: none; - min-width: 120px; - min-height: 120px; - padding: 5px 2px; + list-style-type: none; + min-width: 120px; + min-height: 120px; + padding: 5px 2px; + max-height: 300px; + max-width: 250px; + overflow: auto; } .modules .input_connect_list h2 + ul > li, .input_connect_list li { - cursor: move; - margin: 2px 0; - padding: 0 5px; + cursor: move; + margin: 2px 0; + padding: 0 5px; } .show_drag_and_drop { - border: 1px solid grey; - border-radius: 2px; - padding: 0; - margin: 0; - list-style: none; - line-height: 2em; - min-height: 2em; - min-width: 300px; - padding: 0 5px; + border: 1px solid grey; + border-radius: 2px; + padding: 0; + margin: 0; + list-style: none; + line-height: 2em; + min-height: 2em; + width: 90%; + padding: 0 5px; + overflow: hidden; + overflow-y: auto; } .show_inline { display: inline-block !important; } + +span.selected { + cursor: default; + display: inline-block; + white-space: nowrap; + font-size: 1em; + line-height: 1.2em; + padding: 0.2em; + margin: 0.2em; + text-align: center; + border: 1px solid #BBB; +} diff --git a/public/opac/js/input_connect_list/input_connect_list.js b/public/opac/js/input_connect_list/input_connect_list.js index 64ec9f5e4ae7cbac166474d716d9c6435a9196bd..787bce4da41f8cbd62e8c3b63f3607029b50c1e5 100644 --- a/public/opac/js/input_connect_list/input_connect_list.js +++ b/public/opac/js/input_connect_list/input_connect_list.js @@ -56,7 +56,8 @@ remove: function(event, ui) { if("true" == options.sticky_available) - $(lists[1]).html(fixed_available); + $(lists[1]).html(fixed_available); + widget.find('input').change(); } }); }; @@ -64,7 +65,7 @@ (function ($) { - $.fn.draggableList = function() { + $.fn.draggableList = function(options) { var widget = $(this); widget.find('.show_drag_and_drop').click(function() { $(this).siblings('div').toggleClass('show_inline'); @@ -75,19 +76,26 @@ widget.addClass('input_connect_list'); widget.find('li').addClass('ui-state-default'); + var fixed = $(lists[1]).html(); + lists.sortable({ connectWith: 'ul', - update: function() { - var _values = ""; - var _labels = ""; - widget.find('.selected_items li').each(function() { - _values += $(this).data("id") + ";"; - _labels += $(this).data("label") + ","; - }); - widget.find('input').val(_values); - widget.find('.show_drag_and_drop').text(_labels); + update: function(event, ui) { + var _values = ""; + var _labels = ""; + widget.find('.selected_items li').each(function() { + _values += $(this).data("id") + ";"; + _labels += '<span class="selected">' + $(this).data("label") + '</span>'; + }); + widget.find('input').val(_values); + widget.find('.show_drag_and_drop').html(_labels); widget.find('input').change(); + }, + remove: function(event, ui) { + if(true == options.sticky_available) + $(lists[1]).html(fixed); } + }); }; } (jQuery)); diff --git a/public/opac/js/responsive.js b/public/opac/js/responsive.js index 54d3bdbe6ee85a1feaaf8b01cd9b4d4970d7ce9d..8feb8e707865dcd71f6e5478c5d3a9a20bb679fd 100644 --- a/public/opac/js/responsive.js +++ b/public/opac/js/responsive.js @@ -5,7 +5,9 @@ $(document).ready(function() { $(this).toggleClass('show_menu'); }); - $("div:not(.boite)[class*='menu_horizontal'] *, .menu_vertical.toggle_menu * ").not('.configuration_module *').click(function(e) { + $("div:not(.boite)[class*='menu_horizontal'] *, .menu_vertical.toggle_menu * ") + .not('.configuration_module *,[class*="edit_"], [class*="edit_"] *') + .click(function(e) { e.stopImmediatePropagation(); }); } @@ -16,9 +18,11 @@ $(document).ready(function() { $(this).toggleClass('show_content'); }); - excludeExternalLinks($("#col_wrapper .colGauche div.boite *, .facette_outer *")).not('.configuration_module *').click(function(e) { - e.stopPropagation(); - }); + excludeExternalLinks($("#col_wrapper .colGauche div.boite *, .facette_outer *")) + .not('.configuration_module *,[class*="edit_"], [class*="edit_"] *') + .click(function(e) { + e.stopPropagation(); + }); } diff --git a/public/opac/js/subModal.js b/public/opac/js/subModal.js index 834e731cfa63d9cefa1ccc49bd974ae25e7a642f..b595bcf2f79569adaa0dc85c26b37e165e827a78 100644 --- a/public/opac/js/subModal.js +++ b/public/opac/js/subModal.js @@ -3,6 +3,7 @@ var popupDialog = null; var loading = 'image-loading-status'; var current_anchor; + var opac_dialog = null; window.initializePopups = function() { $('[data-popup="true"]') @@ -15,6 +16,7 @@ : $(this).attr('href'); opacDialogFromUrl(addPath(url, '/render/popup')); }); + current_anchor = undefined; } @@ -71,31 +73,37 @@ } - var onOpen = function() { + var onOpen = function(event, ui) { initializePopups(); addLoadingClass(); + opac_dialog = $(event.target).closest('.ui-widget'); + opac_dialog.css('position', 'fixed'); + opac_dialog.css('top', '15%'); + opac_dialog.css('left', '20%'); + opac_dialog.css('width', '60%'); } - var onClose = function() { + var onClose = function(event, ui) { removeLoadingClass(); updateAndDestroyCKEditor(); if (current_anchor != undefined && current_anchor.attr('data-popup-refresh') == 'true') refreshPage(); + $('#opac-dialog').remove(); } var removeLoadingClass = function () { $('[data-popup="true"]').removeClass(loading); + $('.current_edition').removeClass('current_edition'); } var refreshPage = function() { - window.location.reload(true); + location.reload(true); } - window.opacShowModal = function(url, width, height, returnFunc, showCloseBox, titleDialog) { var modal_size = initModalSize(width, height); popupDialog = $('<iframe src="'+url+'" style="min-width:95%"></div>') @@ -143,39 +151,61 @@ } - window.opacDialog = function(container, data, dialogClass, openFunc, width, height) { - var modal_size = initModalSize(width, height); - var show_modal = false; - var titre = data['title']; - + window.opacDialog = function(container, data) { container[0].innerHTML = data['content']; - - if(data['width']) - modal_size['width'] = data['width']; - - if (data['show_modal'] && data['show_modal']=='true') - show_modal=true; - - var titre = titre; + var show_modal = (data['show_modal'] && data['show_modal']=='true') + ? true + : false; + var modal = container.dialog({ - width:modal_size['width'], - height:modal_size['height'], + title: data['title'], modal:show_modal, - dialogClass: dialogClass, - close:onClose, - open: function() {setTimeout(onOpen, 100);}, - position: {my : "center bottom", - at : "center center", - of : window} - }).closest('.ui-dialog').find('.ui-dialog-title').html(titre); + close: function(event, ui) { + onClose(event, ui) + }, + open: function(event, ui) { + setTimeout(onOpen(event, ui), 100); + }, + resizeStart: function(event, ui) { + opac_dialog.css('position', 'absolute'); + }, + resizeStop: function(event, ui) { + opac_dialog.css('position', 'fixed'); + opac_dialog.position({of: $(window)}); + } + }); + return modal; } window.addLoadingClass = function () { + + var initCurrentAnchor = function() { + if (current_anchor != undefined) + return current_anchor; + + var dialog_form = $('#opac-dialog form'); + if (!dialog_form.length) + return undefined; + + current_anchor = undefined; + var action = dialog_form[0].getAttribute('action'); + $('body').find('a[class*="edit_"], .configuration_module a').each(function() { + var href = $(this)[0].getAttribute('href'); + if(action.indexOf(href) > -1 || href.indexOf(action) > -1) { + return current_anchor = $(this); + } + }); + return current_anchor; + }; + + current_anchor = initCurrentAnchor(); if (current_anchor == undefined) return; + current_anchor.addClass(loading); + current_anchor.closest('.boite, .menu_horizontal, article, .colContenu').addClass('current_edition'); } diff --git a/public/opac/skins/original/css/global.css b/public/opac/skins/original/css/global.css index 6c34781458d42b98c7302b28edf016a2ef76ba80..9cf5d1c76ed59ccbc4e202fe42528654e9798c71 100644 --- a/public/opac/skins/original/css/global.css +++ b/public/opac/skins/original/css/global.css @@ -304,4 +304,4 @@ div#header .boiteBanniereDroiteInner { #fieldset-login_form legend { display: none; -} \ No newline at end of file +} diff --git a/tests/application/modules/AbstractControllerTestCase.php b/tests/application/modules/AbstractControllerTestCase.php index b6a06e301855c2ab6c7f0cc681dfb4c67d0efde0..e5e376d248a6d3b32f71f11b24ce1106ff2f4b43 100644 --- a/tests/application/modules/AbstractControllerTestCase.php +++ b/tests/application/modules/AbstractControllerTestCase.php @@ -170,6 +170,7 @@ abstract class AbstractControllerTestCase extends Zend_Test_PHPUnit_ControllerTe Storm_Model_Abstract::unsetLoaders(); Zend_Registry::set('sql', $this->_registry_sql); Zend_Registry::set('cfg', $this->_registry_cfg); + Class_ScriptLoader::resetInstance(); Class_Codification::resetInstance(); Class_MoteurRecherche::resetInstance(); Class_WebService_Abstract::resetHttpClient(); @@ -350,14 +351,17 @@ abstract class AbstractControllerTestCase extends Zend_Test_PHPUnit_ControllerTe public function assertAnchorsHaveTitle($message = '') { - $links = ''; + $links = []; foreach($this->queryXPath('//a[not(@title)]') as $element) { - $links .= '* ' . $element->getAttribute('href') . "\n"; + $links[] = $element->getAttribute('href'); } - $this->assertEmpty($links, - "Failed asserting no anchors without title:\n" . $links . $message); + if(!empty($links)) + $this->fail(sprintf("\n %s \n\nFailed asserting no anchors without title:\n%s", + $message, + implode('\n* \n', $links))); + return $this; } diff --git a/tests/application/modules/admin/controllers/AccueilControllerCalendarTest.php b/tests/application/modules/admin/controllers/AccueilControllerCalendarTest.php deleted file mode 100644 index f4f7154bee7fed98191517d60a09b139c574db51..0000000000000000000000000000000000000000 --- a/tests/application/modules/admin/controllers/AccueilControllerCalendarTest.php +++ /dev/null @@ -1,236 +0,0 @@ -<?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 - */ - - -abstract class Admin_AccueilControllerCalendarTestCase extends Admin_AbstractControllerTestCase { - public function setUp() { - parent::setUp(); - - Class_CustomField_Meta::beVolatile(); - $this->fixture('Class_CustomField', - ['id' => 1, - 'priority' => 3, - 'label' => 'Public', - 'field_type' => Class_CustomField_Meta::SELECT, - 'options_list' => 'junior; senior; ', - 'model' => 'Article']); - $this->fixture('Class_CustomField', - ['id' => 2, - 'priority' => 3, - 'label' => 'Theme', - 'field_type' => Class_CustomField_Meta::SELECT, - 'options_list' => 'music;theater;movie', - 'model' => 'Article']); - - $this->fixture('Class_Profil', - ['id' => 1, - 'libelle' => 'Afibre']) - ->updateModuleConfigAccueil(1, ['type_module' => 'CALENDAR', - 'division' => 1, - 'id_module' => 1, - 'preferences' => ['nb_events' => 3, - 'rss_avis' => 0, - 'display_calendar' => 1, - 'mode-affichage' => 'diaporama_navigation', - 'op_navigation_mode' => 'next_previous', - 'display_event_info' => 'bib', - 'display_mode' => 'Summary', - 'display_order' => 'EventDebut', - 'display_cat_select' => '', - 'enabled_filters' => 'date;place;custom_field_1', - 'id_categorie' => '', - 'event_filter' => 'none']]) - ->beCurrentProfil(); - - - } -} - - - -class Admin_AccueilControllerCalendarTestWithDefaultDiaporamaNavigation extends Admin_AccueilControllerCalendarTestCase { - public function setUp() { - parent::setUp(); - $this->dispatch('admin/accueil/calendrier?config=accueil&id_profil=1&id_module=1&type_module=CALENDAR', true); - } - - - /** @test */ - public function settingsEventFilterToDisplayShouldBePresent() { - $this->assertXPath('//td[contains(text(),"Filtre")]/following-sibling::td/select[@name="event_filter"]/option[@value="none"][@selected="selected"]', $this->_response->getBody()); - } - - - /** @test */ - public function selectDisplayModeShouldBeDisplay() { - $this->assertXPathContentContains('//select[@name="mode-affichage"]/option[@value="diaporama_navigation"]', 'Diaporama avec navigation'); - } - - - /** @test */ - public function selectDisplayEventInfoShouldBeDisplay() { - $this->assertXPath('//select[@name="display_event_info"]'); - } - - - /** @test */ - public function navigationModeShouldBeSetToNextPrevious() { - $this->assertXPathContentContains('//div[@id="objet_props"]//select[@name="op_navigation_mode"]/option[@value="next_previous"][@selected="selected"]', 'Boutons précédent et suivant'); - } - - - /** @test */ - public function inputFiltersShouldBePresent() { - $this->assertXPath('//div[@id="input_enabled_filters"]/input[@type="hidden"][@name="enabled_filters"]'); - } - - - /** @test */ - public function secondListShouldContainsOnlyOneElement() { - $this->assertXPathCount('//div[@id="input_enabled_filters"]/div[2]/ul/li', 1, $this->_response->getBody()); - } - - - /** @test */ - public function secondListShouldContainsTheme() { - $this->assertXPathContentContains('//div[@id="input_enabled_filters"]/div[2]/ul/li[@data-value="custom_field_2"]', 'Theme'); - } - - - /** @test */ - public function firstListShouldContainsThreeElements() { - $this->assertXPathCount('//div[@id="input_enabled_filters"]/div[1]/ul/li', 3); - } - - - /** @test */ - public function firstListShouldContainsPublic() { - $this->assertXPathContentContains('//div[@id="input_enabled_filters"]/div[1]/ul/li[@data-value="custom_field_1"]', 'Public'); - } - - - /** @test */ - public function firstListShouldContainsMonthPlace() { - $this->assertXPathContentContains('//div[@id="input_enabled_filters"]/div[1]/ul/li[@data-value="date"]', 'Mois'); - } - - - /** @test */ - public function firstListShouldContainsPlace() { - $this->assertXPathContentContains('//div[@id="input_enabled_filters"]/div[1]/ul/li[@data-value="place"]', 'Lieu'); - } - - - /** @test */ - public function checkBoxDisableDisplayFullPageShouldBePresent () { - $this->assertXPath('//div[@class="formTable"]//fieldset//input[@type="checkbox"][@checked="checked"][@name="display_full_page"]'); - } -} - - - - - -class Admin_AccueilControllerCalendarTestPopupModeNavigation extends Admin_AccueilControllerCalendarTestCase { - protected $_json; - - public function setUp() { - parent::setUp(); - $this->dispatch('admin/accueil/calendrier/render/popup?config=accueil&id_profil=1&id_module=1&type_module=CALENDAR', true); - - $this->_json = json_decode($this->_response->getBody()); - } - - - /** @test */ - public function submitButtonShouldContainsAjaxOnClick() { - $this->assertContains('initializeAjaxFormSubmit', $this->_json->content); - } - - - /** @test */ - public function titleShouldBeProprietesDuModule() { - $this->assertEquals('Propriétés du module', $this->_json->title); - } -} - - - -class Admin_AccueilControllerCalendarPostTest extends Admin_AccueilControllerCalendarTestCase { - public function setUp() { - parent::setUp(); - $this->postDispatch('admin/accueil/calendrier?config=accueil&id_profil=1&id_module=1&type_module=CALENDAR', - ['display_full_page' => 0]); - } - - - /** @test */ - public function displayFullDayShouldHaveBeenSaved() { - $this->assertequals(0, Class_Profil::find(1)->getCfgAccueilAsArray()['modules'][1]['preferences']['display_full_page']); - } -} - - - - -class Admin_AccueilControllerCalendarPostFiltersTest extends Admin_AccueilControllerCalendarTestCase { - public function setUp() { - parent::setUp(); - $this->postDispatch('admin/profil/accueil/id_profil/1', - ['libelle' => 'new title', - 'use_parent_css' => 1, - 'page_css' => '', - 'saveContent' => 'box2|5|CALENDAR|titre=Calendrier+des+animations---id_categorie=---display_cat_select=---display_event_info=bib---rss_avis=0---display_next_event=1---display_order=EventDebut---display_mode=Title---nb_events=3---display_calendar=1---mode-affichage=simple---event_filter=none---enabled_filters=date;place;custom_field_1;custom_field_2---boite=---id_items=---Valider=Valider---;box1|1|RESERVATIONS|titre=Mes+réservations---boite=---=---;box2|2|PRETS|titre=Mes+prêts---boite=---=---;box2|3|NEWSLETTERS|titre=Newsletters---boite=---=---;box2|4|MULTIMEDIA|titre=Postes+multimédia---boite=---=---']); - } - - - /** @test */ - public function cfgModuleShouldContainsCalendarFiltersDatePlaceAndCustomFilters() { - $prefs = Class_Profil::find(1)->getModuleAccueilPreferences(5, 'CALENDAR'); - $this->assertEquals('date;place;custom_field_1;custom_field_2', - $prefs['enabled_filters']); - - } - - - /** @test */ - public function calendarDivisionShouldBeTwo() { - $config = Class_Profil::find(1)->getModuleAccueilConfig(5, 'CALENDAR'); - $this->assertEquals(2, - $config['division']); - } - - - /** @test */ - public function reservationsDivisionShouldBeOne() { - $config = Class_Profil::find(1)->getModuleAccueilConfig(1, 'RESERVATIONS'); - $this->assertEquals(1, - $config['division']); - } - - - /** @test */ - public function profilShouldHaveFiveModules() { - $this->assertEquals(5, count(Class_Profil::find(1)->getCfgAccueilAsArray()['modules'])); - } -} - -?> \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/AccueilControllerCmsTest.php b/tests/application/modules/admin/controllers/AccueilControllerCmsTest.php deleted file mode 100644 index 0d43207883697e6c0830a346b47fa0a8a15ed3b6..0000000000000000000000000000000000000000 --- a/tests/application/modules/admin/controllers/AccueilControllerCmsTest.php +++ /dev/null @@ -1,354 +0,0 @@ -<?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 - */ - -abstract class Admin_AccueilControllerCmsWithDefaultDiaporamaNavigationTestCase extends Admin_AbstractControllerTestCase { - public function setUp() { - parent::setUp(); - - $this->fixture('Class_Profil', - ['id' => 1, - 'libelle' => 'Afibre']) - ->updateModuleConfigAccueil(1, ['type_module' => 'NEWS', - 'division' => 1, - 'id_module' => 1, - 'preferences' => ['style_liste' => 'diaporama_navigation', - 'id_items' => '1;2']]) - ->beCurrentProfil(); - } -} - - - - -class Admin_AccueilControllerCmsWithDefaultDiaporamaNavigationTest extends Admin_AccueilControllerCmsWithDefaultDiaporamaNavigationTestCase { - - public function setUp() { - parent::setUp(); - $this->dispatch('admin/accueil/news?config=accueil&id_profil=1&id_module=1&type_module=NEWS', true); - } - - - /** @test */ - public function formActionShouldBeAdminAccueilNews() { - $this->assertXPath('//form[contains(@action, "admin/accueil/news")]'); - } - - - /** @test */ - public function inputIdItemsShouldContains1and2() { - $this->assertXPath('//form//input[@name="id_items"][@value="1-2"]', $this->_response->getBody()); - } - - - /** @test */ - public function selectShouldContainsSlideShow() { - $this->assertXPathContentContains('//select/optgroup[@label="Objets java-script"]/option', 'Diaporama avec navigation'); - } - - - /** @test */ - public function selectShouldContainsAcordionList() { - $this->assertXPathContentContains('//select/optgroup[@label="Objets java-script"]/option', 'Liste en accordéon', $this->_response->getBody()); - } - - - /** @test */ - public function diaporamaNavigationShouldBeSelected() { - $this->assertXPathContentContains('//select/optgroup[@label="Objets java-script"]/option[@value="diaporama_navigation"][@selected="selected"]', 'Diaporama avec navigation', $this->_response->getBody()); - } - - - /** @test */ - public function navigationModeShouldBeDisplay() { - $this->assertXPath('//div[@id="objet_props"]//select[@name="op_navigation_mode"]'); - } - - - /** @test */ - public function navigationModePreviewShouldBePresent() { - $this->assertXPathContentContains('//div[@id="objet_props"]//select[@name="op_navigation_mode"]/option[@value="preview"]', 'Une miniature pour chaque élément'); - } - - - /** @test */ - public function styleListComboShouldNotSubmitWithAjax() { - $this->assertXPath('//script[contains(text(), "select[name=\'style_liste\']")][not(contains(text(), "initializeAjaxFormSubmit(form)"))]'); - } - - - /** @test */ - public function cycleIntervalShouldBePresent() { - $this->assertXPath('//div[@id="objet_props"]//input[@name="op_navigation_cycle"]'); - } - - - /** @test */ - public function navigationModeShouldBeSetToButtons() { - $this->assertXPathContentContains('//div[@id="objet_props"]//select[@name="op_navigation_mode"]/option[@value="buttons"][@selected="selected"]', 'Un bouton pour chaque élément', $this->_response->getBody()); - } - - - /** @test */ - public function windowWidthShouldBeSetTo350px() { - $this->assertXPath('//div[@id="objet_props"]//input[@name="op_navigation_window_width"][@value="350"]'); - } - - - /** @test */ - public function windowHeightShouldBeSetTo250px() { - $this->assertXPath('//div[@id="objet_props"]//input[@name="op_navigation_window_height"][@value="250"]'); - } - - - /** @test */ - public function displayOrderCommentCountShouldBePresent() { - $this->assertXPath('//input[@type="radio"][@name="display_order"][@value="CommentCount"]', - $this->_response->getBody()); - } - - - /** @test */ - public function unitShouldBeSetToPx() { - $this->assertXPath('//div[@id="objet_props"]//select[@name="op_navigation_unit"]/option[@value="px"]'); - } -} - - - - -class Admin_AccueilControllerCmsWithDefaultDiaporamaNavigationInPopupModeTest extends Admin_AccueilControllerCmsWithDefaultDiaporamaNavigationTestCase { - protected $_html; - - public function setUp() { - parent::setUp(); - $this->dispatch('admin/accueil/news/render/popup?config=accueil&id_profil=1&id_module=1&type_module=NEWS', true); - - $this->_html = json_decode($this->_response->getBody()); - } - - - /** @test */ - public function styleListComboShouldSubmitWithAjax() { - $xpath = new Storm_Test_XPath(); - - $xpath->assertXPath($this->_html->content, - '//script[contains(text(), "select[name=\'style_liste\']")][contains(text(), "initializeAjaxFormSubmit(form)")]'); - } - - - /** @test */ - public function titleShouldBeNewsModuleProperties() { - $this->assertEquals($this->_html->title, 'Propriétés du module articles'); - } - -} - - - - -class Admin_AccueilControllerCmsWithNextPreviousDiaporamaNavigationTest extends Admin_AbstractControllerTestCase { - - public function setUp() { - parent::setUp(); - - $this->fixture('Class_Profil', - ['id' => 1, - 'libelle' => 'Afibre']) - ->updateModuleConfigAccueil(1, ['type_module' => 'NEWS', - 'division' => 1, - 'id_module' => 1, - 'preferences' => ['style_liste' => 'diaporama_navigation', - 'op_navigation_mode' => 'next_previous', - 'op_navigation_window_height' => 500, - 'op_navigation_window_width' => 150, - 'op_navigation_cycle' => 1000]]) - ->beCurrentProfil(); - - $this->dispatch('admin/accueil/news?config=accueil&id_profil=1&id_module=1&type_module=NEWS', true); - } - - - /** @test */ - public function navigationModeShouldBeSetToNextPrevious() { - $this->assertXPathContentContains('//div[@id="objet_props"]//select[@name="op_navigation_mode"]/option[@value="next_previous"][@selected="selected"]', 'Boutons précédent et suivant'); - } - - - /** @test */ - public function windowWidthShouldBeSetTo150px() { - $this->assertXPath('//div[@id="objet_props"]//input[@name="op_navigation_window_width"][@value="150"]'); - } - - - /** @test */ - public function windowHeightShouldBeSetTo500px() { - $this->assertXPath('//div[@id="objet_props"]//input[@name="op_navigation_window_height"][@value="500"]'); - } - - -/** @test */ - public function cycleShouldBeSetTo1000() { - $this->assertXPath('//div[@id="objet_props"]//input[@name="op_navigation_cycle"][@value="1000"]'); - } -} - - - -class Admin_AccueilControllerCmsDispatchWithConfigAdminTest extends Admin_AbstractControllerTestCase { - - public function setUp() { - parent::setUp(); - - $this->fixture('Class_Profil', - ['id' => 1, - 'libelle' => 'Afibre']) - ->updateModuleConfigAccueil(1, ['type_module' => 'NEWS', - 'division' => 1, - 'id_module' => 1, - 'preferences' => ['anchor' => 'http://wiki.bokeh-library-portal.org']]) - ->beCurrentProfil(); - - - $this->dispatch('admin/accueil/news?config=admin&id_profil=1&id_module=1&type_module=news?config=admin&id_profil=1&type_module=NEWS&id_module=3&proprietes=titre%3DSite+du+patrimoine+41---anchor%3Dhttp%3A%2F%2Fwiki.bokeh-library-portal.org---type_aff%3D1---id_categorie%3D2---id_items%3D---nb_aff%3D1---nb_analyse%3D5---display_order%3DSelection---display_titles_only%3D1---rss_avis%3D0---op_largeur_img%3D200---op_hauteur_boite%3D400---boite%3Dboite_banniere_droite---id_module%3D3---%3D---style_liste%3Daccordion_list---styles_reload%3D0---send%3DValider', true); - } - - - /** @test */ - public function formAnchorInputShouldContainsWikiBokehLibraryPortalDotOrg() { - $this->assertXPath('//form//input[@name="anchor"][@value="http://wiki.bokeh-library-portal.org"]', $this->_response->getBody()); - } - - - /** @test */ - public function checkboxAllowLinkShouldBeChecked() { - $this->assertXPath('//form//input[@name="allow_link_on_title"][@value="1"]'); - } - - - /** @test */ - public function backButtonShouldContainsOnclickGoToIndex() { - $this->assertXPathContentContains('//div//button[@class="back admin-button"][@data-url="/admin/accueil"][contains(@onclick, "/admin/accueil")]', 'Retour'); - } -} - - - -abstract class Admin_AccueilControllerCmsPostTestCase extends Admin_AbstractControllerTestCase { - protected $_storm_default_to_volatile = true, - $_cfg, - $_values; - - public function setUp() { - parent::setUp(); - - $profil = Class_Profil::find(1); - $profil->setBoiteOfTypeInDivision(1, 'NEWS'); - $profil->assertSave(); - - $this->_values = ['titre' => 'Site communautaire Bokeh', - 'anchor' => 'http://bokeh.library-portal.org', - 'rss_avis' => 0, - 'id_categorie' => '5', - 'id_items' => '1-2', - 'display_order' => 'Selection', - 'nb_aff' => 3, - 'nb_analyse' => 5, - 'boite' => '', - 'display_title_only' => 0, - 'styles_reload' => 0, - 'style_liste' => 'none']; - - } -} - - - -class Admin_AccueilControllerCmsPostConfigAccueilTest extends Admin_AccueilControllerCmsPostTestCase { - - public function setUp() { - parent::setUp(); - $this->postDispatch('/admin/accueil/news?cinfig=accueil&id_profil=1&type_module=NEWS&id_module=1', - $this->_values); - - $this->_cfg = Class_Profil::find(1)->getCfgAccueilAsArray()['modules'][1]['preferences']; - } - - - /** @test */ - public function configNewsInPorfil1ShouldHaveBeenUpdated() { - $this->assertEquals('Site communautaire Bokeh', $this->_cfg['titre']); - } - - - /** @test */ - public function configNewsAnchorShouldBeBokehLibraryPortalDotOrg() { - $this->assertEquals('http://bokeh.library-portal.org', $this->_cfg['anchor']); - } - - - /** @test */ - public function selectedItemsShouldBe1and2() { - $this->assertEquals('1-2', $this->_cfg['id_items']); - } - - - /** @test */ - public function selectedCategoriesShould1() { - $this->assertEquals('5', $this->_cfg['id_categorie']); - } -} - - - - -class Admin_AccueilControllerCmsPostFromAdminConfTest extends Admin_AccueilControllerCmsPostTestCase { - public function setUp() { - parent::setUp(); - $this->postDispatch('/admin/accueil/news?config=admin&id_profil=1&type_module=NEWS&id_module=1', - $this->_values); - - $this->_cfg = Class_Profil::find(1)->getCfgAccueilAsArray()['modules'][1]['preferences']; - } - - - /** @test */ - public function shouldContainsScriptWithProperties() { - $this->assertXPathContentContains('//script', '"titre=Site communautaire Bokeh---anchor=http://bokeh.library-portal.org---rss_avis=0---id_categorie=5---id_items=1-2---display_order=Selection---nb_aff=3---nb_analyse=5---boite=---display_title_only=0---styles_reload=0---style_liste=none"'); - } -} - - - -class Admin_AccueilControllerIndexTest extends Admin_AbstractControllerTestCase { - protected $_storm_default_to_volatile = true; - - - public function setUp() { - parent::setUp(); - $this->dispatch('/admin/accueil/index', true); - } - - - /** @test */ - public function shouldForwardToIndexIndex() { - $this->assertXpathContentContains('//div', 'Accueil'); - } -} \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/AccueilControllerConfigMenuVerticalTest.php b/tests/application/modules/admin/controllers/AccueilControllerConfigMenuVerticalTest.php deleted file mode 100644 index 3c2393626258651962eddbb3315d6685e0ed5905..0000000000000000000000000000000000000000 --- a/tests/application/modules/admin/controllers/AccueilControllerConfigMenuVerticalTest.php +++ /dev/null @@ -1,193 +0,0 @@ -<?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 - */ -require_once 'AdminAbstractControllerTestCase.php'; - -abstract class AccueilControllerConfigMenuVerticalTestCase extends Admin_AbstractControllerTestCase { - protected - $_storm_default_to_volatile = true, - $_profil_portail; - - public function setUp() { - parent::setUp(); - - - $cfg_menus_profil_portail = ['H' => ['libelle' => 'Menu horizontal', - 'picto' => 'vide.gif', - 'menus' => []], - - '1' => ['libelle' => 'Menu jeunesse', - 'picto' => 'vide.gif', - 'menus' => []]]; - - - $cfg_menus_profil_nature = ['H' => ['libelle' => 'Menu horizontal', - 'picto' => 'vide.gif', - 'menus' => []], - - '3' => ['libelle' => 'Menu nature', - 'picto' => 'vide.gif', - 'menus' => []]]; - - $profil_nature = Class_Profil::newInstanceWithId(34, ['libelle' => 'Nature', - 'cfg_menus' => $cfg_menus_profil_nature]); - - $this->_profil_portail = Class_Profil::newInstanceWithId(1, ['libelle' => 'Portail', - 'cfg_menus' => $cfg_menus_profil_portail]) - ->updateModuleConfigAccueil(12, - ['type_module' => 'MENU_VERTICAL', - 'division' => 1, - 'id_module' => 12, - 'preferences' => ['titre' => 'Mon Menu', - 'menu' => 'H', - 'menu_deplie' => 1]]) - ->beCurrentProfil(); - - - Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Profil') - ->whenCalled('findAllBy') - ->with(['parent_id' => null, - 'order' => 'libelle']) - ->answers([$profil_nature, $this->_profil_portail]); - } -} - - - -class AccueilControllerConfigMenuVerticalWithNoIdProfilInPrefsTest extends AccueilControllerConfigMenuVerticalTestCase { - public function setUp() { - parent::setUp(); - - $this->dispatch('/admin/accueil/menuvertical?config=accueil&type_module=MENU_VERTICAL&id_module=12&id_profil=1', true); - } - - - /** @test */ - function afficheTitreShouldBeChecked() { - $this->assertXPath('//input[@type="checkbox"][@name="afficher_titre"][@checked="checked"]'); - } - - - /** @test */ - function menuDeplieShouldBeChecked() { - $this->assertXPath('//input[@type="checkbox"][@name="menu_deplie"][@checked="checked"]'); - } - - - /** @test */ - public function selectMenuShouldContainsMenuHorizontalForPortail() { - $this->assertXPathContentContains('//select[@name="menu"]//option[@selected="selected"][@value="1-H"]', 'Menu horizontal'); - } - - - /** @test */ - public function selectMenuShouldContainsMenuHorizontalForProfilNature() { - $this->assertXPathContentContains('//select[@name="menu"]//option[not(@selected)][@value="34-H"]', 'Menu horizontal'); - } - - - /** @test */ - public function selectMenuShouldContainsMenuNature() { - $this->assertXPathContentContains('//select[@name="menu"]//option[@value="34-3"]', 'Menu nature'); - } - - - /** @test */ - public function toggleMenuShouldBeUnchecked() { - $this->assertXPath('//form//input[@type="checkbox"][@name="toggle_menu"]'); - } -} - - - - -class AccueilControllerConfigMenuVerticalWithIdProfilInPrefsTest extends AccueilControllerConfigMenuVerticalTestCase { - public function setUp() { - parent::setUp(); - - - $this->_profil_portail->updateModuleConfigAccueil(12, - ['type_module' => 'MENU_VERTICAL', - 'division' => 1, - 'id_module' => 12, - 'preferences' => ['titre' => 'Mon Menu', - 'menu' => '34-3', - 'afficher_titre' => 0]]); - - $this->dispatch('/admin/accueil/menuvertical?config=accueil&type_module=MENU_VERTICAL&id_module=12&id_profil=1', true); - } - - - /** @test */ - function afficheTitreShouldNotBeChecked() { - $this->assertXPath('//input[@type="checkbox"][@name="afficher_titre"][not(@checked)]'); - } - - - /** @test */ - public function menuNatureShouldBeSelected() { - $this->assertXPathContentContains('//select[@name="menu"]//option[@value="34-3"][@selected="selected"]', 'Menu nature'); - } - - - /** @test */ - function newHtmlShouldNotBeChecked() { - $this->assertXPath('//input[@type="checkbox"][@name="new_html"][not(@checked)]'); - } - - - /** @test */ - function newHtmlLabelShouldBeAsExpected() { - $this->assertXPathContentContains('//td', 'Menu avec structure HTML simplifiée pour la css'); - } -} - - - -class AccueilControllerConfigMenuVerticalWithTwoMenusInPrefsTest extends AccueilControllerConfigMenuVerticalTestCase { - public function setUp() { - parent::setUp(); - - - $this->_profil_portail->updateModuleConfigAccueil(12, - ['type_module' => 'MENU_VERTICAL', - 'division' => 4, - 'id_module' => 12, - 'preferences' => ['titre' => 'Mon Menu', - 'menu' => '34-3', - 'afficher_titre' => 0]]); - - $this->_profil_portail->updateModuleConfigAccueil(1301, - ['type_module' => 'MENU_VERTICAL', - 'division' => 4, - 'id_module' => 1301, - 'preferences' => ['titre' => 'my second', - 'menu' => '34-3', - 'afficher_titre' => 1]]); - - $this->dispatch('/admin/accueil/menuvertical?config=accueil&type_module=MENU_VERTICAL&id_module=1301&id_profil=1', true); - } - - - /** @test */ - function afficheTitreShouldNotBeChecked() { - $this->assertXPath('//input[@type="checkbox"][@name="afficher_titre"][@checked]', $this->_response->getBody()); - } -} \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/AccueilControllerConteneurDeuxColonnesTest.php b/tests/application/modules/admin/controllers/AccueilControllerConteneurDeuxColonnesTest.php deleted file mode 100644 index 955243db50bcf915acf95a8ab1c2259dfa5e92a8..0000000000000000000000000000000000000000 --- a/tests/application/modules/admin/controllers/AccueilControllerConteneurDeuxColonnesTest.php +++ /dev/null @@ -1,316 +0,0 @@ -<?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 - */ - -abstract class AccueilControllerConteneurDeuxColonnesTestCase - extends Admin_AbstractControllerTestCase { - protected $_request_url = '/admin/accueil/conteneur2colonnes?id_profil=34&id_module=3&type_module=CONTENEUR_DEUX_COLONNES&config=accueil'; - - public function setUp() { - parent::setUp(); - - Class_AdminVar::newInstanceWithId('MENU_BOITE', ['valeur' => 1]); - - $this - ->fixture('Class_Profil', ['id' => 1, - 'libelle' => 'Main']) - ->addBoiteOfTypeInBanniere('NEWS') - ->save(); - - $this->profil_biologie = $this - ->fixture('Class_Profil', - ['id' => 34, - 'parent_id' => 1, - 'libelle' => 'Biologie']) - ->updateModuleConfigAccueil(3, - ['type_module' => 'CONTENEUR_DEUX_COLONNES', - 'division' => 2, - 'id_module' => 3, - 'preferences' => ['col_gauche_type' => 'NEWS', - 'col_droite_type' => 'CRITIQUES', - 'boite' => 'boite_de_la_division_du_milieu', - 'titre' => 'A la Une']]); - $this->profil_biologie->save(); - $this->profil_biologie->beCurrentProfil(); - } -} - - - -class AccueilControllerConteneurDeuxColonnesEmptyRenderTest extends AccueilControllerConteneurDeuxColonnesTestCase { - public function setUp() { - parent::setUp(); - $this->dispatch('/index/index/id_profil/34', true); - } - - /** @test */ - public function firsModuleShouldHaveId1000() { - $this->assertXPath('//div[@class="conteneur2colonnes"]//div[@id="boite_1000"]'); - } - - - /** @test */ - public function secondModuleShouldHaveId1001() { - $this->assertXPath('//div[@class="conteneur2colonnes"]//div[@id="boite_1001"]'); - } - - /** @test */ - public function secondModuleShouldBeCritics() { - $this->assertXPath('//div[@class="conteneur2colonnes"]//div[@class="boite critiques"]'); - } - - - /** @test */ - public function moduleNewsShouldHaveParentid3() { - $config = $this->profil_biologie->getModuleAccueilConfig(1000, 'NEWS'); - $this->assertEquals(3, $config['parent_id']); - } -} - - - - -class AccueilControllerConteneurDeuxColonnesUpdateNewsTest extends AccueilControllerConteneurDeuxColonnesTestCase { - public function setUp() { - parent::setUp(); - - $this - ->profil_biologie - ->updateModuleConfigAccueil(3, - ['type_module' => 'CONTENEUR_DEUX_COLONNES', - 'division' => 2, - 'id_module' => 3, - 'preferences' => ['col_gauche_type' => 'NEWS', - 'col_gauche_module_id' => 1000, - 'col_droite_type' => 'CRITIQUES', - 'boite' => 'boite_de_la_division_du_milieu', - 'titre' => 'A la Une']]) - ->updateModuleConfigAccueil(1000, - ['type_module' => 'NEWS', - 'id_module' => 1000, - 'parent_id' => 3, - 'preferences' => ['titre' => 'Les infos']]) - ->save(); - } - - - /** @test */ - public function renderedModuleNewsTitleShouldBeLesInfos() { - $this->dispatch('/index/index/id_profil/34', true); - $this->assertXPathContentContains('//div[@class="boite news"]//div', 'Les infos', - $this->_response->getBody()); - } - - /** @test */ - public function updatedModuleNewsTitleShouldBeDesNews() { - $this->postDispatch('/admin/accueil/news/config/accueil/id_profil/34/id_module/1000/type_module/NEWS', - ['id_items' => '34-12', - 'titre' => 'des news']); - $config = $this->profil_biologie->getModuleAccueilConfig(1000, 'NEWS'); - $this->assertEquals('des news', $config['preferences']['titre']); - } -} - - - - -class AccueilControllerConteneurDeuxColonnesDefaultTest extends AccueilControllerConteneurDeuxColonnesTestCase { - public function setUp() { - parent::setUp(); - $this->dispatch($this->_request_url, true); - } - - - /** @test */ - public function profilShouldBeValid() { - $this->assertTrue($this->profil_biologie->isValid()); - } - - - /** @test */ - public function shouldRenderConteneur2ColonnesView() { - $this->assertController('accueil'); - $this->assertAction('conteneur2colonnes'); - } - - - /** @test */ - public function inputTitleShouldDisplayALaUne() { - $this->assertXPath("//input[@name='titre'][@value='A la Une']"); - } - - - /** @test */ - public function selectColGaucheTypeShouldHaveNEWSSelected() { - $this->assertXPath("//select[@name='col_gauche_type']/option[@value='NEWS'][@selected='selected']"); - } - - - /** @test */ - public function selectColDroiteTypeShouldHaveCRITIQUESSelected() { - $this->assertXPath("//select[@name='col_droite_type']/option[@value='CRITIQUES'][@selected='selected']"); - } -} - - - -class AccueilControllerConteneurDeuxColonnesPostTest extends AccueilControllerConteneurDeuxColonnesTestCase { - public function setUp() { - parent::setUp(); - $this->postDispatch($this->_request_url, ['col_gauche_type' => 'KIOSQUE', - 'col_droite_type' => 'TAGS', - 'titre' => 'Ce mois ci']); - } - - - /** @test */ - public function moduleKiosqueShouldHaveBeenCreated() { - $this->assertEquals('KIOSQUE', $this->_getModuleTypeOf(1000, 'KIOSQUE')); - } - - - /** @test */ - public function moduleKiosqueParentIdShouldBe() { - $this->assertEquals(3, - $this->profil_biologie->getModuleAccueilConfig(1000, 'KIOSQUE')['parent_id']); - } - - - /** @test */ - public function moduleKiosqueShouldHaveBeenAddedToBox() { - $this->assertEquals(1000, - $this->_getModulePrefOf(3, 'col_gauche_module_id', 'CONTENEUR_DEUX_COLONNES')); - } - - - /** @test */ - public function moduleTagsShouldHaveBeenCreated() { - $this->assertEquals('TAGS', $this->_getModuleTypeOf(1001, 'TAGS')); - } - - - /** @test */ - public function moduleTagsShouldHaveBeenAddedToBox() { - $this->assertEquals(1001, - $this->_getModulePrefOf(3, 'col_droite_module_id', 'CONTENEUR_DEUX_COLONNES')); - } - - - /** @test */ - public function moduleTagShouldHaveParentId3() { - $config = $this->profil_biologie->getModuleAccueilConfig(1001, 'TAG'); - $this->assertEquals(3, $config['parent_id']); - } - - - protected function _getModuleTypeOf($id_module, $type) { - return $this->profil_biologie - ->getModuleAccueilConfig($id_module, $type)['type_module']; - } - - - protected function _getModulePrefOf($id_module, $pref, $type) { - return $this->profil_biologie - ->getModuleAccueilConfig($id_module, $type)['preferences'][$pref]; - } -} - - - -class AccueilControllerConteneurDeuxColonnesNewTest extends Admin_AbstractControllerTestCase { - public function setUp() { - parent::setUp(); - - $this->boite2cols = array('type_module' => 'CONTENEUR_DEUX_COLONNES', - 'division' => 2, - 'id_module' => 3); - - $this->profil_biologie = Class_Profil::getLoader() - ->newInstanceWithId(34) - ->setMenuHautOn(false) - ->setLibelle('Biologie') - ->updateModuleConfigAccueil(3, $this->boite2cols); - - Class_Profil::setCurrentProfil($this->profil_biologie); - $this->assertTrue($this->profil_biologie->isValid()); - } - - - /** @test */ - public function shouldRenderConteneur2ColonnesView() { - $this->request_url = '/admin/accueil/conteneur2colonnes?id_profil=34&id_module=3&type_module=CONTENEUR_DEUX_COLONNES&config=accueil'; - $this->dispatch($this->request_url); - - $this->assertController('accueil'); - $this->assertAction('conteneur2colonnes'); - } - - - /** @test */ - public function fonctionAdminOnClickShouldHaveActionConteneur2Colonnes() { - $this->dispatch('/opac?id_profil=34'); - $this->assertXPath("//a[contains(@href, 'conteneur2colonnes')]"); - } - - - /** @test */ - public function withModuleIdModulesShouldBeCreated() { - $this->boite2cols['preferences'] = ['col_gauche_module_id' => 234, - 'col_gauche_type' => 'COMPTEURS', - 'col_droite_module_id' => 235, - 'col_droite_type' => 'RECH_GUIDEE']; - - $this->profil_biologie->updateModuleConfigAccueil(3, $this->boite2cols); - $this->dispatch('/opac?id_profil=34'); - - $this->assertXPathContentContains('//div', 'Le catalogue contient'); - $this->assertXPath('//div[contains(@class,"conteneur_deux_colonnes")]//div[contains(@class,"rech_guide")]'); - } -} - - - - -class AccueilControllerConteneurDeuxColonnesEditPostTest extends AccueilControllerConteneurDeuxColonnesTestCase { - public function setUp() { - parent::setUp(); - $this->postDispatch($this->_request_url, ['col_gauche_type' => 'NEWS', - 'col_droite_type' => 'CRITIQUES', - 'titre' => 'Ce mois ci']); - - $this->postDispatch($this->_request_url, ['col_gauche_type' => 'NEWS', - 'col_droite_type' => 'NEWS', - 'titre' => 'Ce mois ci']); - - } - - - /** @test */ - public function newsWidgetInLeftColShouldRemainTheSame() { - $this->assertEquals(1000, $this->profil_biologie->getCfgAccueilAsArray()['modules'][3]['preferences']['col_gauche_module_id']); - } - - - /** @test */ - public function newsWidgetInRightColShouldBeNew() { - $this->assertEquals(1002, $this->profil_biologie->getCfgAccueilAsArray()['modules'][3]['preferences']['col_droite_module_id']); - } - -} \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/AccueilControllerCritiquesTest.php b/tests/application/modules/admin/controllers/AccueilControllerCritiquesTest.php deleted file mode 100644 index a63d68f69c898d1620a02ef95f4df03d4d423f9f..0000000000000000000000000000000000000000 --- a/tests/application/modules/admin/controllers/AccueilControllerCritiquesTest.php +++ /dev/null @@ -1,114 +0,0 @@ -<?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 Admin_AccueilControllerCritiquesTest extends Admin_AbstractControllerTestCase { - protected $_storm_default_to_volatile = true; - - - public function setUp() { - parent::setUp(); - $this->onLoaderOfModel('Class_PanierNotice') - ->whenCalled('findAllBelongsToAdmin') - ->answers([]); - - $this->dispatch('admin/accueil/critiques?config=accueil&id_profil=1&id_module=1&type_module=CRITIQUES', - true); - } - - - /** @test */ - public function titleShouldBePresent() { - $this->assertXPathContentContains('//h1', 'Critiques'); - } - - - /** @test */ - public function boxTitleShouldBePresent() { - $this->assertXPath('//input[@name="titre"]'); - } - - - /** @test */ - public function styleShouldBePresent() { - $this->assertXPath('//select[@name="boite"]'); - } - - - /** @test */ - public function rssChoiceShouldBePresent() { - $this->assertXPath('//input[@type="checkbox"][@name="rss_avis"]'); - } - - - /** @test */ - public function originShouldBePresent() { - $this->assertXPath('//select[@name="abon_ou_bib"]'); - } - - - /** @test */ - public function hierarchicalChoiceShouldBePresent() { - $this->assertXPath('//input[@type="checkbox"][@name="hierarchical"]'); - } - - - /** @test */ - public function displayCountShouldBePresent() { - $this->assertXPath('//input[@name="nb_aff_avis"]'); - } - - - /** @test */ - public function displayOrderShouldBePresent() { - $this->assertXPath('//input[@type="radio"][@name="display_order"]'); - } - - - /** @test */ - public function contentCutShouldBePresent() { - $this->assertXPath('//input[@name="nb_words"]'); - } - - - /** @test */ - public function thumbsChoiceShouldBePresent() { - $this->assertXPath('//select[@name="only_img"]'); - } - - - /** @test */ - public function domainsShouldBePresent() { - $this->assertXPath('//select[@name="id_catalogue"]'); - } - - - /** @test */ - public function basketsShouldBePresent() { - $this->assertXPath('//select[@name="id_panier"]'); - } - - - /** @test */ - public function submitShouldBePresent() { - $this->assertXPath('//input[@type="submit"][@name="Valider"]'); - } -} \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/AccueilControllerFormationsTest.php b/tests/application/modules/admin/controllers/AccueilControllerFormationsTest.php deleted file mode 100644 index d0333b352bab925c44442f65489f670fd1a68e3e..0000000000000000000000000000000000000000 --- a/tests/application/modules/admin/controllers/AccueilControllerFormationsTest.php +++ /dev/null @@ -1,95 +0,0 @@ -<?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 Admin_AccueilControllerFormationsTestWithDefaultSettings extends Admin_AbstractControllerTestCase { - - public function setUp() { - parent::setUp(); - - $this->fixture('Class_Profil', - ['id' => 1, - 'libelle' => 'Afibre'])->beCurrentProfil(); - - $this->dispatch('admin/accueil/formations-widget?config=accueil&id_profil=1&id_module=1&type_module=FORMATIONS_WIDGET', true); - } - - - /** @test */ - public function styleDeBoiteShouldBeBoiteParDefautDeLaDivision() { - $this->assertXPathContentContains('//select/option', 'Boite par défaut de la division'); - } - - - /** @test */ - public function treeselectFormationsBeDisplay() { - $this->assertXPath('//div[@class="treeselect id_categorie"]'); - } - - - /** @test */ - public function treeselectScriptShouldContainsSelectorOfTreeselectDiv() { - $this->assertXPathContentContains('//script', '.treeselect.id_categorie'); - } - - - /** @test */ - public function yearCategoriesShouldNotSelectable() { - $this->assertXPathContentContains('//script', 'categoriesNotSelectable'); - } - - - /** @test */ - public function formActionShouldBeAdminSlahAccueilSlahFormationWidget() { - $this->assertXPath('//form[contains(@action, "/admin/accueil/formations-widget")]'); - } -} - - - - -class Admin_AccueilControllerFormationsPostTest extends Admin_AbstractControllerTestCase { - - public function setUp() { - parent::setUp(); - - $this->fixture('Class_Profil', - ['id' => 1, - 'libelle' => 'Afibre']) - ->updateModuleConfigAccueil(1, ['type_module' => 'FORMATIONS_WIDGET', - 'division' => 1, - 'id_module' => 1]) - ->beCurrentProfil(); - - $this->postDispatch('admin/accueil/formations-widget?config=accueil&id_profil=1&id_module=1&type_module=FORMATIONS_WIDGET', - ['selected_formations' => '1;2']); - } - - - /** @test */ - public function formations1And2ShouldHaveBeenSaved() { - $this->assertEquals( - '1;2', - Class_Profil::getCurrentProfil() - ->getModuleAccueilConfig(1, 'FORMATIONS_WIDGET')['preferences']['selected_formations']); - } -} -?> \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/AccueilControllerTest.php b/tests/application/modules/admin/controllers/AccueilControllerTest.php deleted file mode 100644 index d2d48edb96c18ae60643260dfc3ed7c45345ac11..0000000000000000000000000000000000000000 --- a/tests/application/modules/admin/controllers/AccueilControllerTest.php +++ /dev/null @@ -1,1349 +0,0 @@ -<?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 - */ -require_once 'AdminAbstractControllerTestCase.php'; - - -class AccueilControllerLangueConfigurationTest extends Admin_AbstractControllerTestCase { - public function setUp() { - parent::setUp(); - - $boite_langue = array('type_module' => 'LANGUE', - 'division' => 1, - 'id_module' => 2, - 'preferences' => array('titre' => 'Sélectionnez la langue', - 'boite' => 'boite_vide')); - - Class_Profil::getCurrentProfil()->updateModuleConfigAccueil(2, $boite_langue); - - $this->request_url = '/admin/accueil/langue?id_module=2&type_module=LANGUE&config=accueil'; - $this->dispatch($this->request_url); - } - - /** @test */ - public function titleFieldShouldContinsSelectionnezLaLangue() { - $this->assertXPath('//input[@value="Sélectionnez la langue"]'); - } -} - - - - -class AccueilControllerBibliothequeNumeriqueTest extends Admin_AbstractControllerTestCase { - public function setUp() { - parent::setUp(); - - Class_Profil::getCurrentProfil() - ->updateModuleConfigAccueil(9, - array('type_module' => 'BIB_NUMERIQUE', - 'division' => 1, - 'id_module' => 9, - 'preferences' => array('titre' => 'Bibliothèque numérique', - 'boite' => '', - 'id_categories' => '', - 'id_categorie' => '', - 'id_albums' => '', - 'type_aff' => 'displayTree', - 'nb_aff' => '', - 'display_order' => '', - 'style_liste' => 'diaporama') - )); - - $bible = Class_AlbumCategorie::getLoader() - ->newInstanceWithId(1) - ->setLibelle('Bible de Souvigny'); - - Storm_Test_ObjectWrapper::onLoaderOfModel('Class_AlbumCategorie') - ->whenCalled('getCollections')->answers(array($bible))->getWrapper() - ->whenCalled('findAlbumsRecursively')->answers(array(Class_Album::getLoader()->newInstanceWithId(1) - ->setTitre('Harlock') - ->setCategorie($bible))); - - $this->dispatch('/admin/accueil/bibliotheque-numerique?config=accueil&type_module=BIB_NUMERIQUE&id_module=9&proprietes='); - } - - - /** @test */ - public function frameTitleShouldBeProprieteDeLaBibliothequeNumerique() { - $this->assertXPathContentContains('//h1', 'Propriétés de la bibliothèque numérique', $this->_response->getBody()); - } - - - /** @test */ - public function titleShouldBeBibliothequeNumerique() { - $this->assertXPath('//input[@value="Bibliothèque numérique"]'); - } - - - /** @test */ - public function selectionOfCategorieShouldBePresent() { - $this->assertXPath('//select[@name="id_categories"]'); - } - - - /** @test */ - public function selectionOfCategorieBibleDeSouvignyShouldBePresent() { - $this->assertXPathContentContains('//select[@name="id_categories"]/option', 'Bible de Souvigny'); - } - - - /** @test */ - public function selectionOfDisplayModeShouldBePresent() { - $this->assertXPath('//select[@name="type_aff"]'); - } - - - /** @test */ - public function selectionOfOrderModeShouldBePresent() { - $this->assertXPath('//input[@type="radio"][@name="display_order"]'); - } - - - /** @test */ - public function selectionOfAlbumShouldBePresent() { - $this->assertXPath('//select[@name="id_albums"]'); - } - - - /** @test */ - public function selectionOfImageCountShouldBePresent() { - $this->assertXPath('//input[@type="text"][@name="nb_aff"]'); - } - - - /** @test */ - public function selectionOfDisplayStyleShouldBePresent() { - $this->assertXPath('//select[@name="style_liste"]'); - } - - - /** @test */ - public function selectionOfAlbumsCategoriesShouldBePresent() { - $this->assertXPath('//div[contains(@class, "treeselect")]'); - $this->assertXPath('//input[@name="id_categorie"]'); - } -} - - - - -class AccueilControllerConfigCalendrierTest extends Admin_AbstractControllerTestCase { - public function setUp() { - parent::setUp(); - - Class_Profil::getCurrentProfil() - ->updateModuleConfigAccueil(11, - array('type_module' => 'CALENDAR', - 'division' => 1, - 'id_module' => 11, - 'preferences' => array('titre' => 'Agenda'))); - - $this->dispatch('/admin/accueil/calendrier?config=accueil&type_module=CALENDAR&id_module=11', - true); - } - - - /** @test */ - public function inputTitleShouldDisplayAgenda() { - $this->assertXPath("//input[@name='titre'][@value='Agenda']"); - } - - - /** @test */ - public function inputNbEventsShouldDisplayThree() { - $this->assertXPath("//input[@name='nb_events'][@value='3']"); - } - - - /** @test **/ - public function formTableAffichageShouldContainsModeAffichageLigne() { - $this->assertXPath('//select[@name="mode-affichage"]/option[@value="simple"]'); - } - - - /** @test **/ - public function formTableAffichageShouldContainsModeAffichageListe() { - $this->assertXPath('//select[@name="mode-affichage"]/option[@value="article"]'); - } - - - /** @test **/ - public function formTableAffichageShouldContainsModeAffichageNone() { - $this->assertXPath('//select[@name="mode-affichage"]/option[@value="none"]'); - } - - - /** @test **/ - public function byDefaultModeAfficahgeShouldBeLigne() { - $this->assertXPath('//select[@name="mode-affichage"]/option[@value="simple"][@selected="selected"]'); - } - - - /** @test **/ - public function formTableAffichageShouldContainsSelectDisplayCalendar() { - $this->assertXPath('//select[@name="display_calendar"]'); - } - - - /** @test **/ - public function selectDisplayCalendarShouldContainsOptionListeMois() { - $this->assertXPath('//select[@name="display_calendar"]/option[@value="2"]'); - } - - - /** @test **/ - public function byDefaultCalendrierShouldBeSelected() { - $this->assertXPath('//select[@name="display_calendar"]/option[@value="1"][@selected="selected"]'); - } - -} - - - -class AccueilControllerConfigSitothequePostTest extends Admin_AbstractControllerTestCase { - public function setUp() { - parent::setUp(); - Class_Profil::beVolatile(); - Class_Profil::getCurrentProfil() - ->updateModuleConfigAccueil(25, - ['type_module' => 'SITO', - 'division' => 1, - 'id_module' => 25, - 'preferences' => ['id_items' => '12-13']]); - - } - - - /** @test */ - public function selectHierachicalDisplayShouldSaveOnlyFirstCategory() { - $this->postDispatch('/admin/accueil/sitotheque?config=accueil&id_profil=1&type_module=SITO&id_module=25', - [ - 'type_aff' => 3, - 'nb_aff' => 2, - 'id_categorie' => '12-17' - ]); - - $this->assertEquals('12',Class_Profil::find(1)->getModuleAccueilConfig(25,'SITO')['preferences']['id_categorie']); - - } - - - /** @test */ - public function selectHierachicalDisplayWithEmptyCategoriesShouldSaveOnlyFirstCategory() { - $this->postDispatch('/admin/accueil/sitotheque?config=accueil&id_profil=1&type_module=SITO&id_module=25', - [ - 'type_aff' => 3, - 'nb_aff' => 2, - 'id_categorie' => '' - ]); - - $this->assertEquals('',Class_Profil::find(1)->getModuleAccueilConfig(25,'SITO')['preferences']['id_categorie']); - } -} - - - -class AccueilControllerConfigSitothequeDefaultsTest extends Admin_AbstractControllerTestCase { - public function setUp() { - parent::setUp(); - - Class_Profil::getCurrentProfil() - ->updateModuleConfigAccueil(25, - ['type_module' => 'SITO', - 'division' => 1, - 'id_module' => 25, - 'preferences' => ['id_items' => '12-13']]); - - $this->dispatch('/admin/accueil/sitotheque?config=accueil&type_module=SITO&id_module=25'); - } - - - /** @test */ - public function inputTitleShouldDisplaySitotheque() { - $this->assertXPath("//input[@name='titre'][@value='Sitothèque']"); - } - - - /** @test */ - function nbAffShouldEqualsTwo() { - $this->assertXPath("//input[@name='nb_aff'][@value='2']"); - } - - - /** @test */ - public function inputHiddenIdItemsShouldContainsSelectedItems() { - $this->assertXPath('//input[@type="hidden"][@name="id_items"][@value="12-13"]'); - } - - - /** @test */ - public function displayOrderRandomShouldBeChecked() { - $this->assertXPath('//input[@type="radio"][@name="display_order"][@value="Random"]'); - } - - - /** @test */ - public function displayOrderSelectionShouldBePresent() { - $this->assertXPath('//input[@type="radio"][@name="display_order"][@value="Selection"]'); - } - - -/** @test */ - public function rssFlowPreferenceShouldBePresent() { - $this->assertXPath('//input[@type="checkbox"][@name="rss"]', $this->_response->getBody()); - } -} - - - - -class AccueilControllerConfigSitothequeWithPreferencesTest extends Admin_AbstractControllerTestCase { - public function setUp() { - parent::setUp(); - - Class_Profil::getCurrentProfil() - ->updateModuleConfigAccueil(25, - ['type_module' => 'SITO', - 'division' => 1, - 'id_module' => 25, - 'preferences' => ['titre' => 'Ma Sito', - 'display_order' => 'Selection']]); - - $this->dispatch('/admin/accueil/sitotheque?config=accueil&type_module=SITO&id_module=25'); - } - - - /** @test */ - public function inputTitleShouldDisplayMaSito() { - $this->assertXPath("//input[@name='titre'][@value='Ma Sito']"); - } - - - /** @test */ - public function displayOrderSelectionShouldBeChecked() { - $this->assertXPath('//input[@type="radio"][@name="display_order"][@checked="checked"][@value="Selection"]'); - } - -/** @test */ - public function typeHierarchicCanBeSelected() { - $this->assertXPathContentContains('//select[@id="type_aff"]//option[@value=3]','Affichage hiérarchique par catégorie'); - } -} - - - - -class AccueilControllerConfigRSSDefaultsTest extends Admin_AbstractControllerTestCase { - public function setUp() { - parent::setUp(); - - Class_Profil::getCurrentProfil() - ->updateModuleConfigAccueil(25, - array('type_module' => 'RSS', - 'division' => 1, - 'id_module' => 25, - 'preferences' => array())); - - $this->dispatch('/admin/accueil/rss?config=accueil&type_module=RSS&id_module=25'); - } - - - /** @test */ - public function inputTitleShouldDisplayFilsRss() { - $this->assertXPath("//input[@name='titre'][@value='Fils Rss']"); - } - - - /** @test */ - function nbAffShouldEqualsTwo() { - $this->assertXPath("//input[@name='nb_aff'][@value='2']"); - } -} - - - -abstract class AccueilControllerConfigBoiteLoginTestCase extends Admin_AbstractControllerTestCase { - protected function prepareProfile() { - Class_Profil::getCurrentProfil() - ->updateModuleConfigAccueil(32, - ['type_module' => 'LOGIN', - 'division' => 4, - 'id_module' => 32, - 'preferences' => ['profil_redirect'=>'1', - 'profil_logout_redirect' => '1', - 'mot_de_pass_exemple' => 'dd/mm/aaaa']]); - } - - - public function setUp() { - parent::setUp(); - $this->prepareProfile(); - } -} - - - -class AccueilControllerConfigBoiteLoginTest extends AccueilControllerConfigBoiteLoginTestCase { - public function setUp() { - parent::setUp(); - $this->dispatch('/admin/accueil/login?config=accueil&type_module=LOGIN&id_module=32', true); - } - - - /** @test */ - public function inputTitreShouldBeSeConnecter() { - $this->assertXPath('//input[@name="titre"][@value="Se connecter"]'); - } - - - /** @test */ - public function inputIdentifiantExempleShouldBeEmpty() { - $this->assertXPath('//input[@name="identifiant_exemple"][@value=""]'); - } - - - /** @test */ - public function inputMotDePasseExempleShouldBeEmpty() { - $this->assertXPath('//input[@name="mot_de_passe_exemple"][@value=""]'); - } - - - /** @test */ - public function inputLibelleLienConnexion() { - $this->assertXPath('//input[@name="lien_connexion"][@value="» Se connecter"]'); - } - - - /** @test */ - public function inputLibelleLienMotDePasseOublie() { - $this->assertXPath('//input[@name="lien_mot_de_passe_oublie"][@value="» Mot de passe oublié ?"]'); - } - - - /** @test */ - public function inputLienCreerCompteShouldContainsEnregister() { - $this->assertXPath('//input[@name="lien_creer_compte"][contains(@value,"S\'enregistrer")]'); - } - - - /** @test */ - public function inputLibelleLienMonCompte() { - $this->assertXPath('//input[@name="lien_compte"][@value="» Mon compte"]'); - } - - - /** @test */ - public function checkBoxDisableAutocompleteShouldBeChecked() { - $this->assertXPath('//input[@name="autocomplete_off"][@checked="checked"]'); - } - - - /** @test */ - public function profilShouldBeValid() { - $this->assertTrue(Class_Profil::getCurrentProfil()->isValid()); - } - - - /** @test **/ - public function configShouldContainsSelectProfil() { - $this->assertXPath('//td/select[@name="profil_redirect"][@id="profil_redirect"]'); - } - - - /** @test */ - public function profilRedirectShouldContainsProfil1() { - $this->assertXPathContentContains('//select[@name="profil_redirect"]/optgroup/option[@value="1"][@selected="selected"]', - 'portail: Accueil'); - } - - - /** @test */ - public function profilLogoutRedirectShouldContainsProfil1() { - $this->assertXPathContentContains('//select[@name="profil_logout_redirect"]/optgroup/option[@value="1"][@selected="selected"]', - 'portail: Accueil'); - } - -} - - - -class AccueilControllerConfigBoiteLoginPostTest extends AccueilControllerConfigBoiteLoginTestCase { - protected $_prefs; - - public function setUp() { - parent::setUp(); - $this->postDispatch('/admin/accueil/login/render/popup?config=accueil&type_module=LOGIN&id_module=32', - ['boite' => '', - 'titre' => 'Se connecter', - 'profil_redirect' => 678, - 'profil_logout_redirect' => 345]); - - $this->_prefs = Class_Profil::getCurrentProfil() - ->getModuleAccueilPreferences(32, 'LOGIN'); - } - - - /** @test */ - public function profilRedirectShouldBe678() { - $this->assertEquals(678, $this->_prefs['profil_redirect']); - } - - - /** @test */ - public function profilLogoutRedirectShouldBe345() { - $this->assertEquals(345, $this->_prefs['profil_logout_redirect']); - } - - - /** @test */ - public function responseShouldRedirectWithJS() { - $this->assertXPathContentContains('//script', - 'parent.window.location=parent.document.location.href'); - } -} - - - - -abstract class AccueilControllerWithParentProfileConfigBoiteLoginTestCase - extends AccueilControllerConfigBoiteLoginTestCase { - protected function prepareProfile() { - parent::prepareProfile(); - $this->fixture('Class_Profil', ['id' => 3]); - $parent = $this->fixture('Class_Profil', ['id' => 44]) - ->updateModuleConfigAccueil(32, - ['type_module' => 'LOGIN', - 'division' => 4, - 'id_module' => 32, - 'preferences' => ['profil_redirect' => '3', - 'profil_logout_redirect' => '3', - 'mot_de_pass_exemple' => 'dd/mm/aaaa']]);; - - Class_Profil::getCurrentProfil() - ->setParentProfil($parent); - } -} - - - - -class AccueilControllerWithParentProfileConfigBoiteLoginTest extends AccueilControllerWithParentProfileConfigBoiteLoginTestCase { - public function setUp() { - parent::setUp(); - $this->dispatch('/admin/accueil/login?config=accueil&type_module=LOGIN&id_module=32', true); - } - - - /** @test */ - public function profilRedirectShouldBeParentsOne() { - $this->assertXPath('//select[@name="profil_redirect"]/optgroup/option[@value="3"][@selected="selected"]', - $this->_response->getBody()); - } - - - /** @test */ - public function profilLogoutRedirectShouldBeParentsOne() { - $this->assertXPath('//select[@name="profil_logout_redirect"]/optgroup/option[@value="3"][@selected="selected"]', - $this->_response->getBody()); - } -} - - - -class AccueilControllerWithParentProfileConfigBoiteLoginPostTest - extends AccueilControllerWithParentProfileConfigBoiteLoginTestCase { - protected $_prefs; - - public function setUp() { - parent::setUp(); - $this->postDispatch('/admin/accueil/login?config=accueil&type_module=LOGIN&id_module=32', - ['boite' => '', - 'titre' => 'Se connecter', - 'profil_redirect' => 678, - 'profil_logout_redirect' => 345]); - - $this->_prefs = Class_Profil::getCurrentProfil() - ->getParentProfil() - ->getModuleAccueilPreferences(32, 'LOGIN'); - } - - - /** @test */ - public function parentProfilRedirectShouldBe678() { - $this->assertEquals(678, $this->_prefs['profil_redirect']); - } - - - /** @test */ - public function parentProfilLogoutRedirectShouldBe345() { - $this->assertEquals(345, $this->_prefs['profil_logout_redirect']); - } -} - - - - -class AccueilControllerPostConfigBoiteKiosqueProfilLognesTest extends Admin_AbstractControllerTestCase { - - public function setUp() { - parent::setUp(); - - Class_Bib::newInstanceWithId(3) - ->setLibelle('Lognes'); - - Class_Profil::getCurrentProfil() - ->updateModuleConfigAccueil(32, ['type_module' => 'KIOSQUE', - 'division' => 4, - 'id_module' => 32, - 'preferences' => []]) - ->setIdSite(3); - - $this->postDispatch('/admin/accueil/kiosque?config=accueil&type_module=KIOSQUE&id_module=32', - ['id_panier'=>'5', - 'titre' => 'titre du /kiosque', - 'profil_redirect' => '12']); - - $this->preferences = Class_Profil::getCurrentProfil()->getModuleAccueilConfig(32, 'KIOSQUE')['preferences']; - } - - - /** @test **/ - public function postConfigShouldRedirectToReferrer() { - $this->assertXpathContentContains('//script', 'parent.window.location=parent.document.location.href;'); - } - - - /** @test */ - public function titleShouldBeTitreDuKiosque() { - $this->assertEquals('titre du /kiosque', $this->preferences['titre']); - } - - - /** @test */ - public function profilRedirectShouldBeTwelve() { - $this->assertEquals('12', $this->preferences['profil_redirect']); - } -} - - - - -class AccueilControllerPostKiosqueTest extends Admin_AbstractControllerTestCase { - public function setUp() { - parent::setUp(); - Class_Bib::newInstanceWithId(3) - ->setLibelle('Lognes'); - - Class_Profil::getCurrentProfil() - ->updateModuleConfigAccueil(32, - ['type_module' => 'KIOSQUE', - 'division' => 4, - 'id_module' => 32, - 'preferences' => ['style_liste' => 'slide_show', - 'profil_redirect' => '18']]) - ->setIdSite(3); - - $this->postDispatch('/admin/accueil/kiosque?config=accueil&type_module=KIOSQUE&id_module=32', - ['id_panier'=>'5', - 'titre' => 'titre du /kiosque', - 'style_liste' => 'carrousel_horizontal', - 'profil_redirect' => '18']); - - $this->preferences = Class_Profil::getCurrentProfil()->getModuleAccueilConfig(32, 'KIOSQUE')['preferences']; - } - - - /** @test */ - public function profilRedirectShouldBeEmpty() { - $this->assertEquals('', $this->preferences['profil_redirect']); - } -} - - - - -abstract class AccueilControllerConfigBoiteKiosqueProfilLognesTestCase extends Admin_AbstractControllerTestCase { - public function setUp() { - parent::setUp(); - - Class_Bib::newInstanceWithId(3) - ->setLibelle('Lognes'); - - Class_Profil::getCurrentProfil() - ->updateModuleConfigAccueil(25, - array('type_module' => 'KIOSQUE', - 'division' => 4, - 'id_module' => 32, - 'preferences' => array())) - ->setIdSite(3); - } - - - public function dispatchConfigModule() { - $this->dispatch('/admin/accueil/kiosque?config=accueil&type_module=KIOSQUE&id_module=32', true); - } -} - - - - -class AccueilControllerConfigBoiteKiosqueProfilLognesAsAdminPortailTest extends AccueilControllerConfigBoiteKiosqueProfilLognesTestCase { - public function setUp() { - parent::setUp(); - $this->dispatchConfigModule(); - } - - /** @test **/ - public function configPageShouldDisableMultipleSelection() { - $this->assertXPath('//script[contains(@src, "treeselect")]', $this->_response->getBody()); - } - - - /** @test **/ - public function treeSelectShouldLoadCatalogueDomainesPaniersJson() { - $this->assertXPathContentContains('//script', - '$.getJSON("/admin/catalogue/domaines-paniers.json"', - $this->_response->getBody()); - } - - - /** @test **/ - public function configPageShouldContainsHiddenInputWithIdCategorie() { - $this->assertXPath('//input[@type="hidden"][@id="id_catalogue"]'); - } - - - /** @test **/ - public function configPageShouldContainsHiddenInputWithIdPanier() { - $this->assertXPath('//input[@type="hidden"][@id="id_panier"]'); - } - - - /** @test */ - public function selectStyleListeShouldContainsOptGroupObjetsJS() { - $this->assertXPath('//select[@name="style_liste"]//optgroup[@label="Objets javascript"]'); - } - - - /** @test */ - public function selectStyleListeShouldContainsOptGroupObjetsHTML() { - $this->assertXPath('//select[@name="style_liste"]//optgroup[@label="HTML"]'); - $this->assertXPathContentContains('//select[@name="style_liste"]//option[@value="mur"]', 'Mur'); - } - - - /** @test */ - public function selectStyleListeShouldContainsOptGroupObjetsHTMLChrono() { - $this->assertXPathContentContains('//select[@name="style_liste"]//option[@value="chrono"]', 'Frise'); - } - - - /** @test */ - public function selectOnlyImgShouldBeOnAfficheNoticesAvecVignettes() { - $this->assertXPathContentContains('//select[@name="only_img"]/option[@value="1"][@selected="selected"]', - 'Afficher les notices avec vignettes uniquement'); - } - - - /** @test */ - public function profilRedirectShouldBePresent() { - $this->assertXPath('//select[@name="profil_redirect"]'); - } - - - /** @test */ - public function noProfilRedirectShouldBeSelected() { - $this->assertNotXPath('//select[@name="profil_redirect"]//option[@selected]'); - } -} - - - - - -class AccueilControllerConfigBoiteKiosqueAsAdminBibOtherSiteTest extends AccueilControllerConfigBoiteKiosqueProfilLognesTestCase { - protected function _loginHook($account) { - $account->ROLE_LEVEL = ZendAfi_Acl_AdminControllerRoles::ADMIN_BIB; - $account->ID_SITE = 5; - } - - public function setUp() { - parent::setUp(); - $this->dispatchConfigModule(); - } - - - /** @test */ - public function responseShouldRedirectToPageAccueil() { - $this->assertRedirectTo('/admin/index'); - } -} - - - - -class AccueilControllerConfigBoiteWithRightConfigFrontTest extends AccueilControllerConfigBoiteKiosqueProfilLognesTestCase { - public function setUp() { - parent::setUp(); - - Class_Users::getIdentity()->beModoBib()->setUserGroups([Class_UserGroup::newInstanceWithId(2) - ->addRightConfigFront()]); - - $this->dispatchConfigModule(); - } - - - /** @test */ - public function responseShouldNotRedirectToPageAccueil() { - $this->assertNotRedirect(); - } -} - - - - -abstract class AccueilControllerRechSimpleConfigurationTestCase extends Admin_AbstractControllerTestCase { - protected - $_profil_adulte; - - public function setUp() { - parent::setUp(); - - $boite_recherche = ['type_module' => 'RECH_SIMPLE', - 'division' => 1, - 'id_module' => 2, - 'preferences' => ['titre' => 'Recherchez', - 'boite' => 'boite_vide', - 'placeholder' => 'ex: Potter', - 'domain_ids' => '4']]; - - $this->_profil_adulte = Class_Profil::getCurrentProfil() - ->setLibelle('Adulte') - ->updateModuleConfigAccueil(2, $boite_recherche); - } -} - - - - -class AccueilControllerMultipleRechSimpleConfigurationTest extends AccueilControllerRechSimpleConfigurationTestCase { - protected - $_storm_default_to_volatile = true, - $_profil_romans; - - public function setUp() { - parent::setUp(); - - $boite_recherche_banniere = ['type_module' => 'RECH_SIMPLE', - 'division' => 4, - 'id_module' => 8, - 'preferences' => ['titre' => 'Search']]; - - $this->_profil_adulte->updateModuleConfigAccueil(8, $boite_recherche_banniere); - - - $this->_profil_romans = $this->fixture('Class_Profil', ['id' => '123']) - ->setLibelle('Romans') - ->setParentProfil(Class_Profil::getCurrentProfil()); - } - - - protected function dispatchConfigModuleProfil($id_module, $id_profil, $term) { - $this->request_url = '/admin/accueil/rechsimple?id_module='.$id_module.'&id_profil='.$id_profil.'&type_module=RECH_SIMPLE&config=accueil'; - $this->dispatch($this->request_url, true); - $this->assertXPath('//input[@name="titre"][@value="' . $term . '"]'); - } - - - /** @test */ - public function parentProfilBoiteBanniereConfigInputTitreShouldBeSearch() { - $this->dispatchConfigModuleProfil(8, $this->_profil_adulte->getId(), 'Search'); - } - - - /** @test */ - public function subprofilBoiteBanniereWithConfigurationInputTitreShouldBeFind() { - $boite_recherche_romans = ['type_module' => 'RECH_SIMPLE', - 'division' => 4, - 'id_module' => 9, - 'preferences' => ['titre' => 'Find']]; - - $this->_profil_romans->updateModuleConfigAccueil(9, $boite_recherche_romans); - $this->dispatchConfigModuleProfil(9, 123, 'Find'); - } - - - /** @test */ - public function subprofilBoiteBanniereWithoutConfigurationInputTitreShouldBeSearch() { - $this->dispatchConfigModuleProfil(9, 123, 'Search'); - } -} - - - - -class AccueilControllerRechSimpleConfigurationTest extends AccueilControllerRechSimpleConfigurationTestCase { - public function setUp() { - parent::setUp(); - - Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Profil') - ->whenCalled('findAllByZoneAndBib') - ->answers([$this->_profil_adulte, - Class_Profil::newInstanceWithId(98, ['libelle' => 'Jeunesse'])]); - - - $this->request_url = '/admin/accueil/rechsimple?id_module=2&type_module=RECH_SIMPLE&config=accueil'; - $this->dispatch($this->request_url, true); - } - - - /** @test */ - public function inputTitreShouldBeRecherchez() { - $this->assertXPath('//input[@name="titre"][@value="Recherchez"]'); - } - - - /** @test */ - public function inputTriShouldHavePertinenceSelected() { - $this->assertXPath('//select[@name="tri"]//option[@value="*"][@selected="selected"]'); - } - - - - /** @test */ - public function selectProfilRedirectShouldContainsProfilAdulte() { - $this->assertXPathContentContains('//select[@name="profil_redirect"]//option[@value="2"]', - 'Adulte', - $this->_response->getBody()); - } - - /** @test */ - public function selectProfilRedirectShouldContainsProfilJeunesse() { - $this->assertXPathContentContains('//select[@name="profil_redirect"]//option[@value="98"]', - 'Jeunesse'); - } - - - /** @test */ - public function selectProfilShouldIncludeEmptyOption() { - $this->assertXPath('//select[@name="profil_redirect"]//option[@value=""]'); - } - - - /** @test */ - public function inputPlaceHolderShouldContainsExPotter() { - $this->assertXPath('//input[@name="placeholder"][@value="ex: Potter"]'); - } - - - /** @test */ - public function jqueryUIShouldBeLoaded() { - $this->assertXPath('//script[contains(@src, "'.JQUERYUI.'")]'); - } - - - /** @test */ - public function domainSelectorShouldBePresent() { - $this->assertXPath('//input[@name="domain_ids"][@value="4"]'); - } - - - /** @test */ - public function domainSelectorScriptShouldBeLoaded() { - $this->assertXPathContentContains('//script', '$.getJSON("/abonne/viewable-domains-json"'); - } - - - /** @test */ - public function domainSelectorStyleShouldHaveRadioSelectChecked() { - $this->assertXPath('//input[@name="domain_select_style"][@type="radio"][@checked="checked"][@value="select"]'); - } - - - /** @test */ - public function domainSelectorStyleShouldHaveRadioCheckboxUnchecked() { - $this->assertXPath('//input[@name="domain_select_style"][@type="radio"][not(@checked)][@value="checkbox"]'); - } -} - - - - -class AccueilControllerWidgetDomainConfigurationTest extends Admin_AbstractControllerTestCase { - - public function setup() { - parent::setup(); - - $domain_widget = ['type_module' => 'DOMAIN_BROWSER', - 'division' => 1, - 'id_module' => 5, - 'preferences' => ['boite' => 'boite_vide', - 'root_domain_id' => '1']]; - - $this->fixture('Class_Catalogue', ['id' => 1, - 'libelle' => 'hum']); - Class_Profil::getCurrentProfil() - ->setLibelle('Adulte') - ->updateModuleConfigAccueil(5, $domain_widget); - - $this->dispatch('/admin/accueil/domain-browser?config=accueil&id_profil=2&id_module=5&type_module=DOMAIN_BROWSER', true); - } - - - /** @test */ - public function formActionShouldBeAdminAccueilDomainBrowser() { - $this->assertXPath('//form[contains(@action, "admin/accueil/domain-browser")]'); - } - - - /** @test **/ - public function inputTitleWidgetShouldBeDisplay() { - $this->assertXpath('//input[@name="titre"][@value="Domaines"]'); - } - - - /** @test **/ - public function inputWidgetSkinShouldBeDisplay() { - $this->assertXpath('//select[@name="boite"]/option[@selected="selected"][@value="boite_vide"]'); - } - - - /** @test */ - public function submitButtonShouldBeDisplayed() { - $this->assertXPath('//input[@type="submit"]'); - } - - - /** @test */ - public function inputRootDomaineIdShouldBeDisplayed() { - $this->assertXPath('//input[@name="root_domain_id"][@value="1"]'); - } - - - /** @test */ - public function inputSelectFormatShouldBeDisplayed() { - $this->assertXPath('//select[@name="display_mode"]'); - } -} - - - - -class AccueilControllerWidgetDomainPostConfigurationTest extends Admin_AbstractControllerTestCase { - - - protected $pref_list=['titre' =>'Mes Domaines', - 'root_domain_id' => 10, - 'allow_breadcrumb' => '0', - 'display_mode' => Class_Systeme_ModulesAppli::LISTE_FORMAT_MUR]; - - - public function setup() { - parent::setup(); - - $domain_widget = ['type_module' => 'DOMAIN_BROWSER', - 'division' => 1, - 'id_module' => 5, - 'preferences' => ['boite' => 'boite_vide', - 'root_domain_id' => '1', - 'display_mode' => '']]; - - Class_Profil::getCurrentProfil() - ->setLibelle('Adulte') - ->updateModuleConfigAccueil(5, $domain_widget); - - $this->postDispatch('/admin/accueil/domain-browser?config=accueil&id_profil=2&id_module=5&type_module=DOMAIN_BROWSER', - $this->pref_list); - $this->pref = Class_Profil::getCurrentProfil() - ->getModuleAccueilConfig(5, 'DOMAIN_BROWSER')['preferences']; - - } - - - public function preferences(){ - return array_map(function ($value,$key) { return [$key,$value];}, - $this->pref_list,array_keys($this->pref_list)); - } - - - /** @test - @dataProvider preferences */ - public function newWidgetTitleShouldBeMesDomaines($pref_name,$expected) { - $this->assertEquals($expected, $this->pref[$pref_name]); - } -} - - - - -class AccueilControllerKiosqueWidgetWithFlashSettingsSetTest extends Admin_AbstractControllerTestCase { - - - public function setUp() { - parent::setUp(); - Class_Profil::getCurrentProfil() - ->updateModuleConfigAccueil(32, ['type_module' => 'KIOSQUE', - 'division' => 4, - 'id_module' => 32, - 'preferences' => ['style_liste' => 'carrousel_horizontal']]); - - $this->dispatch('/admin/accueil/kiosque?config=accueil&type_module=KIOSQUE&id_module=32', true); - } - -/** @test */ - public function redirectProfilSettingShouldNotBeVisible() { - $this->assertXPath('//tr[@style="display: none"]//select[@name="profil_redirect"]'); - } -} - - - -class AccueilControllerKiosqueWidgetWithFlashSettingsSelectedTest extends Admin_AbstractControllerTestCase { - - - public function setUp() { - parent::setUp(); - Class_Profil::getCurrentProfil() - ->updateModuleConfigAccueil(32, ['type_module' => 'KIOSQUE', - 'division' => 4, - 'id_module' => 32, - 'preferences' => ['style_liste' => 'slide_show']]); - - $this->dispatch('/admin/accueil/kiosque/config/accueil/type_module/KIOSQUE/id_module/32/style_liste/carrousel_horizontal', true); - } - -/** @test */ - public function redirectProfilSettingShouldNotBeVisible() { - $this->assertXPath('//tr[@style="display: none"]//select[@name="profil_redirect"]'); - } -} - - - - -class AccueilControllerKiosqueWidgetWithFlashSettingsSavedAndJsSelectedTest extends Admin_AbstractControllerTestCase { - - - public function setUp() { - parent::setUp(); - Class_Profil::getCurrentProfil() - ->updateModuleConfigAccueil(32, ['type_module' => 'KIOSQUE', - 'division' => 4, - 'id_module' => 32, - 'preferences' => ['style_liste' => 'slide_show']]); - - $this->dispatch('/admin/accueil/kiosque/config/accueil/type_module/KIOSQUE/id_module/32/style_liste/slide_show', true); - } - -/** @test */ - public function redirectProfilSettingShouldNotBeVisible() { - $this->assertNotXPath('//tr[@style="display: none"]//select[@name="profil_redirect"]'); - } -} - - - - -class AccueilControllerAddBoxInFrontTest extends AccueilControllerConfigBoiteLoginTestCase { - - protected $profil; - - public function setUp() { - parent::setUp(); - $this->postDispatch('/admin/accueil/add-block', ['division' => 4, - 'module_type' => 'KIOSQUE', - 'id_module' => 32, - 'titre' => 'mon titre', - 'boite' => '', - ]); - $id_profil = Class_Profil::getCurrentProfil()->getId(); - Class_Profil::clearCache(); - $this->profil = Class_Profil::find($id_profil); - } - - /** @test */ - public function currentProfilShouldHaveTitre() { - $this->assertEquals('mon titre', $this->profil->getCfgAccueilAsArray()['modules'][1]['preferences']['titre']); - } - - /** @test */ - public function currentProfilShouldHaveTypeKiosque() { - $this->assertEquals('KIOSQUE', $this->profil->getCfgAccueilAsArray()['modules'][1]['type_module']); - } - - /** @test */ - public function currentProfilShouldHaveSlideShow() { - $this->assertEquals('slide_show', $this->profil->getCfgAccueilAsArray()['modules'][1]['preferences']['style_liste']); - } - - /** @test */ - public function currentProfilShouldHaveNbNotices() { - $this->assertEquals(20, $this->profil->getCfgAccueilAsArray()['modules'][1]['preferences']['nb_notices']); - } -} - - - - - -class AccueilControllerLibraryConfigTest extends Admin_AbstractControllerTestCase { - public function setUp() { - parent::setUp(); - - $annecy = $this->fixture('Class_Bib', - ['id' => 23, - 'libelle' => 'Annecy']); - - $this->fixture('Class_Bib', - ['id' => 45, - 'libelle' => 'Seynod']); - - - $this->fixture('Class_CustomField', - ['id' => 7, - 'label' => 'Services', - 'options_list' => 'Parking;Wifi;Projection;Restauration', - 'priority' => 3, - 'field_type' => Class_CustomField_Meta::MULTI_CHECKBOX, - 'model' => 'Bib']); - - $this->fixture('Class_CustomField', - ['id' => 9, - 'label' => 'Public', - 'options_list' => 'Jeune;Adulte', - 'priority' => 3, - 'field_type' => Class_CustomField_Meta::MULTI_CHECKBOX, - 'model' => 'Bib']); - - $annecy->setCustomField('Services', ['Wifi','Restauration']); - $annecy->setCustomField('Public', []); - $annecy->saveWithCustomFields(); - - Class_Profil::getCurrentProfil() - ->updateModuleConfigAccueil(32, ['type_module' => 'LIBRARY', - 'division' => 4, - 'id_module' => 32, - 'preferences' => ['titre' => 'Médiathèque', - 'libraries' => '45', - 'filters' => 'custom_field_7;opening']]); - - $this->dispatch('/admin/accueil/library/config/accueil/type_module/LIBRARY/id_module/32', true); - } - - - /** @test */ - public function h1ShouldContainsLibraryProperties() { - $this->assertXPathContentContains('//h1', 'Propriétés d\'affichage du module bibliothèques'); - } - - - /** @test */ - public function inputTitreShouldContainsMediatheque() { - $this->assertXPath('//input[@name="titre"][@value="Médiathèque"]'); - } - - - /** @test */ - public function librariesSelectorShouldContainsAnnecyInAvailableLibraries() { - $this->assertXPathContentContains('//div[@id="input_libraries"]//div[preceding-sibling::div]//li[@data-value="23"]', - 'Annecy', - $this->_response->getBody()); - } - - - /** @test */ - public function librariesSelectorShouldContainsSeynodInSelectedLibraries() { - $this->assertXPathContentContains('//div[@id="input_libraries"]//div[following-sibling::div]//li[@data-value="45"]', 'Seynod'); - } - - - /** @test */ - public function selectedLibrariesLabelShouldBeSelectedLibraries() { - $this->assertXPathContentContains('//div[@id="input_libraries"]//div[following-sibling::div]/h2', - 'Bibliothèques affichées'); - } - - - /** @test */ - public function availableLibrariesLabelShouldBeAvailableLibraries() { - $this->assertXPathContentContains('//div[@id="input_libraries"]//div[preceding-sibling::div]/h2', - 'Bibliothèques disponibles'); - } - - - /** @test */ - public function jqueryUIShouldBeLoaded() { - $this->assertXPath('//script[contains(@src, "'.JQUERYUI.'")]'); - } - - - /** @test */ - public function filtersSelectorShouldBePresent() { - $this->assertXPathContentContains('//legend', 'Affichage des filtres'); - } - - - /** @test */ - public function inputFiltersShouldContainsCustomFiledSevenAndOpening() { - $this->assertXPath('//input[@name="filters"][@value="custom_field_7;opening"]'); - } - - - /** @test */ - public function availableLabelsShouldContainsLiForOpening() { - $this->assertXPathContentContains('//ul/li[@data-value="opening"]', 'Ouverture'); - } - - - /** @test */ - public function availableLabelsShouldContainsLiForTown() { - $this->assertXPathContentContains('//ul/li[@data-value="town"]', 'Ville'); - } - - - /** @test */ - public function availableLabelsShouldContainsLiForTerritory() { - $this->assertXPathContentContains('//ul/li[@data-value="territory"]', 'Territoire'); - } - - - /** @test */ - public function availableLabelsShouldContainsLiForSearch() { - $this->assertXPathContentContains('//ul/li[@data-value="search"]', 'Recherche'); - } - - - /** @test */ - public function displaySettingsForFiltersShouldBePresent() { - $this->assertXPath('//select[@name="filters_display_modes"]'); - } - - - /** @test */ - public function displaySettingsForFiltersPositionShouldBePresent() { - $this->assertXPath('//select[@name="filters_position"]'); - } - - - /** @test */ - public function displayMapCheckboxShouldBePresent() { - $this->assertXPath('//form//input[@type="checkbox"][@name="osm_map"]'); - } -} \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/CatalogueControllerTest.php b/tests/application/modules/admin/controllers/CatalogueControllerTest.php index 69b382168da57af4539a3ddf8e69697799a969f5..aba261bd287f7883de3fa84f9741cae2c1737fcf 100644 --- a/tests/application/modules/admin/controllers/CatalogueControllerTest.php +++ b/tests/application/modules/admin/controllers/CatalogueControllerTest.php @@ -901,7 +901,7 @@ class CatalogueControllerEditInPopupPostTest extends CatalogueControllerEditInPo /** @test */ public function responseShouldBeARedirectWithJavascript() { - $this->assertXpathContentContains('//script', 'document.location.href = document.location.href;'); + $this->assertXpathContentContains('//script', 'location.reload();'); } } @@ -928,7 +928,7 @@ class CatalogueControllerAddCatalogueInPopupPostTest extends CatalogueController /** @test */ public function responseShouldBeARedirectWithJavascript() { - $this->assertXpathContentContains('//script', 'document.location.href = document.location.href;'); + $this->assertXpathContentContains('//script', 'location.reload();'); } } diff --git a/tests/application/modules/admin/controllers/CmsControllerTest.php b/tests/application/modules/admin/controllers/CmsControllerTest.php index 160ad31ad7a9317429483a47b80400fc861668e3..f172bfc924824087c705cb71665fc9fe7f26ec09 100644 --- a/tests/application/modules/admin/controllers/CmsControllerTest.php +++ b/tests/application/modules/admin/controllers/CmsControllerTest.php @@ -779,6 +779,12 @@ class CmsControllerArticleConcertEditRenderPopupActionTest extends CmsController $this->_xpath = new Storm_Test_XPath(); } + /** @test */ + public function tagPreviewArticleShouldNotHaveRenderPopupInLink() { + $this->_xpath->assertXPath($this->_json->content, + '//a[contains(@href, "cms/articleview/id/4?iframe=true")]'); + } + /** @test */ public function prettyPhotoShouldBeLoaded() { @@ -840,13 +846,6 @@ class CmsControllerArticleConcertEditRenderPopupActionTest extends CmsController } - /** @test */ - public function tagPreviewArticleShouldNotHaveRenderPopupInLink() { - $this->_xpath->assertXPath($this->_json->content, - '//a[contains(@href, "cms/articleview/id/4?iframe=true")]'); - } - - /** @test */ public function contentShouldNotContainsJQuery() { $this->_xpath->assertNotXPath($this->_json->content, @@ -860,7 +859,6 @@ class CmsControllerArticleConcertEditRenderPopupActionTest extends CmsController '//script[contains(@src, "'.JQUERYUI.'")]', $this->_json->content); } - } @@ -1175,7 +1173,7 @@ class CmsControllerArticleConcertEditActionPostRenderPopupTest extends CmsContro /** @test */ public function responseShouldBeARedirectWithJavascript() { - $this->assertXpathContentContains('//script', 'document.location.href = document.location.href;'); + $this->assertXpathContentContains('//script', 'location.reload();'); } @@ -1363,7 +1361,7 @@ class CmsControllerArticleAddActionPostTest extends CmsControllerWithPermissionT /** @test */ function redirectToEditNewArticle() { - $this->assertRedirectTo('/admin/cms/edit/id/5/id_cat/23', $this->getResponseLocation()); + $this->assertRedirectTo(Class_Url::absolute('/admin/cms/edit/id_cat/23/id/5')); } diff --git a/tests/application/modules/admin/controllers/FormationControllerTest.php b/tests/application/modules/admin/controllers/FormationControllerTest.php index eedabddd678cfa5e100e9f534039397c737dbb24..9abecc5f783f680480009498bb091aa501263188 100644 --- a/tests/application/modules/admin/controllers/FormationControllerTest.php +++ b/tests/application/modules/admin/controllers/FormationControllerTest.php @@ -373,8 +373,7 @@ class Admin_FormationControllerPostLearningJavaTest extends Admin_FormationCont /** @test */ function answerShouldRedirectToFormationIndex() { - $this->assertRedirectTo('/admin/formation/edit/id/3/year/2012', - $this->getResponseLocation()); + $this->assertRedirectTo(Class_Url::absolute('/admin/formation/edit/id/3/year/2012')); } } @@ -990,7 +989,7 @@ class Admin_FormationControllerPostSessionLearnJavaTest extends Admin_Formation /** @test */ function responseShouldRedirectToSessionFormationEdit() { - $this->assertRedirectTo('/admin/session-formation/edit/id/32'); + $this->assertRedirectTo(Class_Url::absolute('/admin/session-formation/edit/id/32')); } /** @test */ @@ -1170,7 +1169,7 @@ class Admin_FormationControllerPostAddSessionToFormationLearningPythonTest exten /** @test */ function answerShouldRedirectToFormationIndex() { - $this->assertRedirectTo('/admin/session-formation/edit/id/122'); + $this->assertRedirectTo(Class_Url::absolute('/admin/session-formation/edit/formation_id/12/id/122')); } diff --git a/tests/application/modules/admin/controllers/LieuControllerTest.php b/tests/application/modules/admin/controllers/LieuControllerTest.php index 15eb8502f273e35d9b75701ed4283c1509a26740..901d3a241c72fe1214a20a94b685ed52611dd5bd 100644 --- a/tests/application/modules/admin/controllers/LieuControllerTest.php +++ b/tests/application/modules/admin/controllers/LieuControllerTest.php @@ -233,7 +233,7 @@ class LieuControllerPostNewLieuTest extends LieuControllerTestCase { /** @test */ public function answerShouldRetirectToLieuEditId6() { - $this->assertRedirectTo('/admin/lieu/edit/id/6'); + $this->assertRedirectTo(Class_Url::absolute('/admin/lieu/edit/id/6')); } diff --git a/tests/application/modules/admin/controllers/MenusControllerTest.php b/tests/application/modules/admin/controllers/MenusControllerTest.php deleted file mode 100644 index 9858bcf35ee3a1fffa95d6335534ce2d8b603633..0000000000000000000000000000000000000000 --- a/tests/application/modules/admin/controllers/MenusControllerTest.php +++ /dev/null @@ -1,428 +0,0 @@ -<?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 - */ -require_once 'AdminAbstractControllerTestCase.php'; - - -abstract class Admin_MenusControllerProfilJazzTestCase extends Admin_AbstractControllerTestCase { - protected - $_storm_default_to_volatile = true, - $_profil_jazz; - - public function setUp() { - parent::setUp(); - - $cfg_menus = ['H' => ['libelle' => 'Menu horizontal', - 'picto' => 'vide.gif', - 'menus' => [['type_menu' => 'MENU', - 'libelle' => 'Pratique', - 'picto' => 'bookmark.png', - 'preferences' => [], - 'sous_menus' => [['type_menu' => 'ACCUEIL', - 'libelle' => 'Accueil', - 'picto' => 'vide.gif', - 'preferences' => []], - - ['type_menu' => Class_Systeme_ModulesMenu::MODULE_ACCUEIL_PREFIX.'CRITIQUES', - 'libelle' => 'Critiques', - 'picto' => 'vide.gif', - 'preferences' => []]]], - - ['type_menu' => 'URL', - 'libelle' => 'Google', - 'picto' => 'vide.gif', - 'preferences' => ['url' => 'http://www.google.com', - 'target' => 0]], - - ['type_menu' => 'NEWS', - 'libelle' => 'Articles', - 'picto' => 'vide.gif', - 'preferences' => ['id_items' => '1-3', - 'display_order' => 'Selection']], - - ['type_menu' => 'FORM_CONTACT', - 'libelle' => 'Formulaire contact', - 'picto' => 'vide.gif' ], - - ['type_menu' => Class_Systeme_ModulesMenu::MODULE_ACCUEIL_PREFIX.'CALENDAR', - 'libelle' => 'Calendrier', - 'picto' => 'vide.gif', - 'preferences' => ['nb_events' => 5]], - - ['type_menu' => 'CATALOGUE', - 'libelle' => 'Libelle du catalogue', - 'preferences' => ['titre' => 'Titre du catalogue'], - 'picto' => 'vide.gif' ] - - ], - ], - - 'V' => ['libelle' => 'Menu vertical', - 'picto' => 'vide.gif']]; - - $this->_profil_jazz = Class_Profil::newInstanceWithId(5, - ['browser' => 'opac', - 'libelle' => 'Jazz pour tous', - 'cfg_menus' => $cfg_menus]); - } -} - - - - -class Admin_MenusControllerProfilJazzIndexActionTest extends Admin_MenusControllerProfilJazzTestCase { - public function setUp() { - parent::setUp(); - - $this->dispatch('admin/menus/index?'. - http_build_query(array('id_profil' => '5', - 'id_bib' => 'null', - 'type_menu' => 'MENU', - 'id_module' => 1, - 'libelle' => 'Pratique', - 'picto' => 'bookmark.png', - 'preferences' => ''))); - } - - - /** @test */ - public function libellePratiqueShouldBeDisplayed() { - $this->assertXPath("//input[@name='libelle'][@value='Pratique']"); - } - - - /** @test */ - public function bookmarkIconShouldBeDisplayed() { - $this->assertXPath("//img[@id='select_picto'][contains(@src, 'bookmark.png')]"); - } - - - /** @test */ - function profilTranslaterShouldBeNullTranslator() { - //pour éviter que le contenu des menus / données sérializées soient traduites dans l'interface d'édition - $this->assertInstanceOf('Class_Profil_NullTranslator', Class_Profil::getCurrentProfil()->getTranslator()); - } -} - - - - -class Admin_MenusControllerEditMenuBibNumTest extends Admin_AbstractControllerTestCase { - public function createBibNum() { - $classique_cat = Class_AlbumCategorie::getLoader() - ->newInstanceWithId(10) - ->setLibelle('Classique') - ->setSousCategories(array()) - ->setAlbums(array()); - - $jazz_cat = Class_AlbumCategorie::getLoader() - ->newInstanceWithId(4) - ->setParentCategorie(null) - ->setLibelle('Jazz') - ->setAlbums(array()) - ->setSousCategories(array( - - $mag_jazz_cat = Class_AlbumCategorie::getLoader() - ->newInstanceWithId(41) - ->setParentId(4) - ->setSousCategories(array()) - ->setLibelle('Magazines') - ->setAlbums(array()), - - $bd_jazz_cat = Class_AlbumCategorie::getLoader() - ->newInstanceWithId(42) - ->setParentId(4) - ->setSousCategories(array()) - ->setLibelle('BD') - ->setAlbums(array( - $fitzgerald = Class_Album::getLoader() - ->newInstanceWithId(421) - ->setCatId(42) - ->setTitre('Fitzgerald'), - - $armstrong = Class_Album::getLoader() - ->newInstanceWithId(422) - ->setCatId(42) - ->setTitre('Armstrong') - )) - ) - ); - - - Storm_Test_ObjectWrapper::onLoaderOfModel('Class_AlbumCategorie') - ->whenCalled('findAll') - ->answers(array($jazz_cat, $classique_cat)); - - Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Album') - ->whenCalled('findAll') - ->answers(array($fitzgerald, $armstrong)); - } - - - public function setUp() { - parent::setUp(); - $this->createBibNum(); - $this->dispatch('admin/menus/album?'. - http_build_query(array('id_profil' => '5', - 'id_bib' => 'null', - 'type_menu' => 'BIBNUM', - 'id_module' => 1, - 'libelle' => 'Lien vers un album', - 'picto' => 'book.png', - 'preferences' => 'album_id=422'))); - } - - - /** @test */ - public function libelleLienVersUnAlbumShouldBeDisplayed() { - $this->assertXPath("//input[@name='libelle'][@value='Lien vers un album']"); - } - - - /** @test */ - function albumSelectShouldContainsFitzgerald() { - $this->assertXPathContentContains("//select[@id='album_id']//option[@value='421']", - "Jazz>BD>Fitzgerald", - $this->_response->getBody()); - } - - - /** @test */ - function albumSelectShouldContainsArmstrong() { - $this->assertXPathContentContains("//select//option[@value='422'][@selected='selected']", - "Jazz>BD>Armstrong", - $this->_response->getBody()); - } - - - /** @test */ - function albumArmstrongShouldBeFirst() { - $this->assertXPathContentContains("//select//option[1]", "Armstrong"); - } -} - - - - -class Admin_MenusControllerEditMenuAlbumLinkTest extends Admin_AbstractControllerTestCase { - public function setUp() { - parent::setUp(); - $this->fixture('Class_Album', ['id' => 421, - 'cat_id' => 0, - 'titre' => 'Step accross the border']); - - $this->dispatch('admin/menus/album?'. - http_build_query(array('id_profil' => '5', - 'id_bib' => 'null', - 'type_menu' => 'BIBNUM', - 'id_module' => 1, - 'libelle' => 'Lien vers un album', - 'picto' => 'book.png', - 'preferences' => 'album_id=421'))); - - } - - -/** @test */ - public function linkAlbumWithoutCategoryShouldReturnCategoryNotClassified() { - $this->assertXPathContentContains('//div', 'non classé', $this->_response->getBody()); - } -} - - -class Admin_MenusControllerProfilJazzEditCalendrierActionTest extends Admin_MenusControllerProfilJazzTestCase { - public function setUp() { - parent::setUp(); - Class_Systeme_ModulesMenu::reset(); - Class_AdminVar::newInstanceWithId('MENU_BOITE', ['valeur' => 1]); - $this->dispatch('admin/menus/calendrier?'. - http_build_query(['id_profil' => '5', - 'id_bib' => 'null', - 'type_menu' => 'MODULE_ACCUEIL_CALENDAR', - 'id_module' => '3', - 'libelle' => '', - 'picto' => '', - 'preferences' => 'titre=Calendrier%20des%20animations|rss_avis=0|display_next_event=1|nb_events=5|display_event_info=bib|id_categorie=108-96|id_items=|Valider=Valider']), - true); - } - - - /** @test */ - public function inputNbEventsShouldBeFive() { - $this->assertXPath('//input[@type="text"][@name="nb_events"][@value="5"]', - $this->_response->getBody()); - } - - - /** @test */ - public function displayOrderShouldBeEventDebut() { - $this->assertXPath('//input[@name="display_order"][@checked="checked"][@value="EventDebut"]'); - } - - - /** @test */ - public function displayModeShouldBeTitle() { - $this->assertXPath('//input[@name="display_mode"][@checked="checked"][@value="Title"]'); - } - - - /** @test */ - public function displayEventInfoShouldBeBib() { - $this->assertXPath('//select[@name="display_event_info"]/option[@value="bib"][@selected="selected"]', -$this->_response->getBody()); - } -} - - - - -class Admin_MenusControllerProfilJazzEditMenuActionTest extends Admin_MenusControllerProfilJazzTestCase { - public function setUp() { - parent::setUp(); - Class_Systeme_ModulesMenu::reset(); - Class_AdminVar::newInstanceWithId('MENU_BOITE', ['valeur' => 1]); - $this->dispatch('admin/menus/menuvertical?'. - http_build_query(['id_profil' => '5', - 'type_menu' => 'MODULE_ACCUEIL_MENU_VERTICAL', - 'id_module' => '3', - 'libelle' => '', - 'picto' => '', - 'preferences' => []]),true); - } - - - /** @test */ - public function checkboxAfficheTitreShouldBeChecked() { - $this->assertXPath('//input[@type="checkbox"][@name="afficher_titre"][@checked="checked"]',$this->_response->getBody()); - } -} - - - - -class Admin_MenusControllerProfilJazzPostCalendrierActionTest extends Admin_MenusControllerProfilJazzTestCase { - public function setUp() { - parent::setUp(); - $this->postDispatch('admin/menus/calendrier?'.http_build_query(['id_module' => 3, - 'id_profil' => 5, - 'type_menu' => 'MODULE_ACCUEIL_CALENDAR']), - ['titre' => 'Agenda', - 'nb_events' => 10]); - } - - /** @test */ - public function responseShouldBeContainsMajProprietesTitleAgenda() { - $this->assertContains('parent.retourMajProprietes("3","Agenda","vide.gif","titre=Agenda|nb_events=10")', - $this->_response->getBody()); - } -} - - - - - -class Admin_MenusControllerProfilJazzPostCatalogueActionTest extends Admin_MenusControllerProfilJazzTestCase { - public function setUp() { - parent::setUp(); - - Storm_Test_ObjectWrapper::onLoaderOfModel('Class_PanierNotice') - ->whenCalled('findAllBelongsToAdmin')->answers([]); - - $this->postDispatch('admin/menus/catalogue?'.http_build_query(['id_module' => 7, - 'id_profil' => 5, - 'type_menu' => 'CATALOGUE']), - ['titre' => 'Titre du catalogue','libelle' => 'Nouveauté', 'id_panier' => 0]); - } - - /** @test */ - public function responseShouldBeContainsNouveaute() { - $this->assertContains('parent.retourMajProprietes("7","Nouveauté","vide.gif","titre=Titre du catalogue', - $this->_response->getBody()); - } -} - - - - -class Admin_MenusControllerProfilJazzEditCatalogueActionTest extends Admin_MenusControllerProfilJazzTestCase { - public function setUp() { - parent::setUp(); - - $panier_bd = $this->fixture('Class_PanierNotice', - ['id' => 1, - 'libelle' => 'bd']); - - $panier_romans = $this->fixture('Class_PanierNotice', - ['id' => 2, - 'libelle' => 'romans']); - - $panier_musique = $this->fixture('Class_PanierNotice', - ['id' => 3, - 'libelle' => 'musique']); - - $panier_autres = $this->fixture('Class_PanierNotice', - ['id' => 4, - 'libelle' => 'autres']); - - - $this->fixture('Class_Catalogue', - ['id' => 9, - 'libelle' => 'Domaine livres', - 'panier_notices' => [$panier_romans, $panier_bd]]); - - Class_Users::getIdentity()->setPaniers([$panier_bd]); - - Storm_Test_ObjectWrapper::onLoaderOfModel('Class_PanierNotice') - ->whenCalled('findAllBelongsToAdmin')->answers([$panier_musique]); - - $this->dispatch('admin/menus/catalogue?'.http_build_query(['id_module' => 7, - 'id_profil' => 5, - 'preferences' => 'id_catalogue=0|id_panier=1', - 'type_menu' => 'CATALOGUE']), - true); - } - - - /** @test */ - public function selectIdPanierShouldContainsPanierBdOnce() { - $this->assertXPathCount('//select[@name="id_panier"]/option[@value="1"][@selected="selected"]',1); - } - - - /** @test */ - public function selectIdPanierShouldContainsPanierRomain() { - $this->assertXPathContentContains('//select[@name="id_panier"]/option[@value="2"]', 'romans'); - } - - - /** @test */ - public function selectIdPanierShouldContainsPanierMusique() { - $this->assertXPathContentContains('//select[@name="id_panier"]/option[@value="3"]', - 'musique'); - } - - - /** @test */ - public function selectIdPanierShouldNotContainsPanierAutres() { - $this->assertNotXPath('//select[@name="id_panier"]/option[@value="4"]'); - } -} - -?> \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/ModulesControllerTest.php b/tests/application/modules/admin/controllers/ModulesControllerTest.php index 4aac3adac263a1f6cc2f775e0af3611a3ee46aef..443a71b644f1ac53453d9c63fe28e8bf60d02761 100644 --- a/tests/application/modules/admin/controllers/ModulesControllerTest.php +++ b/tests/application/modules/admin/controllers/ModulesControllerTest.php @@ -32,7 +32,7 @@ class ModulesControllerRechercheTest extends Admin_AbstractControllerTestCase { /** @test */ public function titleShouldBeRecordDisplayProperty() { - $this->assertXPathContentContains('//h1', 'Propriétés d\'affichage des notices'); + $this->assertXPathContentContains('//h1', 'Configuration de l\'affichage'); } @@ -339,8 +339,14 @@ class ModulesControllerRechercheViewnoticeEmptyLinksZonesPostTest /** @test */ - public function shouldNotHaveErrors() { - $this->assertNotXPath('//ul[@class="error"]'); + public function withNoErrorsShouldRedirect() { + $this->assertRedirect(); + } + + + /** @test */ + public function notifyShouldContainsSuccessMessage() { + $this->assertFlashMessengerContentContains('La configuration a été enregistrée'); } } diff --git a/tests/application/modules/admin/controllers/NewsletterControllerTest.php b/tests/application/modules/admin/controllers/NewsletterControllerTest.php index 01a09fd7340e04cc8a73e4352bb3b857e86cba17..792c25d8fc3433e5effe63e79ab671f64e80ec17 100644 --- a/tests/application/modules/admin/controllers/NewsletterControllerTest.php +++ b/tests/application/modules/admin/controllers/NewsletterControllerTest.php @@ -389,7 +389,7 @@ class Admin_NewsletterControllerAddActionPostTest extends Admin_NewsletterContro /** @test */ public function shouldRedirectToEdit() { - $this->assertRedirectTo('/admin/newsletter/edit/id/' . $this->_new->getId()); + $this->assertRedirectTo(Class_Url::absolute('/admin/newsletter/edit/id/' . $this->_new->getId())); } diff --git a/tests/application/modules/admin/controllers/OpdsControllerTest.php b/tests/application/modules/admin/controllers/OpdsControllerTest.php index 115f950335f71393457a720888b7e5161eb27f27..06435b358110899e2c751758888170924e9e7819 100644 --- a/tests/application/modules/admin/controllers/OpdsControllerTest.php +++ b/tests/application/modules/admin/controllers/OpdsControllerTest.php @@ -221,9 +221,8 @@ class Admin_OpdsControllerAddPostActionTest extends Admin_OpdsControllerTestCase /** @test */ public function responseShouldRedirectToEditCatalogId99() { - $this->assertRedirectTo('/admin/opds/edit/id/99'); + $this->assertRedirectTo(Class_Url::absolute('/admin/opds/edit/id/99')); } - } @@ -314,7 +313,7 @@ class Admin_OpdsControllerEditPostActionTest extends Admin_OpdsControllerTestCas /** @test */ public function shouldRedirectToEdit() { - $this->assertRedirectTo('/admin/opds/edit/id/2'); + $this->assertRedirectTo(Class_Url::absolute('/admin/opds/edit/id/2')); } } diff --git a/tests/application/modules/admin/controllers/ProfilControllerPageAccueilTest.php b/tests/application/modules/admin/controllers/ProfilControllerPageAccueilTest.php index acc1c2a773a191000208cb876dd312234bc7b3b3..e6e1ae2b20fefbfa07e0d1e08a8a3e92b96ac452 100644 --- a/tests/application/modules/admin/controllers/ProfilControllerPageAccueilTest.php +++ b/tests/application/modules/admin/controllers/ProfilControllerPageAccueilTest.php @@ -124,60 +124,60 @@ class Admin_ProfilControllerPageAccueilJeunesseTest extends Admin_ProfilControll /** @test **/ public function boitePanierShouldBeInDivisionFive() { - $this->assertXPath('//ul[@id="box5"]/li[@id="PANIER"][@id_module="99"]//a[contains(@href, "accueil/panier")]'); + $this->assertXPath('//ul[@id="box5"]/li[@id="PANIER"][@id_module="99"]//a[contains(@href, "admin/widget/edit-widget/id/99/id_profil/7")]'); } /** @test */ public function boitePretsShouldBeAvailable() { - $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="PRETS"]','Prêts'); + $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="PRETS"]','prêts'); } /** @test */ public function domainBrowserModuleShouldBeAvailable() { - $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="DOMAIN_BROWSER"]','Domaines'); + $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="DOMAIN_BROWSER"]','domaines'); } /** @test */ public function boitePretsShouldBeInDivisionOne() { - $this->assertXPath('//ul[@id="box1"]/li[@id="PRETS"][@id_module="9"]//a[contains(@href,"accueil/prets")]'); + $this->assertXPath('//ul[@id="box1"]/li[@id="PRETS"][@id_module="9"]//a[contains(@href,"admin/widget/edit-widget/id/9/id_profil/7")]'); } /** @test */ public function boiteReservationsShouldBeAvailable() { - $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="RESERVATIONS"]','Réservations'); + $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="RESERVATIONS"]','réservations'); } /** @test */ public function boitePanierShouldBeAvailable() { - $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="PANIER"]','Panier'); + $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="PANIER"]','paniers'); } /** @test */ public function boiteReservationsShouldBeInDivisionOne() { - $this->assertXPath('//ul[@id="box1"]/li[@id="RESERVATIONS"][@id_module="8"]//a[contains(@href,"accueil/reservations")]'); + $this->assertXPath('//ul[@id="box1"]/li[@id="RESERVATIONS"][@id_module="8"]//a[contains(@href,"admin/widget/edit-widget/id/8")]'); } /** @test */ public function boiteHistoriqueRecherchesShouldBeAvailable() { - $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="HISTORIQUE_RECHERCHES"]','Historique recherches'); + $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="HISTORIQUE_RECHERCHES"]','historique recherches'); } /** @test */ public function boiteFormationsShouldBeAvailable() { - $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="FORMATIONS_WIDGET"]','Formations'); + $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="FORMATIONS_WIDGET"]','formations'); } /** @test */ public function boiteFormationsActionShouldBeFormations() { - $this->assertXPath('//ul[@id="allItems"]/li[@id="FORMATIONS_WIDGET"]//a[contains(@href, "accueil/formations-widget")]', $this->_response->getBody()); + $this->assertXPath('//ul[@id="allItems"]/li[@id="FORMATIONS_WIDGET"]//a[contains(@href, "admin/widget/edit-widget")]'); } @@ -277,7 +277,7 @@ class Admin_ProfilControllerPageAccueilJeunesseTest extends Admin_ProfilControll $news = $profil_jeunesse->getModuleAccueilConfig(2, 'NEWS'); $this->assertEquals(1, $news['division']); $this->assertEquals('NEWS', $news['type_module']); - $this->assertEquals('Articles', $news['preferences']['titre']); + $this->assertEquals('Boite articles', $news['preferences']['titre']); } @@ -430,215 +430,6 @@ class ProfilControllerPageAccueilWithTelephoneNoPackMobileNoBibNumTest extends A -class Admin_ProfilControllerPageAccueilJeunesseConfigPretsTest extends Admin_ProfilControllerPageAccueilJeunesseTestCase { - public function setup() { - parent::setup(); - $this->dispatch('admin/accueil/prets?config=admin&id_profil=7&type_module=PRETS&id_module=9&proprietes=boite=---titre=Mes prets',true); - } - - /** @test */ - public function actionShouldBePrets() { - $this->assertAction('prets'); - } - - /** @test */ - public function titleShouldBeProprieteDuModulePret() { - $this->assertXPathContentContains('//h1','Propriétés du module Prêts'); - } - - - /** @test */ - public function comboBoiteShouldBePresent() { - $this->assertXPath('//select[@name="boite"]/option[@value="boite_de_la_division_droite"]'); - } - - - /** @test */ - public function titreInputShouldHaveValueMesPrets() { - $this->assertXPath('//input[@name="titre"][@value="Mes prets"]'); - } - -} - - - -class Admin_ProfilControllerPageAccueilJeunesseConfigEmptyPretTest extends Admin_ProfilControllerPageAccueilJeunesseTestCase { - public function setup() { - parent::setup(); - $this->dispatch('admin/accueil/prets?config=admin&id_profil=7&type_module=PRETS&id_module=9',true); - - } - - /** @test */ - public function titreInputShouldHaveValueMesPrets() { - $this->assertXPath('//input[@name="titre"][@value="Mes prêts"]'); - } -} - - - - -class Admin_ProfilControllerPageAccueilJeunesseConfigEmptyHistoriqueRecherchesTest extends Admin_ProfilControllerPageAccueilJeunesseTestCase { - public function setup() { - parent::setup(); - $this->dispatch('admin/accueil/historique-recherches?config=admin&id_profil=7&type_module=HISTORIQUE_RECHERCHES&id_module=13',true); - - } - - /** @test */ - public function titreInputShouldHaveValueMesPrets() { - $this->assertXPath('//input[@name="titre"][@value="Mes recherches"]'); - } -} - - - - -class Admin_ProfilControllerPageAccueilJeunesseConfigReservationsTest extends Admin_ProfilControllerPageAccueilJeunesseTestCase { - public function setup() { - parent::setup(); - $this->dispatch('admin/accueil/reservations?config=admin&id_profil=7&type_module=RESERVATIONS&id_module=8&proprietes=boite=---titre=Mes reservations',true); - } - - /** @test */ - public function actionShouldBeReservations() { - $this->assertAction('reservations'); - } - - /** @test */ - public function titleShouldBeProprieteDuModuleReservations() { - $this->assertXPathContentContains('//h1','Propriétés du module Réservations'); - } - - - /** @test */ - public function comboBoiteShouldBePresent() { - $this->assertXPath('//select[@name="boite"]/option[@value="boite_de_la_division_droite"]'); - } - - - /** @test */ - public function titreInputShouldHaveValueMesReservations() { - $this->assertXPath('//input[@name="titre"][@value="Mes reservations"]'); - } - -} - - - -class Admin_ProfilControllerPageAccueilJeunesseConfigEmptyReservationTest extends Admin_ProfilControllerPageAccueilJeunesseTestCase { - - public function setup() { - parent::setup(); - $this->dispatch('admin/accueil/reservations?config=admin&id_profil=7&type_module=RESERVATIONS&id_module=8',true); - - } - - /** @test */ - public function titreInputShouldHaveValueMesReservations() { - $this->assertXPath('//input[@name="titre"][@value="Mes réservations"]'); - } -} - - - -class Admin_ProfilControllerPageAccueilJeunesseConfigNewslettersTest extends Admin_ProfilControllerPageAccueilJeunesseTestCase { - public function setup() { - parent::setup(); - $this->dispatch('admin/accueil/newsletters?config=admin&id_profil=7&type_module=NEWSLETTERS&id_module=10&proprietes=boite=---titre=Mes newsletters',true); - } - - /** @test */ - public function actionShouldBeNewsletters() { - $this->assertAction('newsletters'); - } - - /** @test */ - public function titleShouldBeProprieteDuModuleNewsletters() { - $this->assertXPathContentContains('//h1','Propriétés du module Lettres d\'informations',$this->_response->getBody()); - } - - - /** @test */ - public function comboBoiteShouldBePresent() { - $this->assertXPath('//select[@name="boite"]/option[@value="boite_de_la_division_droite"]'); - } - - - /** @test */ - public function titreInputShouldHaveValueMesNewsletters() { - $this->assertXPath('//input[@name="titre"][@value="Mes newsletters"]',$this->_response->getBody()); - } - -} - - - -class Admin_ProfilControllerPageAccueilJeunesseConfigEmptyNewsletterTest extends Admin_ProfilControllerPageAccueilJeunesseTestCase { - public function setup() { - parent::setup(); - $this->dispatch('admin/accueil/newsletters?config=admin&id_profil=7&type_module=NEWSLETTERS&id_module=10', true); - - } - - - /** @test */ - public function titreInputShouldHaveValueMesNewsletters() { - $this->assertXPath( - '//input[@name="titre"][@value="Lettres d\'informations"]', - $this->_response->getBody()); - } -} - - -class Admin_ProfilControllerPageAccueilJeunesseConfigMultimediaTest extends Admin_ProfilControllerPageAccueilJeunesseTestCase { - public function setup() { - parent::setup(); - $this->dispatch('admin/accueil/multimedia?config=admin&id_profil=7&type_module=MULTIMEDIA&id_module=8&proprietes=boite=---titre=Postes multimedia',true); - } - - /** @test */ - public function actionShouldBeMultimedia() { - $this->assertAction('multimedia'); - } - - /** @test */ - public function titleShouldBeProprieteDuModuleMultimedia() { - $this->assertXPathContentContains('//h1','Propriétés du module Postes Multimédia'); - } - - - /** @test */ - public function comboBoiteShouldBePresent() { - $this->assertXPath('//select[@name="boite"]/option[@value="boite_de_la_division_droite"]'); - } - - - /** @test */ - public function titreInputShouldHaveValueMesMultimedia() { - $this->assertXPath('//input[@name="titre"][@value="Postes multimedia"]'); - } - -} - - - -class Admin_ProfilControllerPageAccueilJeunesseConfigEmptyMultimediaTest extends Admin_ProfilControllerPageAccueilJeunesseTestCase { - public function setup() { - parent::setup(); - $this->dispatch('admin/accueil/multimedia?config=admin&id_profil=7&type_module=MULTIMEDIA&id_module=12', true); - } - - - /** @test */ - public function titreInputShouldHaveValuePostesMultimedia() { - $this->assertXPath('//input[@name="titre"][@value="Postes multimédia"]'); - } -} - - - - class Admin_ProfilControllerPageAccueilJeunesseWithUseParentCssFalseTest extends Admin_ProfilControllerPageAccueilJeunesseTestCase { public function setUp() { @@ -710,57 +501,6 @@ class Admin_ProfilControllerPageAccueilJeunesseWithPageCssNouveauteTest extends -class Admin_ProfilControllerPageAccueilJeunesseConfigPanierTest extends Admin_ProfilControllerPageAccueilJeunesseTestCase { - public function setup() { - parent::setup(); - $this->dispatch('admin/accueil/panier?config=admin&id_profil=7&type_module=PANIER&id_module=81&proprietes=boite=---titre=Panier',true); - } - - - /** @test */ - public function actionShouldBePanier() { - $this->assertAction('panier'); - } - - - /** @test */ - public function titleShouldBeProprieteDuModulePanier() { - $this->assertXPathContentContains('//h1','Propriétés du module Panier'); - } - - - /** @test */ - public function comboBoiteShouldBePresent() { - $this->assertXPath('//select[@name="boite"]/option[@value="boite_de_la_division_droite"]'); - } - - - /** @test */ - public function titreInputShouldHaveValuePanier() { - $this->assertXPath('//input[@name="titre"][@value="Panier"]'); - } -} - - - -class Admin_ProfilControllerPageAccueilJeunesseConfigEmptyPanierTest extends Admin_ProfilControllerPageAccueilJeunesseTestCase { - public function setup() { - parent::setup(); - $this->dispatch('admin/accueil/panier?config=admin&id_profil=7&type_module=PANIER&id_module=81', true); - } - - - /** @test */ - public function titreInputShouldHaveValuePanier() { - $this->assertXPath( - '//input[@name="titre"][@value="Panier"]', - $this->_response->getBody()); - } -} - - - - abstract class Admin_ProfilControllerPageAccueilNoBoitePanierTestCase extends Admin_AbstractControllerTestCase { protected $profil_no_panier; diff --git a/tests/application/modules/admin/controllers/ProfilControllerProfilJeunesseAndAdultesWithMenusTest.php b/tests/application/modules/admin/controllers/ProfilControllerProfilJeunesseAndAdultesWithMenusTest.php index ffd63cb87452fe0174d3a9320268f46ed7f60c71..d531cf7dbae0b0512c74e2b159e4ffd75bb04e79 100644 --- a/tests/application/modules/admin/controllers/ProfilControllerProfilJeunesseAndAdultesWithMenusTest.php +++ b/tests/application/modules/admin/controllers/ProfilControllerProfilJeunesseAndAdultesWithMenusTest.php @@ -247,7 +247,7 @@ class ProfilControllerProfilJeunesseAndAdultesWithMenusTestRender extends Profil $this->assertNotXPath('//div[@id="header"]//div[@class="share"]'); } - /** @test **/ + /** @test **/ public function modeleCssGlobalShouldBeInHeader() { $this->assertXPath('//head','skins/modele/css/global.css',$this->_response->getBody()); } @@ -346,99 +346,4 @@ class ProfilControllerProfilJeunesseAndAdultesWithMenusTestMovePageMusiqueToProf $mon_menu = array_last($this->profil_adulte->getCfgMenusAsArray()); $this->assertEquals('Profil Jeunesse:: Mon menu', $mon_menu['libelle']); } -} - - - -class ProfilControllerProfilMediathequeMenuVerticalWithNoLinkToProfilTest extends Admin_AbstractControllerTestCase { - - protected - $_menu_mediatheque, - $_cfg_menus, - $_profil_mediatheque; - - public function setup() { - parent::setup(); - - $this->_menu_mediatheque = ['libelle' => 'menu de la mediatheque', - 'picto' => 'vide.gif', - 'menus' => ['type_menu' => 'MENU', - 'libelle' => 'Informations', - 'picto' => 'vide.gif', - 'preferences' => []]]; - - $this->_cfg_menus = ['H' => $this->_menu_mediatheque]; - - $this->_profil_mediatheque = Class_Profil::getLoader() - ->newInstanceWithId(999) - ->setBrowser('opac') - ->setSkin('modele') - ->setTitreSite('Médiathèque de Bron') - ->setLibelle('Profil Mediatheque') - ->setCfgMenus($this->_cfg_menus); - } - - - /** @test **/ - public function paramsOfProfilMediathequeShouldContainsSelectProfil() { - $this->dispatch('/admin/menus/lienprofil?id_profil=999&type_menu=MENU&id_module=1&libelle=menu%C3%de%C3%la%C3%mediatheque&picto=vide.gif&preferences='); - $this->assertXpath('//form//select',$this->_response->getBody()); - } - - - /** @test **/ - public function withOutPreferencesProfilSelectShouldBeEmpty() { - $this->dispatch('/admin/menus/lienprofil?id_profil=999&type_menu=MENU&id_module=1&libelle=menu%C3%de%C3%la%C3%mediatheque&picto=vide.gif&preferences='); - $this->assertXpath('//form//select/option[@value=""]',$this->_response->getBody()); - } -} - - - -class ProfilControllerProfilMediathequeMenuVerticalWithLinkToProfilTest extends Admin_AbstractControllerTestCase { - - protected - $_menu_mediatheque, - $_cfg_menus, - $_profil_mediatheque; - - public function setup() { - parent::setup(); - - $this->_menu_mediatheque = ['libelle' => 'menu de la mediatheque', - 'picto' => 'vide.gif', - 'menus' => ['type_menu' => 'MENU', - 'libelle' => 'Informations', - 'picto' => 'vide.gif', - 'preferences' => ['clef_profil' => '1', - 'url' => '/index/index/profil/1']]]; - - $this->_cfg_menus = ['H' => $this->_menu_mediatheque]; - - $this->_profil_mediatheque = Class_Profil::getLoader() - ->newInstanceWithId(999) - ->setBrowser('opac') - ->setSkin('modele') - ->setTitreSite('Médiathèque de Bron') - ->setLibelle('Profil Mediatheque') - ->setCfgMenus($this->_cfg_menus); - } - - - - /** @test **/ - public function withPreferencesProfilOneSelectedOptionShouldBeOne() { - $this->dispatch('/admin/menus/lienprofil?id_profil=999&type_menu=MENU&id_module=1&libelle=menu%C3%de%C3%la%C3%mediatheque&picto=vide.gif&preferences=clef_profil=1'); - $this->assertXpath('//form//select//option[@value="1"][@selected="selected"]',$this->_response->getBody()); - } - - - /** @test **/ - public function withPreferencesProfilOneSelectedOptionEmptyShouldBeAvailable() { - $this->dispatch('/admin/menus/lienprofil?id_profil=999&type_menu=MENU&id_module=1&libelle=menu%C3%de%C3%la%C3%mediatheque&picto=vide.gif&preferences=clef_profil=1'); - $this->assertXpath('//form//select/option[@value=""]',$this->_response->getBody()); - } -} - - -?> \ No newline at end of file +} \ 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 16e0ddc0918034eeeded61e5c0ddd324e8f74bff..d676666fcde2951a701f6f90192ead8035dccd39 100644 --- a/tests/application/modules/admin/controllers/ProfilControllerTest.php +++ b/tests/application/modules/admin/controllers/ProfilControllerTest.php @@ -311,7 +311,7 @@ class Admin_ProfilControllerEditProfilJeunesseTest extends Admin_ProfilControlle /** @test */ public function postingLiensOff_BibTwoRedirectsToProfilIndex() { $data = array( 'liens_sortants_off' => 0, - 'id_site' => 2); + 'id_site' => 2); $this ->getRequest() ->setMethod('POST') @@ -335,9 +335,9 @@ class Admin_ProfilControllerEditProfilJeunesseTest extends Admin_ProfilControlle /** - * @test - * @depends postingLiensOff_BibTwoRedirectsToProfilIndex - */ + * @test + * @depends postingLiensOff_BibTwoRedirectsToProfilIndex + */ public function idSiteShouldBeTwo($profil_jeunesse) { $this->assertEquals(2, $profil_jeunesse->getIdSite()); } @@ -355,7 +355,7 @@ class Admin_ProfilControllerEditProfilJeunesseTest extends Admin_ProfilControlle /** @test */ public function postingLibelleJeunesseTitrePourLesJeunesShouldUpdateRightFields() { $this->_postData(array( 'libelle' => "Jeunesse", - 'titre_site' => "Pour les jeunes")); + 'titre_site' => "Pour les jeunes")); $this->assertEquals("Jeunesse", $this->profil_jeunesse->getLibelle()); $this->assertEquals("Pour les jeunes", $this->profil_jeunesse->_get('titre_site')); @@ -366,7 +366,7 @@ class Admin_ProfilControllerEditProfilJeunesseTest extends Admin_ProfilControlle /** @test */ public function postingBoitesBanniereAndLoginShouldUpdateCreateThem() { $this->_postData(array( 'boite_login_in_banniere' => false, - 'boite_recherche_simple_in_banniere' => true)); + 'boite_recherche_simple_in_banniere' => true)); $this->assertFalse($this->profil_jeunesse->getBoiteLoginInBanniere()); $this->assertTrue($this->profil_jeunesse->getBoiteRechercheSimpleInBanniere()); @@ -407,64 +407,64 @@ class Admin_ProfilControllerEditProfilJeunesseTest extends Admin_ProfilControlle -class Admin_ProfilControllerProfilJeunesseTestMenusMaj extends Admin_ProfilControllerProfilJeunesseTestCase { +class Admin_ProfilControllerProfilJeunesseEditMenuTest extends Admin_ProfilControllerProfilJeunesseTestCase { /** @test */ public function withModuleFormationEnabledComboMenuShouldContainsFormations() { - Class_AdminVar::getLoader() - ->newInstanceWithId('FORMATIONS') - ->setValeur('1'); - $this->dispatch('admin/profil/menusmaj/id_profil/5/id_menu/H/mode/edit', true); - $this->assertXPathContentContains('//option', 'Formations'); + $this->fixture('Class_AdminVar', + ['id' => 'FORMATIONS', + 'valeur' => '1']); + $this->dispatch('admin/widget/edit-menu/id/H/id_profil/5', true); + $this->assertXPathContentContains('//li', 'Lien vers mes formations'); } /** @test */ public function withModuleFormationDisabledComboMenuShouldNotContainsFormations() { - Class_AdminVar::getLoader() - ->newInstanceWithId('FORMATIONS') - ->setValeur('0'); - $this->dispatch('admin/profil/menusmaj/id_profil/5/id_menu/H/mode/edit',true); - $this->assertNotXPathContentContains('//option', 'Formations'); + $this->fixture('Class_AdminVar', + ['id' => 'FORMATIONS', + 'valeur' => '0']); + $this->dispatch('admin/widget/edit-menu/id/H/id_profil/5', true); + $this->assertNotXPathContentContains('//li', 'Lien vers mes formations'); } /** @test */ public function withBibNumberiqueEnabledComboMenuShouldContainsLienVersUnAlbum() { - Class_AdminVar::getLoader() - ->newInstanceWithId('BIBNUM') - ->setValeur('1'); - $this->dispatch('admin/profil/menusmaj/id_profil/5/id_menu/H/mode/edit'); - $this->assertXPathContentContains('//option', 'Lien vers un album'); + $this->fixture('Class_AdminVar', + ['id' => 'BIBNUM', + 'valeur' => '1']); + $this->dispatch('admin/widget/edit-menu/id/H/id_profil/5', true); + $this->assertXPathContentContains('//li', 'Lien vers un album'); } /** @test */ public function withBibNumberiqueDisabledComboMenuShouldNotContainsLienVersUnAlbum() { - Class_AdminVar::getLoader() - ->newInstanceWithId('BIBNUM') - ->setValeur('0'); - $this->dispatch('admin/profil/menusmaj/id_profil/5/id_menu/H/mode/edit'); - $this->assertNotXPathContentContains('//option', 'Lien vers un album'); + $this->fixture('Class_AdminVar', + ['id' => 'BIBNUM', + 'valeur' => '0']); + $this->dispatch('admin/widget/edit-menu/id/H/id_profil/5', true); + $this->assertNotXPathContentContains('//li', 'Lien vers un album'); } /** @test */ public function withMultimediaEnabledComboMenuShouldContainsReserverPosteMultimedia() { - Class_AdminVar::getLoader() - ->newInstanceWithId('MULTIMEDIA_KEY') - ->setValeur('I love multimedia'); - $this->dispatch('admin/profil/menusmaj/id_profil/5/id_menu/H/mode/edit'); - $this->assertXPathContentContains('//option', 'Réserver un poste multimédia'); + $this->fixture('Class_AdminVar', + ['id' => 'MULTIMEDIA_KEY', + 'valeur' => 'I love multimedia']); + $this->dispatch('admin/widget/edit-menu/id/H/id_profil/5', true); + $this->assertXPathContentContains('//li', 'un poste multimédia'); } /** @test */ public function withMultimediaDisabledComboMenuShouldNotContainsReserverPosteMultimedia() { - Class_AdminVar::getLoader() - ->newInstanceWithId('MULTIMEDIA_KEY') - ->setValeur(null); - $this->dispatch('admin/profil/menusmaj/id_profil/5/id_menu/H/mode/edit'); - $this->assertNotXPathContentContains('//option', 'Réserver un poste multimédia'); + $this->fixture('Class_AdminVar', + ['id' => 'MULTIMEDIA_KEY', + 'valeur' => null]); + $this->dispatch('admin/widget/edit-menu/id/H/id_profil/5', true); + $this->assertNotXPathContentContains('//li', 'un poste multimédia'); } @@ -483,8 +483,8 @@ l66WXceACmsgGWEdHMB7ZPUd4HqR5bdE1Xnr1Q0Z9IIku6Naxt/yy0P5Gv+ZlW7U ['valeur' => 'http://resa.zebib.net']); - $this->dispatch('admin/profil/menusmaj/id_profil/5/id_menu/H/mode/edit'); - $this->assertXPathContentContains('//option', 'Réserver un poste Webkiosk'); + $this->dispatch('admin/widget/edit-menu/id_profil/5/id/H'); + $this->assertXPathContentContains('//li', 'poste Webkiosk'); } @@ -496,23 +496,23 @@ l66WXceACmsgGWEdHMB7ZPUd4HqR5bdE1Xnr1Q0Z9IIku6Naxt/yy0P5Gv+ZlW7U Class_AdminVar::newInstanceWithId('WEBKIOSK_RESERVATION_URL', ['valeur' => null]); - $this->dispatch('admin/profil/menusmaj/id_profil/5/id_menu/H/mode/edit'); - $this->assertNotXPathContentContains('//option', 'Réserver un poste Webkiosk'); + $this->dispatch('admin/widget/edit-menu/id_profil/5/id/H'); + $this->assertNotXPathContentContains('//option', 'poste Webkiosk'); } /** @test */ public function registerLinkShouldBePresent() { - $this->dispatch('admin/profil/menusmaj/id_profil/5/id_menu/H/mode/edit'); - $this->assertXPathContentContains('//optgroup[@label="Navigation"]//option', 'S\'enregistrer'); + $this->dispatch('admin/widget/edit-menu/id_profil/5/id/H'); + $this->assertXPathContentContains('//li', 'enregistrement'); } /** @test */ public function preRegistrationLinkShouldBePresent() { - $this->dispatch('admin/profil/menusmaj/id_profil/5/id_menu/H/mode/edit'); - $this->assertXPathContentContains('//optgroup[@label="Navigation"]//option', 'Se préinscrire'); + $this->dispatch('admin/widget/edit-menu/id_profil/5/id/H'); + $this->assertXPathContentContains('//li', 'préinscription'); } } @@ -598,8 +598,8 @@ class Admin_ProfilControllerEditProfilVideTest extends Admin_AbstractControllerT '5' => 'rédacteur portail', '6' => 'administrateur portail') as $level => $label) - $this->assertXPathContentContains("//select[@name='access_level']//option[@value='$level']", - $label); + $this->assertXPathContentContains("//select[@name='access_level']//option[@value='$level']", + $label); $this->assertNotXPath("//select[@name='access_level']//option[@value='1']"); $this->assertNotXPath("//select[@name='access_level']//option[@value='8']"); @@ -639,7 +639,7 @@ class Admin_ProfilControllerEditProfilVideTest extends Admin_AbstractControllerT */ public function errorsShouldContainsSommeLargeursDivisionsError($profil_vide) { $this->assertContains("La somme des largeurs des divisions ne doit pas excéder la largeur du site.", - $profil_vide->getErrors()); + $profil_vide->getErrors()); } } @@ -684,22 +684,14 @@ class Admin_ProfilControllerProfilJeunesseTestMenusIndex extends Admin_ProfilCon ->whenCalled('findAllByZoneAndBib') ->answers(array($profil_portail, $this->profil_jeunesse, $profil_vide)); - $this->dispatch('/admin/profil/menusindex?id_profil=5'); - } - - - /** @test */ - public function menusindexPageShouldDisplayMenuVerticalAndHorizontal() { - $this->assertQueryContentContains("tr.second td", "Menu horizontal"); - $this->assertQueryContentContains("tr.first td", "Menu"); + $this->dispatch('/admin/profil/menusindex/id_profil/5'); } /** @test */ public function profilJeunessePanelShouldBeVisible() { $this->assertXPathContentContains("//div[contains(@class,'profils')]//ul//li//div", - "Profil Jeunesse", - $this->_response->getBody()); + "Profil Jeunesse"); } @@ -710,35 +702,35 @@ class Admin_ProfilControllerProfilJeunesseTestMenusIndex extends Admin_ProfilCon /** @test */ public function editMenuHorizontalLink() { - $this->assertXPath("//tr[@class='second']//td//a[contains(@href, 'menusmaj/id_profil/5/id_menu/H/mode/edit')]"); + $this->assertXPath("//a[contains(@href, 'admin/widget/edit-menu/id/H/id_profil/5')]"); } /** @test */ public function duplicateHorizontalMenu() { - $this->assertXPath("//tr[@class='second']//td//a[contains(@href, 'admin/profil/duplicate-horizontal-menu/id_profil/5')]"); + $this->assertXPath("//a[contains(@href, 'admin/profil/duplicate-horizontal-menu/id_profil/5')]"); } /** @test */ public function cannotDeleteMenuHorizontalLink() { - $this->assertNotXPath("//tr[@class='second']//td//a[contains(@href, 'menusmaj/id_profil/5/id_menu/H/mode/delete')]"); + $this->assertNotXPath("//a[contains(@href, 'admin/widget/delete-menu/id/H/id_profil/5')]"); } /** @test */ public function editMenuVerticalLink() { - $this->assertXPath("//tr[@class='first']//td//a[contains(@href, 'menusmaj/id_profil/5/id_menu/V/mode/edit')]"); + $this->assertXPath("//a[contains(@href, 'admin/widget/edit-menu/id/V/id_profil/5/backUrl')]"); } /** @test */ - public function deleteMenuHorizontalLink() { - $this->assertXPath("//tr[@class='first']//td//a[contains(@href, 'menusmaj/id_profil/5/id_menu/V/mode/delete')]"); + public function deleteMenuVerticalLink() { + $this->assertXPath("//a[contains(@href, 'admin/widget/delete-menu/id_profil/5/id/V')]"); } /** @test */ public function addMenuLink() { - $this->assertXPath("//div[contains(@onclick, 'menusmaj/id_profil/5/mode/add')]"); + $this->assertXPath("//button[contains(@onclick, 'admin/widget/add-menu')]"); } } @@ -808,8 +800,8 @@ class Admin_ProfilControllerAddProfilHistoireTest extends Admin_AbstractControll $wrapper = Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Profil'); $data = array( 'libelle' => "Histoire", - 'id_site' => 1, - 'largeur_site' => 100); + 'id_site' => 1, + 'largeur_site' => 100); $this ->getRequest() @@ -837,22 +829,22 @@ class Admin_ProfilControllerProfilPostAddTest extends Admin_ProfilControllerProf /* $wrapper = Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Profil') ->whenCalled('save') ->willDo(function($model) { - $model->setId(456); - return true; - }); + $model->setId(456); + return true; + }); */ $data = array( 'libelle' => "Histoire", - 'id_site' => 1, - 'nb_divisions' => 3, - 'largeur_division1' => 400, - 'marge_division1' => 5, - 'largeur_division2' => 500, - 'size_site_scale' => 'percent', + 'id_site' => 1, + 'nb_divisions' => 3, + 'largeur_division1' => 400, + 'marge_division1' => 5, + 'largeur_division2' => 500, + 'size_site_scale' => 'percent', 'largeur_division3' => '30', 'width_division3_scale' => 'percent', - 'marge_division2' => 8, - 'largeur_site' => 100, - 'access_level' => 6); + 'marge_division2' => 8, + 'largeur_site' => 100, + 'access_level' => 6); $this ->getRequest() @@ -1173,7 +1165,7 @@ class Admin_ProfilControllerPostAccueilPageMusiqueWithErrorsTest extends Admin_P /** @test */ public function domainBrowserModuleShouldBeAvailable() { - $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="DOMAIN_BROWSER"]','Domaines'); + $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="DOMAIN_BROWSER"]','domaines'); } @@ -1390,9 +1382,7 @@ class Admin_ProfilControllerGenresActionTest extends Admin_AbstractControllerTes } -/** - * [[file:~/afi/afi-opac3/application/modules/admin/controllers/ProfilController.php::public%20function%20menusmajAction()%20{][Action menusmaj]] - */ + class Admin_ProfilControllerEditMenuHorizontalTest extends Admin_AbstractControllerTestCase { public function setUp() { parent::setUp(); @@ -1409,34 +1399,34 @@ class Admin_ProfilControllerEditMenuHorizontalTest extends Admin_AbstractControl "picto" => "vide.gif")); $this->profil_jazz = Class_Profil::newInstanceWithId(5, [ 'browser' => 'opac', - 'libelle' => 'Jazz pour tous', - 'cfg_menus' => $cfg_menus ]); + 'libelle' => 'Jazz pour tous', + 'cfg_menus' => $cfg_menus ]); Class_Systeme_ModulesMenu::reset(); Class_AdminVar::newInstanceWithId('MENU_BOITE', ['valeur' => '1']); - $this->dispatch('admin/profil/menusmaj/id_profil/5/id_menu/H/mode/edit', true); + $this->dispatch('admin/widget/edit-menu/id_profil/5/id/H', true); } /** @test */ public function tdShouldContainsPratique() { - $this->assertXPathContentContains("//td/span","Pratique"); + $this->assertXPathContentContains("//li","Pratique"); } /** @test */ public function selectOptionShouldContainsMenu() { - $this->assertXPathContentContains("//td/select/option","Menu"); + $this->assertXPathContentContains("//li","Menu"); } /** @test */ public function selectOptgroupShouldContainsModulesInformations() { - $this->assertXPath("//td//optgroup[@label='Modules informations']",$this->_response->getBody()); + $this->assertXPath("//li"); } /** @test */ public function selectOptionShouldContainsBoiteDeuxColonnes() { - $this->assertXPathContentContains("//td//select//option", "Boite deux colonnes", $this->_response->getBody()); + $this->assertXPathContentContains("//li", "Boite deux colonnes"); } } @@ -1597,4 +1587,86 @@ class Admin_ProfilControllerIndexWithLibraryAdminConnectedTest extends Admin_Abs public function shouldContainsProfilModule() { $this->assertXPath('//div[@class="modules"]'); } +} + + + + +class ProfilControllerPostDispatchAccueilProfilTest extends Admin_AbstractControllerTestCase { + protected $_storm_default_to_volatile = true; + + public function setUp() { + parent::setUp(); + $this->fixture('Class_CustomField', + ['id' => 1, + 'priority' => 3, + 'label' => 'Public', + 'field_type' => Class_CustomField_Meta::SELECT, + 'options_list' => 'junior; senior; ', + 'model' => 'Article']); + $this->fixture('Class_CustomField', + ['id' => 2, + 'priority' => 3, + 'label' => 'Theme', + 'field_type' => Class_CustomField_Meta::SELECT, + 'options_list' => 'music;theater;movie', + 'model' => 'Article']); + + $this->fixture('Class_Profil', + ['id' => 1, + 'libelle' => 'Afibre']) + ->updateModuleConfigAccueil(1, ['type_module' => 'CALENDAR', + 'division' => 1, + 'id_module' => 1, + 'preferences' => ['nb_events' => 3, + 'rss_avis' => 0, + 'display_calendar' => 1, + 'mode-affichage' => 'diaporama_navigation', + 'op_navigation_mode' => 'next_previous', + 'display_event_info' => 'bib', + 'display_mode' => 'Summary', + 'display_order' => 'EventDebut', + 'display_cat_select' => '', + 'enabled_filters' => 'date;place;custom_field_1', + 'id_categorie' => '', + 'event_filter' => 'none']]) + ->beCurrentProfil(); + + $this->postDispatch('admin/profil/accueil/id_profil/1', + ['libelle' => 'new title', + 'use_parent_css' => 1, + 'page_css' => '', + 'saveContent' => 'box2|5|CALENDAR|titre=Calendrier+des+animations---id_categorie=---display_cat_select=---display_event_info=bib---rss_avis=0---display_next_event=1---display_order=EventDebut---display_mode=Title---nb_events=3---display_calendar=1---mode-affichage=simple---event_filter=none---enabled_filters=date;place;custom_field_1;custom_field_2---boite=---id_items=---Valider=Valider---;box1|1|RESERVATIONS|titre=Mes+réservations---boite=---=---;box2|2|PRETS|titre=Mes+prêts---boite=---=---;box2|3|NEWSLETTERS|titre=Newsletters---boite=---=---;box2|4|MULTIMEDIA|titre=Postes+multimédia---boite=---=---']); + } + + + /** @test */ + public function cfgModuleShouldContainsCalendarFiltersDatePlaceAndCustomFilters() { + $prefs = Class_Profil::find(1)->getModuleAccueilPreferences(5, 'CALENDAR'); + $this->assertEquals('date;place;custom_field_1;custom_field_2', + $prefs['enabled_filters']); + + } + + + /** @test */ + public function calendarDivisionShouldBeTwo() { + $config = Class_Profil::find(1)->getModuleAccueilConfig(5, 'CALENDAR'); + $this->assertEquals(2, + $config['division']); + } + + + /** @test */ + public function reservationsDivisionShouldBeOne() { + $config = Class_Profil::find(1)->getModuleAccueilConfig(1, 'RESERVATIONS'); + $this->assertEquals(1, + $config['division']); + } + + + /** @test */ + public function profilShouldHaveFiveModules() { + $this->assertEquals(5, count(Class_Profil::find(1)->getCfgAccueilAsArray()['modules'])); + } } \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/SitothequeControllerTest.php b/tests/application/modules/admin/controllers/SitothequeControllerTest.php index c679d53f63add5fa64ca743f6b816f88ed0e4ede..4d771bff872a3ca4b0f96f5cb72d145dcb12c9f8 100644 --- a/tests/application/modules/admin/controllers/SitothequeControllerTest.php +++ b/tests/application/modules/admin/controllers/SitothequeControllerTest.php @@ -285,7 +285,7 @@ class SitothequeControllerPostAddActionTest extends SitothequeControllerTestCase /** @test */ public function anwersShouldRedirectToSitoEdit24() { - $this->assertRedirectTo('/admin/sito/edit/id/24'); + $this->assertRedirectTo(Class_Url::absolute('/admin/sito/edit/id_cat/2/id/24')); } @@ -410,7 +410,7 @@ class SitothequeControllerSitoPostEditLeMondeTest extends SitothequeControllerTe /** @test */ public function anwersShouldRedirectToSitoEdit23() { - $this->assertRedirectTo('/admin/sito/edit/id/23'); + $this->assertRedirectTo(Class_Url::absolute('/admin/sito/edit/id/23')); } } diff --git a/tests/application/modules/admin/controllers/UserGroupControllerTest.php b/tests/application/modules/admin/controllers/UserGroupControllerTest.php index 7f5a9195d148421a4355535531cac1530a99c7d9..ba28b9904b6dfa4972c836b6e15c7e923b514968 100644 --- a/tests/application/modules/admin/controllers/UserGroupControllerTest.php +++ b/tests/application/modules/admin/controllers/UserGroupControllerTest.php @@ -785,7 +785,7 @@ class Admin_UserGroupControllerEditStagiairesPostDataTest extends Admin_UserGrou /** @test */ public function responseShouldRedirectToEdit() { - $this->assertRedirectTo('/admin/usergroup/edit/id/3'); + $this->assertRedirectTo(Class_Url::absolute('/admin/usergroup/edit/id/3')); } diff --git a/tests/application/modules/admin/controllers/WidgetControllerTest.php b/tests/application/modules/admin/controllers/WidgetControllerTest.php new file mode 100644 index 0000000000000000000000000000000000000000..25d33040816ba2b0866360155ae27d6101b937b0 --- /dev/null +++ b/tests/application/modules/admin/controllers/WidgetControllerTest.php @@ -0,0 +1,2024 @@ +<?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 + */ + +abstract class WidgetControllerWidgetConfigurationTestCase extends Admin_AbstractControllerTestCase { + protected + $_storm_default_to_volatile = true, + $_profil, + $_type_module = '', + $_preferences = [], + $_division = 3; + + + public function setUp() { + parent::setUp(); + $this->_profil = $this->fixture('Class_Profil', ['id' => 5]); + $simple_widgets = ['modules' => ['6' => ['division' => $this->_division, + 'id_module' => '6', + 'type_module' => $this->_type_module, + 'preferences' => $this->_preferences]]]; + $this->_profil->setCfgAccueil($simple_widgets)->save(); + $this->_stormHook(); + } + + + protected function _stormHook() {} +} + + + + +abstract class WidgetControllerDispatchWidgetConfigurationTestCase extends WidgetControllerWidgetConfigurationTestCase { + public function setUp() { + parent::setUp(); + $this->dispatch('/admin/widget/edit-widget/id/6/id_profil/5', true); + } +} + + + +abstract class WidgetControllerPopupDispatchWidgetConfigurationTestCase extends WidgetControllerWidgetConfigurationTestCase { + + protected $_html; + + public function setUp() { + parent::setUp(); + $this->dispatch('/admin/widget/edit-widget/id/6/id_profil/5/render/popup', true); + $this->_html = json_decode($this->_response->getBody()); + } +} + + + + +abstract class WidgetControllerPostDispatchWidgetConfigurationTestCase extends WidgetControllerWidgetConfigurationTestCase { + + protected + $_params, + $_saved_settings; + + public function setUp() { + parent::setUp(); + $this->postDispatch('/admin/widget/edit-widget/id/6/id_profil/5', $this->_params); + Class_Profil::clearCache(); + $this->_saved_settings = $this->_profil->getCfgAccueilAsArray()['modules'][6]; + } +} + + + + +class WidgetControllerKiosqueTest extends WidgetControllerDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'KIOSQUE'; + parent::setUp(); + } + + + /** @test */ + public function randomSortShouldContainsBasketOrder() { + $this->assertXPathContentContains('//fieldset//td//select[@id="tri"]/option[@value="4"]', 'par l\'ordre du panier'); + } + + + /** @test */ + public function domainesPaniersJsonUrlShouldResetActionParameters() { + $this->assertXPathContentContains('//script', 'getJSON("/admin/catalogue/domaines-paniers.json",'); + } + + + /** @test **/ + public function treeSelectShouldBeLoaded() { + $this->assertXPath('//script[contains(@src, "treeselect")]', $this->_response->getBody()); + } + + + /** @test **/ + public function configPageShouldContainsHiddenInputWithIdCategorie() { + $this->assertXPath('//input[@type="hidden"][@id="id_catalogue"]'); + } + + + /** @test **/ + public function configPageShouldContainsHiddenInputWithIdPanier() { + $this->assertXPath('//input[@type="hidden"][@id="id_panier"]'); + } + + + /** @test */ + public function selectStyleListeShouldContainsOptGroupObjetsJS() { + $this->assertXPath('//select[@name="style_liste"]//optgroup[@label="Objets javascript"]'); + } + + + /** @test */ + public function selectStyleListeShouldContainsOptGroupObjetsHTML() { + $this->assertXPath('//select[@name="style_liste"]//optgroup[@label="HTML"]'); + $this->assertXPathContentContains('//select[@name="style_liste"]//option[@value="mur"]', 'Mur'); + } + + + /** @test */ + public function selectStyleListeShouldContainsOptGroupObjetsHTMLChrono() { + $this->assertXPathContentContains('//select[@name="style_liste"]//option[@value="chrono"]', 'Frise'); + } + + + /** @test */ + public function selectOnlyImgShouldBeOnAfficheNoticesAvecVignettes() { + $this->assertXPath('//select[@name="only_img"]/option[@value="1"][@selected="selected"]'); + } + + + /** @test */ + public function profilRedirectShouldBePresent() { + $this->assertXPath('//select[@name="profil_redirect"]'); + } + + + /** @test */ + public function noProfilRedirectShouldBeSelected() { + $this->assertNotXPath('//select[@name="profil_redirect"]//option[@selected]'); + } +} + + + + +class WidgetControllerKioquePostTest extends WidgetControllerPostDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'KIOSQUE'; + $this->_params = ['id_panier'=>'5', + 'titre' => 'titre du /kiosque', + 'profil_redirect' => '12']; + parent::setUp(); + } + + + /** @test **/ + public function shouldRedirect() { + $this->assertRedirect(); + } + + + /** @test */ + public function titleShouldBeTitreDuKiosque() { + $this->assertEquals('titre du /kiosque', $this->_saved_settings['titre']); + } + + + /** @test */ + public function profilRedirectShouldBeTwelve() { + $this->assertEquals('12', $this->_saved_settings['profil_redirect']); + } +} + + + + +class WidgetControllerCalendarTest extends WidgetControllerDispatchWidgetConfigurationTestCase { + + public function setUp() { + $this->_type_module = 'CALENDAR'; + $this->_preferences = ['nb_events' => 3, + 'rss_avis' => 0, + 'display_calendar' => 1, + 'mode-affichage' => 'diaporama_navigation', + 'op_navigation_mode' => 'next_previous', + 'display_event_info' => 'bib', + 'display_mode' => 'Summary', + 'display_order' => 'EventDebut', + 'display_cat_select' => '', + 'enabled_filters' => 'date;place;custom_field_1', + 'id_categorie' => '', + 'event_filter' => 'none']; + parent::setUp(); + } + + + protected function _stormHook() { + $this->fixture('Class_CustomField', + ['id' => 1, + 'priority' => 3, + 'label' => 'Public', + 'field_type' => Class_CustomField_Meta::SELECT, + 'options_list' => 'junior; senior; ', + 'model' => 'Article']); + + $this->fixture('Class_CustomField', + ['id' => 2, + 'priority' => 3, + 'label' => 'Theme', + 'field_type' => Class_CustomField_Meta::SELECT, + 'options_list' => 'music;theater;movie', + 'model' => 'Article']); + } + + + /** @test */ + public function settingsEventFilterToDisplayShouldBePresent() { + $this->assertXPath('//select[@name="event_filter"]/option[@value="none"][@selected="selected"]'); + } + + + /** @test */ + public function selectDisplayModeShouldBeDisplay() { + $this->assertXPathContentContains('//select[@name="mode-affichage"]/option[@value="diaporama_navigation"]', 'Diaporama avec navigation'); + } + + + /** @test */ + public function selectDisplayEventInfoShouldBeDisplay() { + $this->assertXPath('//select[@name="display_event_info"]'); + } + + + /** @test */ + public function navigationModeShouldBeSetToNextPrevious() { + $this->assertXPathContentContains('//div[@id="objet_props"]//select[@name="op_navigation_mode"]/option[@value="next_previous"][@selected="selected"]', 'Boutons précédent et suivant'); + } + + + /** @test */ + public function inputFiltersShouldBePresent() { + $this->assertXPath('//div[@id="input_enabled_filters"]/input[@type="hidden"][@name="enabled_filters"]'); + } + + + /** @test */ + public function secondListShouldContainsOnlyOneElement() { + $this->assertXPathCount('//div[@id="input_enabled_filters"]/div[2]/ul/li', 1); + } + + + /** @test */ + public function secondListShouldContainsTheme() { + $this->assertXPathContentContains('//div[@id="input_enabled_filters"]/div[2]/ul/li[@data-value="custom_field_2"]', 'Theme'); + } + + + /** @test */ + public function firstListShouldContainsThreeElements() { + $this->assertXPathCount('//div[@id="input_enabled_filters"]/div[1]/ul/li', 3); + } + + + /** @test */ + public function firstListShouldContainsPublic() { + $this->assertXPathContentContains('//div[@id="input_enabled_filters"]/div[1]/ul/li[@data-value="custom_field_1"]', 'Public'); + } + + + /** @test */ + public function firstListShouldContainsMonthPlace() { + $this->assertXPathContentContains('//div[@id="input_enabled_filters"]/div[1]/ul/li[@data-value="date"]', 'Mois'); + } + + + /** @test */ + public function firstListShouldContainsPlace() { + $this->assertXPathContentContains('//div[@id="input_enabled_filters"]/div[1]/ul/li[@data-value="place"]', 'Lieu'); + } + + + /** @test */ + public function checkBoxDisableDisplayFullPageShouldBePresent () { + $this->assertXPath('//fieldset//input[@type="checkbox"][@checked="checked"][@name="display_full_page"]'); + } +} + + + + +class WidgetControllerCalendarDispatchTest extends WidgetControllerPostDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'CALENDAR'; + $this->_params = ['display_full_page' => 0]; + parent::setUp(); + } + + + /** @test */ + public function displayFullDayShouldHaveBeenSaved() { + $this->assertequals(0, $this->_saved_settings['preferences']['display_full_page']); + } +} + + + + + +class WidgetControllerArticlesDispatchTest extends WidgetControllerDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'NEWS'; + $this->_preferences = ['style_liste' => 'diaporama_navigation', + 'id_items' => '1;2']; + parent::setUp(); + } + + + /** @test */ + public function formActionShouldBeAdminAccueilNews() { + $this->assertXPath('//form[contains(@action, "admin/widget")]'); + } + + + /** @test */ + public function inputIdItemsShouldContains1and2() { + $this->assertXPath('//form//input[@name="id_items"][@value="1-2"]', $this->_response->getBody()); + } + + + /** @test */ + public function selectShouldContainsSlideShow() { + $this->assertXPathContentContains('//select/optgroup[@label="Objets java-script"]/option', 'Diaporama avec navigation'); + } + + + /** @test */ + public function selectShouldContainsAcordionList() { + $this->assertXPathContentContains('//select/optgroup[@label="Objets java-script"]/option', 'Liste en accordéon', $this->_response->getBody()); + } + + + /** @test */ + public function diaporamaNavigationShouldBeSelected() { + $this->assertXPathContentContains('//select/optgroup[@label="Objets java-script"]/option[@value="diaporama_navigation"][@selected="selected"]', 'Diaporama avec navigation', $this->_response->getBody()); + } + + + /** @test */ + public function navigationModeShouldBeDisplay() { + $this->assertXPath('//div[@id="objet_props"]//select[@name="op_navigation_mode"]'); + } + + + /** @test */ + public function navigationModePreviewShouldBePresent() { + $this->assertXPathContentContains('//div[@id="objet_props"]//select[@name="op_navigation_mode"]/option[@value="preview"]', 'Une miniature pour chaque élément'); + } + + + /** @test */ + public function styleListComboShouldNotSubmitWithAjax() { + $this->assertXPath('//script[contains(text(), "select[name=\'style_liste\']")][not(contains(text(), "initializeAjaxFormSubmit(form)"))]'); + } + + + /** @test */ + public function cycleIntervalShouldBePresent() { + $this->assertXPath('//div[@id="objet_props"]//input[@name="op_navigation_cycle"]'); + } + + + /** @test */ + public function navigationModeShouldBeSetToButtons() { + $this->assertXPathContentContains('//div[@id="objet_props"]//select[@name="op_navigation_mode"]/option[@value="buttons"][@selected="selected"]', 'Un bouton pour chaque élément', $this->_response->getBody()); + } + + + /** @test */ + public function windowWidthShouldBeSetTo350px() { + $this->assertXPath('//div[@id="objet_props"]//input[@name="op_navigation_window_width"][@value="350"]'); + } + + + /** @test */ + public function windowHeightShouldBeSetTo250px() { + $this->assertXPath('//div[@id="objet_props"]//input[@name="op_navigation_window_height"][@value="250"]'); + } + + + /** @test */ + public function displayOrderCommentCountShouldBePresent() { + $this->assertXPath('//input[@type="radio"][@name="display_order"][@value="CommentCount"]', + $this->_response->getBody()); + } + + + /** @test */ + public function unitShouldBeSetToPx() { + $this->assertXPath('//div[@id="objet_props"]//select[@name="op_navigation_unit"]/option[@value="px"]'); + } +} + + + + +class WidgetControllerArticlesPopupDispatchTest extends WidgetControllerPopupDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'NEWS'; + $this->_preferences = ['style_liste' => 'diaporama_navigation', + 'id_items' => '1;2']; + + parent::setUp(); + } + + + /** @test */ + public function styleListComboShouldSubmitWithAjax() { + $xpath = new Storm_Test_XPath(); + + $xpath->assertXPath($this->_html->content, + '//script[contains(text(), "select[name=\'style_liste\']")][contains(text(), "initializeAjaxFormSubmit(form)")]'); + } + + + /** @test */ + public function titleShouldBeNewsModuleProperties() { + $this->assertEquals($this->_html->title, 'Boite articles'); + } +} + + + + +class WidgetControllerArticlesDispatchWithNextPreviousTest extends WidgetControllerDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'NEWS'; + $this->_preferences = ['style_liste' => 'diaporama_navigation', + 'op_navigation_mode' => 'next_previous', + 'op_navigation_window_height' => 500, + 'op_navigation_window_width' => 150, + 'op_navigation_cycle' => 1000]; + parent::setUp(); + } + + + /** @test */ + public function navigationModeShouldBeSetToNextPrevious() { + $this->assertXPathContentContains('//div[@id="objet_props"]//select[@name="op_navigation_mode"]/option[@value="next_previous"][@selected="selected"]', 'Boutons précédent et suivant'); + } + + + /** @test */ + public function windowWidthShouldBeSetTo150px() { + $this->assertXPath('//div[@id="objet_props"]//input[@name="op_navigation_window_width"][@value="150"]'); + } + + + /** @test */ + public function windowHeightShouldBeSetTo500px() { + $this->assertXPath('//div[@id="objet_props"]//input[@name="op_navigation_window_height"][@value="500"]'); + } + + +/** @test */ + public function cycleShouldBeSetTo1000() { + $this->assertXPath('//div[@id="objet_props"]//input[@name="op_navigation_cycle"][@value="1000"]'); + } +} + + + + +class WidgetControllerArticlesPostDispatchTest extends WidgetControllerPostDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'NEWS'; + $this->_params = ['titre' => 'Site communautaire Bokeh', + 'anchor' => 'http://bokeh.library-portal.org', + 'rss_avis' => 0, + 'id_categorie' => '5', + 'id_items' => '1-2', + 'display_order' => 'Selection', + 'nb_aff' => 3, + 'nb_analyse' => 5, + 'boite' => '', + 'display_title_only' => 0, + 'styles_reload' => 0, + 'style_liste' => 'none']; + parent::setUp(); + } + + + /** @test */ + public function configNewsInPorfil1ShouldHaveBeenUpdated() { + $this->assertEquals('Site communautaire Bokeh', $this->_saved_settings['preferences']['titre']); + } + + + /** @test */ + public function configNewsAnchorShouldBeBokehLibraryPortalDotOrg() { + $this->assertEquals('http://bokeh.library-portal.org', $this->_saved_settings['preferences']['anchor']); + } + + + /** @test */ + public function selectedItemsShouldBe1and2() { + $this->assertEquals('1-2', $this->_saved_settings['preferences']['id_items']); + } + + + /** @test */ + public function selectedCategoriesShould1() { + $this->assertEquals('5', $this->_saved_settings['preferences']['id_categorie']); + } +} + + + +abstract class WidgetControllerVerticalNavDispatchTestCase extends WidgetControllerDispatchWidgetConfigurationTestCase { + protected function _stormHook() { + $cfg_menus_profil_portail = ['H' => ['libelle' => 'Menu horizontal', + 'picto' => 'vide.gif', + 'menus' => []], + + '1' => ['libelle' => 'Menu jeunesse', + 'picto' => 'vide.gif', + 'menus' => []]]; + + $cfg_menus_profil_nature = ['H' => ['libelle' => 'Menu horizontal', + 'picto' => 'vide.gif', + 'menus' => []], + + '3' => ['libelle' => 'Menu nature', + 'picto' => 'vide.gif', + 'menus' => []]]; + + $this->fixture('Class_Profil', + ['id' => 34, + 'libelle' => 'Nature', + 'parent_id' => null, + 'cfg_menus' => $cfg_menus_profil_nature]); + + $current = Class_Profil::getCurrentProfil()->setParentId(null); + $current->setCfgMenus($cfg_menus_profil_portail); + $current->save(); + } +} + + + +class WidgetControllerVerticalNavDispatchTest extends WidgetControllerVerticalNavDispatchTestCase { + public function setUp() { + $this->_type_module = 'MENU_VERTICAL'; + $this->_preferences = ['titre' => 'Mon Menu', + 'menu' => 'H', + 'menu_deplie' => 1]; + parent::setUp(); + } + + + /** @test */ + function afficheTitreShouldBeChecked() { + $this->assertXPath('//input[@type="checkbox"][@name="afficher_titre"][@checked="checked"]'); + } + + + /** @test */ + function menuDeplieShouldBeChecked() { + $this->assertXPath('//input[@type="checkbox"][@name="menu_deplie"][@checked="checked"]'); + } + + + /** @test */ + public function selectMenuShouldContainsMenuHorizontalForPortail() { + $this->assertXPathContentContains('//select[@name="menu"]//option[@selected="selected"][@value="2-H"]', 'Menu horizontal'); + } + + + /** @test */ + public function selectMenuShouldContainsMenuHorizontalForProfilNature() { + $this->assertXPathContentContains('//select[@name="menu"]//option[not(@selected)][@value="34-H"]', 'Menu horizontal'); + } + + + /** @test */ + public function selectMenuShouldContainsMenuNature() { + $this->assertXPathContentContains('//select[@name="menu"]//option[@value="34-3"]', 'Menu nature'); + } + + + /** @test */ + public function toggleMenuShouldBeUnchecked() { + $this->assertXPath('//form//input[@type="checkbox"][@name="toggle_menu"]'); + } +} + + + + +class WidgetControllerVerticalNavDispatchWithMenuFromOtherTest extends WidgetControllerVerticalNavDispatchTestCase { + public function setUp() { + $this->_type_module = 'MENU_VERTICAL'; + $this->_preferences = ['titre' => 'Mon Menu', + 'menu' => '34-3', + 'afficher_titre' => 0]; + parent::setUp(); + } + + + /** @test */ + function afficheTitreShouldNotBeChecked() { + $this->assertXPath('//input[@type="checkbox"][@name="afficher_titre"][not(@checked)]'); + } + + + /** @test */ + public function menuNatureShouldBeSelected() { + $this->assertXPathContentContains('//select[@name="menu"]//option[@value="34-3"][@selected="selected"]', 'Menu nature'); + } + + + /** @test */ + function newHtmlShouldNotBeChecked() { + $this->assertXPath('//input[@type="checkbox"][@name="new_html"][not(@checked)]'); + } + + + /** @test */ + function newHtmlLabelShouldBeAsExpected() { + $this->assertXPathContentContains('//label', 'Structure HTML simplifiée pour la css'); + } +} + + + +class WidgetControllerTagsDispatchTest extends WidgetControllerDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'TAGS'; + parent::setUp(); + } + + + /** @test */ + public function tagSelectionChampsShouldBePresent() { + $this->assertXPathContentContains('//h2', 'Facettes disponibles'); + } +} + + + + +class WidgetControllerLoginDispatchTest extends WidgetControllerDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'LOGIN'; + parent::setUp(); + } + + + /** @test */ + public function welcomeInputShouldBePresent() { + $this->assertXPath('//form//input[@name="titre_connecte"]'); + } + + + /** @test */ + public function preSubscriptionInputValueShouldBeEmpty() { + $this->assertXPath('//form//input[@name="pre_registration"][@value=""]'); + } +} + + + + +class WidgetControllerReviewsDispatchTest extends WidgetControllerDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'CRITIQUES'; + parent::setUp(); + } + + + protected function _stormHook() { + $this->onLoaderOfModel('Class_PanierNotice') + ->whenCalled('findAllBelongsToAdmin') + ->answers([]); + } + + + /** @test */ + public function titleShouldBePresent() { + $this->assertXPathContentContains('//h1', 'critiques'); + } + + + /** @test */ + public function boxTitleShouldBePresent() { + $this->assertXPath('//input[@name="titre"]'); + } + + + /** @test */ + public function styleShouldBePresent() { + $this->assertXPath('//select[@name="boite"]'); + } + + + /** @test */ + public function rssChoiceShouldBePresent() { + $this->assertXPath('//input[@type="checkbox"][@name="rss_avis"]'); + } + + + /** @test */ + public function originShouldBePresent() { + $this->assertXPath('//select[@name="abon_ou_bib"]'); + } + + + /** @test */ + public function hierarchicalChoiceShouldBePresent() { + $this->assertXPath('//input[@type="checkbox"][@name="hierarchical"]'); + } + + + /** @test */ + public function displayCountShouldBePresent() { + $this->assertXPath('//input[@name="nb_aff_avis"]'); + } + + + /** @test */ + public function displayOrderShouldBePresent() { + $this->assertXPath('//select[@name="display_order"]'); + } + + + /** @test */ + public function contentCutShouldBePresent() { + $this->assertXPath('//input[@name="nb_words"]'); + } + + + /** @test */ + public function thumbsChoiceShouldBePresent() { + $this->assertXPath('//select[@name="only_img"]'); + } + + + /** @test */ + public function domainsShouldBePresent() { + $this->assertXPath('//input[@name="id_catalogue"]'); + } + + + /** @test */ + public function basketsShouldBePresent() { + $this->assertXPath('//input[@name="id_panier"]'); + } + + + /** @test */ + public function submitShouldBePresent() { + $this->assertXPath('//button[@type="submit"]'); + } +} + + + + +class WidgetControllerFormationsDispatchTest extends WidgetControllerDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'FORMATIONS_WIDGET'; + parent::setUp(); + } + + + protected function _stormHook() { + $this->fixture('Class_AdminVar', ['id' => 'FORMATIONS', 'valeur' => 1]); + } + + + /** @test */ + public function styleDeBoiteShouldBeBoiteParDefautDeLaDivision() { + $this->assertXPathContentContains('//select/option', 'Boite par défaut de la division'); + } + + + /** @test */ + public function treeselectFormationsBeDisplay() { + $this->assertXPath('//div[@class="treeselect id_categorie"]'); + } + + + /** @test */ + public function treeselectScriptShouldContainsSelectorOfTreeselectDiv() { + $this->assertXPathContentContains('//script', '.treeselect.id_categorie'); + } + + + /** @test */ + public function yearCategoriesShouldNotSelectable() { + $this->assertXPathContentContains('//script', 'categoriesNotSelectable'); + } + + + /** @test */ + public function formActionShouldBeAdminSlahAccueilSlahFormationWidget() { + $this->assertXPath('//form[contains(@action, "/admin/widget")]'); + } +} + + + + +class WidgetControllerFormationsPostDispatchTest extends WidgetControllerPostDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'FORMATIONS_WIDGET'; + $this->_params = ['selected_formations' => '1;2']; + parent::setUp(); + } + + + protected function _stormHook() { + $this->fixture('Class_AdminVar', ['id' => 'FORMATIONS', 'valeur' => 1]); + } + + + /** @test */ + public function formations1And2ShouldHaveBeenSaved() { + $this->assertEquals('1;2', $this->_saved_settings['preferences']['selected_formations']); + } +} + + + + +abstract class WidgetControllerTwoWidgetsTestCase extends WidgetControllerWidgetConfigurationTestCase { + + public function setUp() { + $this->_type_module = 'CONTENEUR_DEUX_COLONNES'; + $this->_division = 2; + $this->_preferences = ['col_gauche_type' => 'NEWS', + 'col_droite_type' => 'CRITIQUES', + 'boite' => 'boite_de_la_division_du_milieu', + 'titre' => 'A la Une']; + parent::setUp(); + } + + + protected function _stormHook() { + $this->onLoaderOfModel('Class_Article') + ->whenCalled('getArticlesByPreferences') + ->answers([]); + + $this->fixture('Class_AdminVar', + ['id' => 'MENU_BOITE', + 'valeur' => 1]); + + Class_Profil::find(2) + ->setParentId(null) + ->addBoiteOfTypeInBanniere('NEWS') + ->save(); + + $this->_profil->setParentId(2)->save(); + } +} + + + +class WidgetControllerTwoWidgetsDispatchIndexTest extends WidgetControllerTwoWidgetsTestCase { + public function setUp() { + parent::setUp(); + $this->dispatch('/opac/index/index/id_profil/' . $this->_profil->getId(), true); + } + + + /** @test */ + public function firsModuleShouldHaveId1000() { + $this->assertXPath('//div[@class="conteneur2colonnes"]//div[@id="boite_1000"]'); + } + + + /** @test */ + public function secondModuleShouldHaveId1001() { + $this->assertXPath('//div[@class="conteneur2colonnes"]//div[@id="boite_1001"]'); + } + + /** @test */ + public function secondModuleShouldBeCritics() { + $this->assertXPath('//div[@class="conteneur2colonnes"]//div[@class="boite critiques"]'); + } + + + /** @test */ + public function moduleNewsShouldHaveParentid6() { + $this->assertEquals(6, Class_Profil::getCurrentProfil()->getCfgAccueilAsArray()['modules'][1000]['parent_id']); + } +} + + + + +class WidgetControllerTwoWidgetsPostDispatchChildTest extends WidgetControllerTwoWidgetsTestCase { + + public function setUp() { + parent::setUp(); + $this->dispatch('/index/index/id_profil/' . $this->_profil->getId(), true); + } + + /** @test */ + public function renderedModuleNewsTitleShouldBeArticles() { + $this->assertXPathContentContains('//div[@class="boite news"]//div', 'Boite articles'); + } + + + /** @test */ + public function updatedModuleNewsTitleShouldBeDesNews() { + $this->postDispatch('/admin/widget/edit-widget/id/1000/id_profil/' . $this->_profil->getId(), + ['id_items' => '34-12', + 'titre' => 'des news']); + + Class_Profil::clearCache(); + $config = $this->_profil->getModuleAccueilConfig(1000, 'NEWS'); + $this->assertEquals('des news', $config['preferences']['titre']); + } +} + + + +class WidgetControllerTwoWidgetEditTest extends WidgetControllerDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'CONTENEUR_DEUX_COLONNES'; + parent::setUp(); + } + + + /** @test */ + public function inputTitleShouldDisplayALaUne() { + $this->assertXPath("//input[@name='titre']"); + } + + + /** @test */ + public function selectColGaucheTypeShouldHaveNEWSSelected() { + $this->assertXPath("//select[@name='col_gauche_type']//option[@value='NEWS'][@selected='selected']"); + } + + + /** @test */ + public function selectColDroiteTypeShouldHaveCRITIQUESSelected() { + $this->assertXPath("//select[@name='col_droite_type']//option[@value='CRITIQUES'][@selected='selected']"); + } +} + + + + +class WidgetControllerTwoWidgetPostEditTest extends WidgetControllerPostDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'CONTENEUR_DEUX_COLONNES'; + $this->_params = ['col_gauche_type' => 'KIOSQUE', + 'col_droite_type' => 'TAGS', + 'titre' => 'Ce mois ci']; + parent::setUp(); + } + + + /** @test */ + public function moduleKiosqueShouldHaveBeenCreated() { + $this->assertEquals('KIOSQUE', $this->_profil->getCfgAccueilAsArray()['modules'][1000]['type_module']); + } + + + /** @test */ + public function moduleKiosqueParentIdShouldBeSix() { + $this->assertEquals(6, $this->_profil->getCfgAccueilAsArray()['modules'][1000]['parent_id']); + } + + + /** @test */ + public function moduleKiosqueShouldHaveBeenAddedToBox() { + $this->assertEquals(1000, $this->_saved_settings['col_gauche_module_id']); + } + + + /** @test */ + public function moduleTagsShouldHaveBeenCreated() { + $this->assertEquals('TAGS', $this->_profil->getCfgAccueilAsArray()['modules'][1001]['type_module']); + } + + + /** @test */ + public function moduleTagsShouldHaveBeenAddedToBox() { + $this->assertEquals(1001, $this->_saved_settings['col_droite_module_id']); + } + + + /** @test */ + public function moduleTagShouldHaveParentIdSix() { + $this->assertEquals(6, $this->_profil->getCfgAccueilAsArray()['modules'][1001]['parent_id']); + } + + + /** @test */ + public function secondDispatchShouldCreateNewWidget() { + $this->postDispatch('/admin/widget/edit-widget/id/6/id_profil/5', ['col_gauche_type' => 'KIOSQUE', + 'col_droite_type' => 'NEWS', + 'titre' => 'Ce mois ci']); + Class_Profil::clearCache(); + $this->assertEquals(1002, Class_Profil::find(5)->getCfgAccueilAsArray()['modules'][6]['preferences']['col_droite_module_id']); + } +} + + + + +class WidgetControllerLanguageTest extends WidgetControllerDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'LANGUE'; + $this->_preferences = ['titre' => 'Sélectionnez la langue', + 'boite' => 'boite_vide']; + parent::setUp(); + } + + + /** @test */ + public function titleFieldShouldContinsSelectionnezLaLangue() { + $this->assertXPath('//input[@value="Sélectionnez la langue"]'); + } +} + + + + +class WidgetControllerBibNumericTest extends WidgetControllerDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'BIB_NUMERIQUE'; + $this->_preferences = ['titre' => 'Bibliothèque numérique', + 'boite' => '', + 'id_categories' => '', + 'id_categorie' => '', + 'id_albums' => '', + 'type_aff' => 'displayTree', + 'nb_aff' => '', + 'display_order' => '', + 'style_liste' => 'diaporama']; + parent::setUp(); + } + + + protected function _stormHook() { + $bible = $this->fixture('Class_AlbumCategorie', + ['id' => 1, + 'libelle' => 'Bible de Souvigny']); + $harlock = $this->fixture('Class_Album', + ['id' => 1, + 'titre' => 'Harlock', + 'cat_id' => 1]); + } + + + /** @test */ + public function frameTitleShouldBeProprieteDeLaBibliothequeNumerique() { + $this->assertXPathContentContains('//h1', 'bibliothèque numérique'); + } + + + /** @test */ + public function titleShouldBeBibliothequeNumerique() { + $this->assertXPath('//input[@value="Bibliothèque numérique"]'); + } + + + /** @test */ + public function selectionOfCategorieShouldBePresent() { + $this->assertXPath('//select[@name="id_categories"]'); + } + + + /** @test */ + public function selectionOfCategorieBibleDeSouvignyShouldBePresent() { + $this->assertXPathContentContains('//select[@name="id_categories"]/option', 'Bible de Souvigny'); + } + + + /** @test */ + public function selectionOfDisplayModeShouldBePresent() { + $this->assertXPath('//select[@name="type_aff"]'); + } + + + /** @test */ + public function selectionOfOrderModeShouldBePresent() { + $this->assertXPath('//input[@type="radio"][@name="display_order"]'); + } + + + /** @test */ + public function selectionOfAlbumShouldBePresent() { + $this->assertXPath('//select[@name="id_albums"]'); + } + + + /** @test */ + public function selectionOfImageCountShouldBePresent() { + $this->assertXPath('//input[@type="text"][@name="nb_aff"]'); + } + + + /** @test */ + public function selectionOfDisplayStyleShouldBePresent() { + $this->assertXPath('//select[@name="style_liste"]'); + } + + + /** @test */ + public function selectionOfAlbumsCategoriesShouldBePresent() { + $this->assertXPath('//div[contains(@class, "treeselect")]'); + $this->assertXPath('//input[@name="id_categorie"]'); + } +} + + + + +class WidgetControllerCalendarSimpleTest extends WidgetControllerDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'CALENDAR'; + $this->_preferences = ['titre' => 'Agenda']; + parent::setUp(); + } + + + /** @test */ + public function inputTitleShouldDisplayAgenda() { + $this->assertXPath("//input[@name='titre'][@value='Agenda']"); + } + + + /** @test */ + public function inputNbEventsShouldDisplayThree() { + $this->assertXPath("//input[@name='nb_events'][@value='3']"); + } + + + /** @test **/ + public function formTableAffichageShouldContainsModeAffichageLigne() { + $this->assertXPath('//select[@name="mode-affichage"]/option[@value="simple"]'); + } + + + /** @test **/ + public function formTableAffichageShouldContainsModeAffichageListe() { + $this->assertXPath('//select[@name="mode-affichage"]/option[@value="article"]'); + } + + + /** @test **/ + public function formTableAffichageShouldContainsModeAffichageNone() { + $this->assertXPath('//select[@name="mode-affichage"]/option[@value="none"]'); + } + + + /** @test **/ + public function byDefaultModeAfficahgeShouldBeLigne() { + $this->assertXPath('//select[@name="mode-affichage"]/option[@value="simple"][@selected="selected"]'); + } + + + /** @test **/ + public function formTableAffichageShouldContainsSelectDisplayCalendar() { + $this->assertXPath('//select[@name="display_calendar"]'); + } + + + /** @test **/ + public function selectDisplayCalendarShouldContainsOptionListeMois() { + $this->assertXPath('//select[@name="display_calendar"]/option[@value="2"]'); + } + + + /** @test **/ + public function byDefaultCalendrierShouldBeSelected() { + $this->assertXPath('//select[@name="display_calendar"]/option[@value="1"][@selected="selected"]'); + } +} + + + + +class WidgetControllerSitoSimpleTest extends WidgetControllerDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'SITO'; + $this->_preferences = ['titre' => 'Ma Sito', + 'display_order' => 'Selection', + 'id_items' => '12-13']; + parent::setUp(); + } + + + /** @test */ + public function inputTitleShouldDisplaySitotheque() { + $this->assertXPath("//input[@name='titre'][@value='Ma Sito']"); + } + + + /** @test */ + function nbAffShouldEqualsTwo() { + $this->assertXPath("//input[@name='nb_aff'][@value='2']"); + } + + + /** @test */ + public function inputHiddenIdItemsShouldContainsSelectedItems() { + $this->assertXPath('//input[@type="hidden"][@name="id_items"][@value="12-13"]'); + } + + + /** @test */ + public function displayOrderRandomShouldBeChecked() { + $this->assertXPath('//select[@name="display_order"]//option[@value="Random"]'); + } + + + /** @test */ + public function displayOrderSelectionShouldBePresent() { + $this->assertXPath('//select[@name="display_order"]//option[@value="Selection"]'); + } + + + /** @test */ + public function rssFlowPreferenceShouldBePresent() { + $this->assertXPath('//input[@type="checkbox"][@name="rss_avis"]'); + } + + + /** @test */ + public function inputTitleShouldDisplayMaSito() { + $this->assertXPath("//input[@name='titre'][@value='Ma Sito']"); + } + + + /** @test */ + public function displayOrderSelectionShouldBeChecked() { + $this->assertXPath('//select[@name="display_order"]//option[@selected][@value="Selection"]'); + } + + + /** @test */ + public function typeHierarchicCanBeSelected() { + $this->assertXPathContentContains('//select[@id="type_aff"]//option[@value=3]','Affichage hiérarchique par catégorie'); + } +} + + + + +class WidgetControllerListOfSitesPostDispatchTest extends WidgetControllerPostDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'SITO'; + $this->_params = ['type_aff' => 3, + 'nb_aff' => 2, + 'id_categorie' => '12-17']; + parent::setUp(); + } + + + /** @test */ + public function selectHierachicalDisplayShouldSaveOnlyFirstCategory() { + $this->assertEquals('12', $this->_saved_settings['preferences']['id_categorie']); + } +} + + + + +class WidgetControllerListOfSitesEmptyPostDispatchTest extends WidgetControllerPostDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'SITO'; + $this->_params = ['type_aff' => 3, + 'nb_aff' => 2, + 'id_categorie' => '']; + parent::setUp(); + } + + + /** @test */ + public function selectHierachicalDisplayShouldSaveOnlyFirstCategory() { + $this->assertEquals('', $this->_saved_settings['preferences']['id_categorie']); + } +} + + + + +class WidgetControllerRSSSimpleTest extends WidgetControllerDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'RSS'; + parent::setUp(); + } + + + /** @test */ + public function inputTitleShouldDisplayFilsRss() { + $this->assertXPath("//input[@name='titre'][@value='Boite RSS']"); + } + + + /** @test */ + function nbAffShouldEqualsTwo() { + $this->assertXPath("//input[@name='nb_aff'][@value='2']"); + } +} + + + + +class WidgetControllerLoginSimpleTest extends WidgetControllerDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'LOGIN'; + $this->_preferences = ['profil_redirect'=> '1', + 'profil_logout_redirect' => '1', + 'mot_de_pass_exemple' => 'dd/mm/aaaa']; + parent::setUp(); + } + + + /** @test */ + public function inputTitreShouldBeSeConnecter() { + $this->assertXPath('//input[@name="titre"][@value="Se connecter"]'); + } + + + /** @test */ + public function inputIdentifiantExempleShouldBeEmpty() { + $this->assertXPath('//input[@name="identifiant_exemple"][@value=""]'); + } + + + /** @test */ + public function inputMotDePasseExempleShouldBeEmpty() { + $this->assertXPath('//input[@name="mot_de_passe_exemple"][@value=""]'); + } + + + /** @test */ + public function inputLibelleLienConnexion() { + $this->assertXPath('//input[@name="lien_connexion"][@value="» Se connecter"]'); + } + + + /** @test */ + public function inputLibelleLienMotDePasseOublie() { + $this->assertXPath('//input[@name="lien_mot_de_passe_oublie"][@value="» Mot de passe oublié ?"]'); + } + + + /** @test */ + public function inputLienCreerCompteShouldContainsEnregister() { + $this->assertXPath('//input[@name="lien_creer_compte"][contains(@value,"S\'enregistrer")]'); + } + + + /** @test */ + public function inputLibelleLienMonCompte() { + $this->assertXPath('//input[@name="lien_compte"][@value="» Mon compte"]'); + } + + + /** @test */ + public function checkBoxDisableAutocompleteShouldBeChecked() { + $this->assertXPath('//input[@name="autocomplete_off"][@checked="checked"]'); + } + + + /** @test */ + public function profilShouldBeValid() { + $this->assertTrue(Class_Profil::getCurrentProfil()->isValid()); + } + + + /** @test **/ + public function configShouldContainsSelectProfil() { + $this->assertXPath('//td/select[@name="profil_redirect"][@id="profil_redirect"]'); + } + + + /** @test */ + public function profilRedirectShouldContainsProfil1() { + $this->assertXPathContentContains('//select[@name="profil_redirect"]/optgroup/option[@value="1"][@selected="selected"]', + 'portail: Accueil'); + } + + + /** @test */ + public function profilLogoutRedirectShouldContainsProfil1() { + $this->assertXPathContentContains('//select[@name="profil_logout_redirect"]/optgroup/option[@value="1"][@selected="selected"]', + 'portail: Accueil'); + } +} + + + + +class WidgetControllerLoginPostDispatchTest extends WidgetControllerPostDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'LOGIN'; + + $this->_preferences = ['profil_redirect'=> '1', + 'profil_logout_redirect' => '1', + 'mot_de_pass_exemple' => 'dd/mm/aaaa']; + + $this->_params = ['boite' => '', + 'titre' => 'Se connecter', + 'profil_redirect' => 678, + 'profil_logout_redirect' => 345]; + + parent::setUp(); + } + + + /** @test */ + public function profilRedirectShouldBe678() { + $this->assertEquals(678, $this->_saved_settings['profil_redirect']); + } + + + /** @test */ + public function profilLogoutRedirectShouldBe345() { + $this->assertEquals(345, $this->_saved_settings['profil_logout_redirect']); + } + + + /** @test */ + public function responseShouldRedirectWithJS() { + $this->assertRedirect(); + } +} + + + + +abstract class WidgetControllerLoginInParentTestCase extends WidgetControllerWidgetConfigurationTestCase { + + protected function _stormHook() { + $simple_widgets = ['modules' => ['2' => ['division' => 4, + 'id_module' => 2, + 'type_module' => 'LOGIN', + 'preferences' => ['profil_redirect' => '5', + 'profil_logout_redirect' => '5', + 'mot_de_pass_exemple' => 'dd/mm/aaaa']]]]; + + $parent = Class_Profil::find(2) + ->setParentId(null) + ->setCfgAccueil($simple_widgets); + $parent->save(); + + $this->fixture('Class_Profil', + ['id' => 6, + 'parent_id' => 2]) + ->setParentProfil($parent); + } +} + + + + +class WidgetControllerParentLoginDispatchTest extends WidgetControllerLoginInParentTestCase { + + /** @test */ + public function editLinkShoulduseParentProfil() { + $this->dispatch('/opac/index/index/id_profil/6', true); + $this->assertXpath('//div//a[contains(@href, "admin/widget/edit-widget/id/2/id_profil/2")]'); + } + + + /** @test */ + public function addWidgetLinkShouldUseParentProfil() { + $this->dispatch('/opac/index/index/id_profil/6', true); + $this->assertXpath('//div//a[contains(@href, "admin/widget/add/after/2/division/4/id_profil/2")]'); + } + + + /** @test */ + public function deleteWidgetLinkShouldUseParentProfil() { + $this->dispatch('/opac/index/index/id_profil/6', true); + $this->assertXpath('//div//a[contains(@href, "admin/widget/delete/id/2/division/4/id_profil/2")]'); + } + + + /** @test */ + public function profilRedirectsShouldBeSetToFive() { + $this->dispatch('/admin/widget/edit-widget/id/2/id_profil/2', true); + $this->assertXPath('//select[@name="profil_redirect"]/optgroup/option[@value="5"][@selected="selected"]'); + $this->assertXPath('//select[@name="profil_logout_redirect"]/optgroup/option[@value="5"][@selected="selected"]'); + } +} + + + + +abstract class WidgetControllerRightsTestCase extends WidgetControllerDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'KIOSQUE'; + parent::setUp(); + } + + + protected function _stormHook() { + $this->fixture('Class_Bib', + ['id' => 3, + 'libelle' => 'Lognes']); + + $this->_profil->setIdSite(3)->beCurrentProfil(); + } +} + + + + +class WidgetControllerNoRightsTest extends WidgetControllerRightsTestCase { + protected function _stormHook() { + parent::_stormHook(); + + Class_Users::getIdentity() + ->setIdSite(3) + ->beModoBib() + ->save(); + } + + + /** @test */ + public function responseShouldRedirect() { + $this->assertRedirect(); + } +} + + + +class WidgetControllerWithRightsTest extends WidgetControllerRightsTestCase { + + protected function _stormHook() { + parent::_stormHook(); + $group = $this->fixture('Class_UserGroup', ['id' => 2])->addRightConfigFront(); + + Class_Users::getIdentity() + ->setIdSite(3) + ->beModoBib() + ->setUserGroups([$group]) + ->save(); + } + + + /** @test */ + public function responseShouldNotRedirect() { + $this->assertNotRedirect(); + } +} + + + + +class WidgetControllerSearchTest extends WidgetControllerDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'RECH_SIMPLE'; + $this->_preferences = ['titre' => 'Recherchez', + 'boite' => 'boite_vide', + 'placeholder' => 'ex: Potter', + 'domain_ids' => '4']; + parent::setUp(); + } + + + /** @test */ + public function inputTitreShouldBeRecherchez() { + $this->assertXPath('//input[@name="titre"][@value="Recherchez"]'); + } + + + /** @test */ + public function inputTriShouldHavePertinenceSelected() { + $this->assertXPath('//select[@name="tri"]//option[@value="*"][@selected="selected"]'); + } + + + /** @test */ + public function selectProfilRedirectShouldContainsProfilAdulte() { + $this->assertXPath('//select[@name="profil_redirect"]//option[@value="2"]'); + } + + + /** @test */ + public function selectProfilRedirectShouldContainsProfilJeunesse() { + $this->assertXPath('//select[@name="profil_redirect"]//option[@value="5"]'); + } + + + /** @test */ + public function selectProfilShouldIncludeEmptyOption() { + $this->assertXPath('//select[@name="profil_redirect"]//option[@value=""]'); + } + + + /** @test */ + public function inputPlaceHolderShouldContainsExPotter() { + $this->assertXPath('//input[@name="placeholder"][@value="ex: Potter"]'); + } + + + /** @test */ + public function jqueryUIShouldBeLoaded() { + $this->assertXPath('//script[contains(@src, "'.JQUERYUI.'")]'); + } + + + /** @test */ + public function domainSelectorShouldBePresent() { + $this->assertXPath('//input[@name="domain_ids"][@value="4"]'); + } + + + /** @test */ + public function domainSelectorScriptShouldBeLoaded() { + $this->assertXPathContentContains('//script', '$.getJSON("/abonne/viewable-domains-json"'); + } + + + /** @test */ + public function domainSelectorStyleShouldHaveRadioSelectChecked() { + $this->assertXPath('//input[@name="domain_select_style"][@type="radio"][@checked="checked"][@value="select"]'); + } + + + /** @test */ + public function domainSelectorStyleShouldHaveRadioCheckboxUnchecked() { + $this->assertXPath('//input[@name="domain_select_style"][@type="radio"][not(@checked)][@value="checkbox"]'); + } +} + + + + + +class WidgetControllerDomainBrowserDispatchTest extends WidgetControllerDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'DOMAIN_BROWSER'; + $this->_preferences = ['boite' => 'boite_vide', + 'root_domain_id' => '1']; + parent::setUp(); + } + + + /** @test */ + public function formActionShouldBeAdminAccueilDomainBrowser() { + $this->assertXPath('//form[contains(@action, "admin/widget/edit-widget")]'); + } + + + /** @test **/ + public function inputTitleWidgetShouldBeDisplay() { + $this->assertXpath('//input[@name="titre"][@value="Boite domaines"]'); + } + + + /** @test **/ + public function inputWidgetSkinShouldBeDisplay() { + $this->assertXpath('//select[@name="boite"]/option[@selected="selected"][@value="boite_vide"]'); + } + + + /** @test */ + public function submitButtonShouldBeDisplayed() { + $this->assertXPath('//button[@type="submit"]'); + } + + + /** @test */ + public function inputRootDomaineIdShouldBeDisplayed() { + $this->assertXPath('//input[@name="root_domain_id"][@value="1"]'); + } + + + /** @test */ + public function inputSelectFormatShouldBeDisplayed() { + $this->assertXPath('//select[@name="display_mode"]'); + } +} + + + + +class WidgetControllerDomainBrowserPostDispatchTest extends WidgetControllerPostDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'DOMAIN_BROWSER'; + $this->_params = ['titre' =>'Mes Domaines', + 'root_domain_id' => '10', + 'allow_breadcrumb' => '0', + 'display_mode' => '4']; + parent::setUp(); + } + + + /** @test */ + public function paramsShouldHaveBeenSaved() { + $this->assertEquals(array_merge($this->_params, + ['boite' => '', + 'division' => '3', + 'id_module' => '6', + 'type_module' => 'DOMAIN_BROWSER', + 'preferences' => ['titre' => 'Mes Domaines', + 'allow_breadcrumb' => '0', + 'root_domain_id' => '10', + 'display_mode' => '4', + 'boite' => '', + 'division' => '3', + 'id_module' => '6', + 'type_module' => 'DOMAIN_BROWSER'], + 'profile_id' => '5']), + $this->_saved_settings); + } +} + + + + +class WidgetControllerLibrarySimpleDispatchTest extends WidgetControllerDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'LIBRARY'; + $this->_preferences = ['titre' => 'Médiathèque', + 'libraries' => '45', + 'filters' => 'custom_field_7;opening']; + parent::setUp(); + } + + + protected function _stormHook(){ + $annecy = $this->fixture('Class_Bib', + ['id' => 23, + 'libelle' => 'Annecy']); + + $this->fixture('Class_Bib', + ['id' => 45, + 'libelle' => 'Seynod']); + + + $this->fixture('Class_CustomField', + ['id' => 7, + 'label' => 'Services', + 'options_list' => 'Parking;Wifi;Projection;Restauration', + 'priority' => 3, + 'field_type' => Class_CustomField_Meta::MULTI_CHECKBOX, + 'model' => 'Bib']); + + $this->fixture('Class_CustomField', + ['id' => 9, + 'label' => 'Public', + 'options_list' => 'Jeune;Adulte', + 'priority' => 3, + 'field_type' => Class_CustomField_Meta::MULTI_CHECKBOX, + 'model' => 'Bib']); + + $annecy->setCustomField('Services', ['Wifi','Restauration']); + $annecy->setCustomField('Public', []); + $annecy->saveWithCustomFields(); + } + + + /** @test */ + public function h1ShouldContainsLibraryProperties() { + $this->assertXPathContentContains('//h1', 'bibliothèques'); + } + + + /** @test */ + public function inputTitreShouldContainsMediatheque() { + $this->assertXPath('//input[@name="titre"][@value="Médiathèque"]'); + } + + + /** @test */ + public function librariesSelectorShouldContainsAnnecyInAvailableLibraries() { + $this->assertXPathContentContains('//div[@id="input_libraries"]//div[preceding-sibling::div]//li[@data-value="23"]', + 'Annecy', + $this->_response->getBody()); + } + + + /** @test */ + public function librariesSelectorShouldContainsSeynodInSelectedLibraries() { + $this->assertXPathContentContains('//div[@id="input_libraries"]//div[following-sibling::div]//li[@data-value="45"]', 'Seynod'); + } + + + /** @test */ + public function selectedLibrariesLabelShouldBeSelectedLibraries() { + $this->assertXPathContentContains('//div[@id="input_libraries"]//div[following-sibling::div]/h2', + 'Bibliothèques affichées'); + } + + + /** @test */ + public function availableLibrariesLabelShouldBeAvailableLibraries() { + $this->assertXPathContentContains('//div[@id="input_libraries"]//div[preceding-sibling::div]/h2', + 'Bibliothèques disponibles'); + } + + + /** @test */ + public function jqueryUIShouldBeLoaded() { + $this->assertXPath('//script[contains(@src, "'.JQUERYUI.'")]'); + } + + + /** @test */ + public function inputFiltersShouldContainsCustomFiledSevenAndOpening() { + $this->assertXPath('//input[@name="filters"][@value="custom_field_7;opening"]'); + } + + + /** @test */ + public function availableLabelsShouldContainsLiForOpening() { + $this->assertXPathContentContains('//ul/li[@data-value="opening"]', 'Ouverture'); + } + + + /** @test */ + public function availableLabelsShouldContainsLiForTown() { + $this->assertXPathContentContains('//ul/li[@data-value="town"]', 'Ville'); + } + + + /** @test */ + public function availableLabelsShouldContainsLiForTerritory() { + $this->assertXPathContentContains('//ul/li[@data-value="territory"]', 'Territoire'); + } + + + /** @test */ + public function availableLabelsShouldContainsLiForSearch() { + $this->assertXPathContentContains('//ul/li[@data-value="search"]', 'Recherche'); + } + + + /** @test */ + public function displaySettingsForFiltersShouldBePresent() { + $this->assertXPath('//select[@name="filters_display_modes"]'); + } + + + /** @test */ + public function displaySettingsForFiltersPositionShouldBePresent() { + $this->assertXPath('//select[@name="filters_position"]'); + } + + + /** @test */ + public function displayMapCheckboxShouldBePresent() { + $this->assertXPath('//form//input[@type="checkbox"][@name="osm_map"]'); + } +} + + + + +class WidgetControllerAddActionLinkTest extends WidgetControllerWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'LOGIN'; + parent::setUp(); + $this->dispatch('opac/index/index/id_profil/5', true); + } + + + /** @test */ + public function linkAddWidgetShouldBePresent() { + $this->assertXPath('//a[contains(@href, "admin/widget/add/after/6/division/3/id_profil/5")]'); + } +} + + + + +class WidgetControllerAddActionDispatchTest extends WidgetControllerWidgetConfigurationTestCase { + public function setUp() { + parent::setUp(); + $this->dispatch('/admin/widget/add/after/6/division/3/id_profil/5', true); + } + + + /** @test */ + public function submitButtonShouldBePresent() { + $this->assertXpath('//button[@type="submit"]'); + } +} + + + +class WidgetControllerAddActionPostDispatchTest extends WidgetControllerWidgetConfigurationTestCase { + public function setUp() { + parent::setUp(); + $this->postDispatch('/admin/widget/add/after/6/division/3/id_profil/5', + ['titre' => 'mon titre', + 'boite' => 'red_widget', + 'module_type' => 'KIOSQUE']); + Class_Profil::clearCache(); + } + + + /** @test */ + public function shouldRedirect() { + $this->assertRedirect(); + } + + + /** @test */ + public function currentProfilShouldHaveTitre() { + $this->assertEquals('mon titre', $this->_profil->getCfgAccueilAsArray()['modules'][1]['preferences']['titre']); + } + + + /** @test */ + public function currentProfilShouldHaveTypeKiosque() { + $this->assertEquals('KIOSQUE', $this->_profil->getCfgAccueilAsArray()['modules'][1]['type_module']); + } + + + /** @test */ + public function currentProfilShouldHaveSlideShow() { + $this->assertEquals('slide_show', $this->_profil->getCfgAccueilAsArray()['modules'][1]['preferences']['style_liste']); + } + + + /** @test */ + public function currentProfilShouldHaveNbNotices() { + $this->assertEquals(20, $this->_profil->getCfgAccueilAsArray()['modules'][1]['preferences']['nb_notices']); + } +} + + + + +class WidgetControllerDeleteActionTest extends WidgetControllerWidgetConfigurationTestCase { + public function setUp() { + parent::setUp(); + $this->dispatch('admin/widget/delete/id/6/division/3/id_profil/5', true); + Class_Profil::clearCache(); + } + + + /** @test */ + public function shouldRedirect() { + $this->assertRedirect(); + } + + + /** @test */ + public function widgetSixShouldHaveBeenRemoved() { + $this->assertEquals([], $this->_profil->getCfgAccueilAsArray()['modules']); + } +} + + + + +class WidgetControllerAddMenuActionTest extends WidgetControllerWidgetConfigurationTestCase { + public function setUp() { + parent::setUp(); + $this->_profil->beCurrentProfil(); + $this->dispatch('admin/widget/add-menu', true); + Class_Profil::clearCache(); + } + + + /** @test */ + public function newMenuShouldHaveBeenAdded() { + $this->assertEquals(['libelle' => 'Nouveau menu', + 'picto' => '', + 'menus' => []], + $this->_profil->getCfgMenusAsArray()[0]); + } + + + /** @test */ + public function shouldRedirect() { + $this->assertRedirect(); + } +} + + + + +class WidgetControllerAddActionEmptyPostDispatchTest extends WidgetControllerWidgetConfigurationTestCase { + public function setUp() { + parent::setUp(); + $this->postDispatch('/admin/widget/add/after/6/division/3/id_profil/5', + ['titre' => 'mon titre', + 'boite' => 'red_widget', + 'module_type' => '']); + Class_Profil::clearCache(); + } + + + /** @test */ + public function formShouldBeReload() { + $this->assertXPath('//form'); + } +} diff --git a/tests/application/modules/opac/controllers/AbonneControllerAvisTest.php b/tests/application/modules/opac/controllers/AbonneControllerAvisTest.php index 87fa641e70431165bd4a866e3c5d0bb82f0e16d9..4b41858d1cf9c179f65bbaad9f99a2bef7e09fe3 100644 --- a/tests/application/modules/opac/controllers/AbonneControllerAvisTest.php +++ b/tests/application/modules/opac/controllers/AbonneControllerAvisTest.php @@ -780,7 +780,7 @@ class AbonneControllerAvisBlogControllerViewCritiquesWithoutModuleTest extends M /** @test */ public function titleShouldBeDernieresCritiques() { $this->dispatch('/opac/blog/viewcritiques'); - $this->assertXPathContentContains('//h1', 'Dernières critiques'); + $this->assertXPathContentContains('//h1', 'critiques'); } } @@ -876,7 +876,7 @@ class AbonneControllerEditAvisNoticeNotFoundActionTest extends AbstractControlle /** @test */ public function responseShouldReloadPage() { - $this->assertXPathContentContains('//script', 'document.location.href = document.location.href;'); + $this->assertXPathContentContains('//script', 'location.reload();'); } } @@ -901,7 +901,7 @@ class AbonneControllerEditAvisNoticeNotAdminLoggedActionTest extends AbstractCon /** @test */ public function responseShouldReloadPage() { - $this->assertXpathContentContains('//script', 'document.location.href = document.location.href;'); + $this->assertXpathContentContains('//script', 'location.reload();'); } } @@ -1028,7 +1028,7 @@ class AbonneControllerDeleteAvisNoticeAdminLoggedActionTest extends AbstractCont /** @test */ public function shouldContainsSciptToRedirectToReferer() { - $this->assertXpathContentContains('//script', 'document.location.href = document.location.href;'); + $this->assertXpathContentContains('//script', 'location.reload();'); } } diff --git a/tests/application/modules/opac/controllers/AuthControllerTest.php b/tests/application/modules/opac/controllers/AuthControllerTest.php index 656cbfca4b59c82a9e02826709138db37dc6bd57..71e8056957b7a3c62f76095356c6f4cf81f0998c 100644 --- a/tests/application/modules/opac/controllers/AuthControllerTest.php +++ b/tests/application/modules/opac/controllers/AuthControllerTest.php @@ -448,12 +448,6 @@ class AuthControllerNobodyLoggedAndRegistrationAllowedBoiteLoginTest } - /** @test */ - function headShouldContainsAbonnesJS() { - $this->assertXPath('//head//script[contains(@src,"public/opac/js/abonne.js")]'); - } - - /** @test */ function headShouldContainsAdminCommonJS() { $this->assertXPath('//head//script[contains(@src,"public/admin/js/common.js")]'); diff --git a/tests/application/modules/opac/controllers/BibControllerTest.php b/tests/application/modules/opac/controllers/BibControllerTest.php index 0fcea8751be3473b9212ae7be4f2b3d85d7c0180..4be1539cc9d5d1d79fdb5594a4df064fe52657eb 100644 --- a/tests/application/modules/opac/controllers/BibControllerTest.php +++ b/tests/application/modules/opac/controllers/BibControllerTest.php @@ -1166,7 +1166,7 @@ class BibControllerBibSelectionWithEmptySessionTest extends BibControllerSelecti /** @test */ public function inputTypeSubmitShouldBePresent() { - $this->assertXPath('//form//input[@type="submit"]'); + $this->assertXPath('//button[@type="submit"]'); } } diff --git a/tests/application/modules/opac/controllers/PanierControllerTest.php b/tests/application/modules/opac/controllers/PanierControllerTest.php index 0cbced6083d920a26c428cae9e962ea4d92aa319..cbd5d3ec64124ee9a638a6c88619f3e5495c5088 100644 --- a/tests/application/modules/opac/controllers/PanierControllerTest.php +++ b/tests/application/modules/opac/controllers/PanierControllerTest.php @@ -1395,7 +1395,7 @@ class PanierControllerChangePanierAjaxPostRenderPopupTest extends PanierControll public function responseShouldBeARedirectWithJavascript() { $this->_xpath->assertXPathContentContains($this->_json->content, '//script', - 'document.location.href = document.location.href'); + 'location.reload()'); } diff --git a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php index c178b5efe7e3711211b41fe6e44e861bb800f1ee..5746e2e4c402e2776e54de57a70d177e3b2d04d6 100644 --- a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php +++ b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php @@ -20,7 +20,9 @@ */ abstract class ProfilOptionsControllerWithProfilAdulteTestCase extends AbstractControllerTestCase { + protected + $_storm_default_to_volatile = true, $admin_var; @@ -45,6 +47,14 @@ abstract class ProfilOptionsControllerWithProfilAdulteTestCase extends AbstractC 'clef_oeuvre' => 'HPELPA', 'clef_alpha' => 'POTTER', 'exemplaires' => []])]); + $this->onLoaderOfModel('Class_Article') + ->whenCalled('getArticlesByPreferences') + ->answers([]); + + $this->onLoaderOfModel('Class_TypeDoc') + ->whenCalled('findUsedTypeDocIds') + ->answers([]); + $this->setUpProfilAdulte(); $this->setUpProfilJeunesse(); } @@ -203,6 +213,7 @@ abstract class ProfilOptionsControllerWithProfilAdulteTestCase extends AbstractC ['type_menu' => 'RECH_SIMPLE', 'libelle' => 'Recherche simple', + 'use_profil' => '4', 'preferences' => [], 'picto' => 'vide.gif' ], @@ -212,7 +223,8 @@ abstract class ProfilOptionsControllerWithProfilAdulteTestCase extends AbstractC 'V' => ['libelle' => 'Menu vertical', 'picto' => 'vide.gif']]; - $this->profil_adulte = $this->fixture('Class_Profil', ['id' => 22, 'rewrite_url' => 'adulte']) + $this->profil_adulte = $this->fixture('Class_Profil', + ['id' => 22, 'rewrite_url' => 'adulte']) ->setBrowser('opac') ->setLibelle('Profil Adulte') ->setHauteurBanniere(150) @@ -281,7 +293,8 @@ abstract class ProfilOptionsControllerWithProfilAdulteTestCase extends AbstractC ], 'options' => []]; - $this->profil_jeunesse = $this->fixture('Class_Profil', ['id' => 230]) + $this->profil_jeunesse = $this->fixture('Class_Profil', + ['id' => 230]) ->setBrowser('opac') ->setTitreSite(null) ->setLibelle('Profil Jeunesse') @@ -313,6 +326,7 @@ class ProfilOptionsControllerProfilAdulteWithCacheTest extends ProfilOptionsCont parent::setUp(); $this->fixture('Class_AdminVar', ['id'=>'AFFICHER_DISPONIBILITE_SUR_RECHERCHE', 'valeur'=>1] ); $this->fixture('Class_AdminVar', ['id'=>'CACHE_ACTIF', 'valeur'=>1] ); + $this->dispatch('/'); $this->bootstrap(); Class_Profil::setCurrentProfil($this->profil_adulte); @@ -363,6 +377,12 @@ class ProfilOptionsControllerProfilAdulteWithCacheTest extends ProfilOptionsCont } + /** @test */ + public function linkToSearchShouldUseProfil4() { + $this->assertXPath('//a[contains(@href,"/recherche/simple/statut/reset/id_profil/4")]'); + } + + /** @test */ public function withOutOptionAfficherDisponibiliteSurRechercheScriptShouldNotContainsDisponibiliteAjaxBaseUrl(){ $this->fixture('Class_AdminVar', ['id'=>'AFFICHER_DISPONIBILITE_SUR_RECHERCHE', 'valeur'=>0] ); @@ -527,7 +547,7 @@ class ProfilOptionsControllerViewProfilAdulteTest extends ProfilOptionsControlle /** @test */ public function menuHorizontalShouldIncludeExternalLinkToGoogle() { - $this->assertXPathContentContains("//div[@id='menu_horizontal']//li//a[@href='http://www.google.com'][@target='_blank']", + $this->assertXPathContentContains("//div[@id='menu_horizontal']//li//a[@target='_blank']", 'Google'); } @@ -625,8 +645,7 @@ class ProfilOptionsControllerViewProfilAdulteTest extends ProfilOptionsControlle /** @test */ public function menuHorizontalShouldIncludeLinkToSimpleSearch() { - $this->assertXPathContentContains("//div[@id='menu_horizontal']//li[@class='menu']//a[@href='/recherche/simple/statut/reset']", - 'Recherche simple'); + $this->assertXPathContentContains("//div[@id='menu_horizontal']//li[@class='menu']//a[@href='/recherche/simple/statut/reset/id_profil/4']", 'Recherche'); } @@ -667,8 +686,7 @@ class ProfilOptionsControllerViewProfilAdulteTest extends ProfilOptionsControlle /** @test */ public function menuHorizontalShouldDisplaySitothequeWithUrl() { - $this->assertXPath('//div[@id="menu_horizontal"]//li[@class="menu"]//a[contains(@href, "/sito/sitoview/id_items/10-1-2/nb/10/picto/vide.gif/libelle/Sitoth%C3%A8que")]', - $this->_response->getBody()); + $this->assertXPath('//div[@id="menu_horizontal"]//li[@class="menu"]//a[contains(@href, "/sito/sitoview/id_items/10-1-2/nb/10")]'); } @@ -680,8 +698,7 @@ class ProfilOptionsControllerViewProfilAdulteTest extends ProfilOptionsControlle /** @test */ public function menuHorizontalShouldDisplayCatalogueWithUrl() { - $this->assertXPath('//div[@id="menu_horizontal"]//li[@class="menu"]//a[contains(@href, "/recherche/simple/tri/date_creation+desc/titre/mon+catalogue/nb_notices/20/aleatoire/1/nb_analyse/50/id_catalogue/2/picto/vide.gif/libelle/mon+catalogue")]', - $this->_response->getBody()); + $this->assertXPath('//div[@id="menu_horizontal"]//li[@class="menu"]//a[contains(@href, "/recherche/simple/tri/date_creation+desc/titre/mon+catalogue/nb_notices/20/aleatoire/1/nb_analyse/50/id_catalogue/2")]'); } @@ -696,14 +713,14 @@ class ProfilOptionsControllerViewProfilAdulteTest extends ProfilOptionsControlle /** @test */ public function menuHorizontalForMenuPratiqueShouldHaveClassProfilSelected() { $this->assertXPathContentContains('//ul/li[contains(@class, "selected_profil")]', - 'Pratique',$this->_response->getBody()); + 'Pratique'); } /** @test */ public function menuHorizontalForProfilJeunesseShouldHaveUrlIdProfil230NotSelected() { $this->assertXPathContentContains('//ul/li[not(contains(@class, "selected_profil"))]/a[contains(@href, "/id_profil/230")]', - 'Profil jeunesse', $this->_response->getBody()); + 'Profil jeunesse'); } /** @test */ @@ -740,19 +757,21 @@ class ProfilOptionsControllerViewProfilAdulteTest extends ProfilOptionsControlle class ProfilOptionsControllerViewProfilAdulteHtml5Test extends ProfilOptionsControllerWithProfilAdulteTestCase { + public function setUp() { parent::setUp(); Class_Profil::getCurrentProfil() - ->setCfgMenus(array('H' => ['libelle' => 'Menu horizontal', - 'picto' => 'vide.gif', - 'menus' => []], - 'V' => ['libelle' => 'Menu vertical', - 'picto' => 'vide.gif', - 'menus' => []])) + ->setCfgMenus(['H' => ['libelle' => 'Menu horizontal', + 'picto' => 'vide.gif', + 'menus' => []], + 'V' => ['libelle' => 'Menu vertical', + 'picto' => 'vide.gif', + 'menus' => []]]) ->assertSave(); $this->dispatch('/opac/'); } + /** * @group integration * @test @@ -796,77 +815,19 @@ class ProfilOptionsControllerViewProfilAdulteAsAdminTest extends ProfilOptionsCo /** @test */ public function menuHorizontalCalendrierConfigShouldContainsConfigTypeMenu() { - $this->assertXPath('//div[@id="menu_horizontal"]//li[@class="menu boite"]//div[@class="boite calendar"]//a[contains(@href, "menus/calendrier/config/menu/id_profil/22/id_module/18/type_menu/MODULE_ACCUEIL_CALENDAR/preferences/nb_events%3D5")]'); + $this->assertXPath('//div[@id="menu_horizontal"]//li[@class="menu boite"]//div[@class="boite calendar"]/following-sibling::a[contains(@href, "/widget/edit-menu/id/19/id_profil/22/parent/H")]'); } /** @test */ public function menuHorizontalCritiquesConfigShouldContainsConfigTypeMenu() { - $this->assertXPath('//div[@id="menu_horizontal"]//li[@class="boite"]//div[@class="boite critiques"]//a[contains(@href, "menus/critiques/config/menu/id_profil/22/id_module/2/type_menu/MODULE_ACCUEIL_CRITIQUES/preferences/rss_avis%3D1%7Cid_panier%3D3")]'); + $this->assertXPath('//div[@id="menu_horizontal"]//li[@class="boite"]//div[@class="boite critiques"]/following-sibling::a[contains(@href, "admin/widget/edit-menu/id/2/id_profil/22/parent/H")]'); } /** @test */ public function menuHorizontalKiosqueConfigShouldContainsConfigTypeMenu() { - $this->assertXPath('//div[@id="menu_horizontal"]//li[@class="menu boite"]//div[@class="boite kiosque"]//a[contains(@href, "menus/kiosque/config/menu/id_profil/22/id_module/19/type_menu/MODULE_ACCUEIL_KIOSQUE/preferences/id_panier%3D1%7Cstyle_liste%3Dmur")]'); - } -} - - - -class ProfilOptionsControllerProfilAdulteAsAdminPostConfigCalendrierTest extends ProfilOptionsControllerProfilAdulteAsAdminTestCase { - public function setUp() { - parent::setUp(); - - $this->postDispatch('/admin/menus/calendrier?config=menu&id_profil=22&id_module=8&type_menu=MODULE_ACCUEIL_CALENDAR&preferences=nb_events%3D5', - ['nb_events' => 12, - 'libelle' => 'Agenda']); - } - - - /** @test */ - public function savedMenuCalendrierShouldHaveNbEvents12() { - $preferences = $this->profil_adulte->getMenuHorizontal()->getMenuPrefencesByIdModule(8); - $this->assertEquals(12, $preferences['nb_events']); - } - - - /** @test */ - public function profilShouldBeSaved() { - $this->assertTrue(Class_Profil::methodHasBeenCalled('save')); - } -} - - - -class ProfilOptionsControllerProfilAdulteAsAdminPostConfigKiosqueStyleReloadTest extends ProfilOptionsControllerProfilAdulteAsAdminTestCase { - public function setUp() { - parent::setUp(); - - $this->postDispatch('/admin/menus/kiosque/styles_reload/1?config=menu&id_profil=2&id_module=9&type_menu=MODULE_ACCUEIL_KIOSQUE&preferences=id_panier%3D1%7Cstyle_liste%3Dmur', - ['style_liste' => 'vignettes', - 'nb_notices' => 2, - 'nb_analyse' => 2, - 'id_panier' => 0, - 'rss_avis' => 0, - 'titre' => 'Nouveautes', - 'aleatoire' => 0, - 'tri' => 0, - 'only_img' => 0, - 'id_catalogue' => 0, - 'profil_redirect' => '']); - } - - - /** @test */ - public function selectStyleListeShouldHaveVignettesSelected() { - $this->assertXPath('//select[@name="style_liste"]//option[@value="vignettes"][@selected="selected"]'); - } - - - /** @test */ - public function inputNbAnalyseShouldBeTwo() { - $this->assertXPath('//input[@name="nb_analyse"][@value="2"]'); + $this->assertXPath('//div[@id="menu_horizontal"]//li[@class="menu boite"]//div[@class="boite kiosque"]/following-sibling::a[contains(@href, "admin/widget/edit-menu/id/20/id_profil/22/parent/H")]'); } } @@ -1191,7 +1152,7 @@ class ProfilOptionsControllerPageJeuxViewModuleCritiquesTest extends ProfilOptio /** @test */ public function iframeKiosqueUrlShouldHaveIdModuleSeven() { - $this->assertXPath('//iframe[contains(@src, "/id_module/7/id_profil/12/vue/cube")][@title="Kiosque"]'); + $this->assertXPath('//iframe[contains(@src, "/id_module/7/id_profil/12/vue/cube")][contains(@title, "kiosque")]'); } @@ -1370,8 +1331,7 @@ class ProfilOptionsControllerProfilJeunesseViewPageJeuxTest extends ProfilOption /** @test */ public function boiteKiosqueTitleShouldLinkToMenuCatalogue() { - $this->assertXPath("//div[@class='boite kiosque']//div//a[contains(@href, '/recherche/simple/titre/Kiosque/style_liste/cube/nb_notices/20/only_img/1/aleatoire/1/tri/date_creation+desc/nb_analyse/50/op_hauteur_img/90/op_transition//op_largeur_img/0/op_hauteur_boite/0/op_captions/0/op_autoplay/0/op_visible/0/op_speed/0/op_auto/0/op_scroll/1/rss_avis/1/id_catalogue/0/id_panier/0/profil_redirect//boite/boite_de_la_division_gauche')]", - $this->_response->getBody()); + $this->assertXPath("//div[@class='boite kiosque']//div//a[contains(@href, '/recherche/simple/titre/Boite+kiosque/style_liste/cube/nb_notices/20/only_img/1/aleatoire/1/tri/date_creation+desc/nb_analyse/50/op_hauteur_img/90/op_transition//op_largeur_img/0/op_hauteur_boite/0/op_captions/0/op_autoplay/0/op_visible/0/op_speed/0/op_auto/0/op_scroll/1/rss_avis/1/id_catalogue/0/id_panier/0/profil_redirect//boite/boite_de_la_division_gauche')]"); } @@ -1530,9 +1490,13 @@ class ProfilOptionsControllerViewProfilJeunesseAccueilTest extends ProfilOptions ['id'=>'MULTIMEDIA_KEY', 'valeur'=>'81b3ab7b0b9a621afb6044a9c2f48ed2']); - Storm_Test_ObjectWrapper::onLoaderOfModel('Class_TypeDoc') - ->whenCalled('findUsedTypeDocIds') - ->answers([1, 2, 4]); + $this->onLoaderOfModel('Class_TypeDoc') + ->whenCalled('findUsedTypeDocIds') + ->answers([1, 2, 4]); + + $this->onLoaderOfModel('Class_Multimedia_DeviceHold') + ->whenCalled('getFutureHoldsOfUser') + ->answers([]); Class_Profil::setFileWriter(Storm_Test_ObjectWrapper::mock() ->whenCalled('fileExists') @@ -1652,7 +1616,7 @@ class ProfilOptionsControllerViewProfilJeunesseAccueilTest extends ProfilOptions /** @test */ public function boiteNewsShouldBeVisibleInProfilJeunesse() { - $this->assertXPathContentContains("//a[contains(@href, 'articleviewselection')]",'Articles'); + $this->assertXPathContentContains("//a[contains(@href, 'articleviewselection')]",'articles'); } diff --git a/tests/application/modules/telephone/controllers/IndexControllerTest.php b/tests/application/modules/telephone/controllers/IndexControllerTest.php index 68d9d37c19a13d6adc9d84bd994a656ff2655eec..833305ffc70c1a7f0936004ac40ef9f0bc661879 100644 --- a/tests/application/modules/telephone/controllers/IndexControllerTest.php +++ b/tests/application/modules/telephone/controllers/IndexControllerTest.php @@ -22,6 +22,8 @@ require_once 'TelephoneAbstractControllerTestCase.php'; abstract class AbstractIndexControllerTelephoneWithModulesTest extends TelephoneAbstractControllerTestCase { + protected $_storm_default_to_volatile = true; + protected function _loginHook($account) { $account->ROLE = ""; $account->ROLE_LEVEL = 0; diff --git a/tests/library/Class/DuplicateInProfilTest.php b/tests/library/Class/DuplicateInProfilTest.php index db01ade000ebcfbc7896bd48da2c1cb912bb89bc..a6ab5a18e25f074b858b26be8d24fe066b4bf670 100644 --- a/tests/library/Class/DuplicateInProfilTest.php +++ b/tests/library/Class/DuplicateInProfilTest.php @@ -16,7 +16,7 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ abstract class DuplicateInProfilTestCase extends Storm_Test_ModelTestCase { @@ -25,46 +25,46 @@ abstract class DuplicateInProfilTestCase extends Storm_Test_ModelTestCase { public function setUp() { parent::setUp(); - $cfg_menus = + $cfg_menus = ['H' => ["libelle" => "Menu horizontal", "picto" => "vide.gif", - + 'menus' => [['type_menu' => 'MENU', 'libelle' => 'Pratique', 'picto' => 'bookmark.png', 'preferences' => [], 'sous_menus' => [['type_menu' => 'ACCUEIL', - 'libelle' => 'Accueil', - 'picto' => 'vide.gif', - 'preferences' => []], - + 'libelle' => 'Accueil', + 'picto' => 'vide.gif', + 'preferences' => []], + ['type_menu' => 'URL', 'libelle' => 'Google', 'picto' => 'vide.gif', 'preferences' => ['url' => 'http://www.google.com', 'target' => 0]], - + ['type_menu' => 'NEWS', 'libelle' => 'Articles', 'picto' => 'vide.gif', 'preferences' => ['id_items' => '1-3', 'display_order' => 'Selection']], - + ['type_menu' => 'FORM_CONTACT', 'libelle' => 'Formulaire contact', 'picto' => 'vide.gif' ], - + ['type_menu' => 'PANIER', 'libelle' => 'Paniers de notices', 'picto' => 'vide.gif' ] - ]]]], - - + ]]]], + + 'V' => ["libelle" => "Menu vertical", "picto" => "vide.gif", "menus" => [] - ] - ]; + ] + ]; $cfg_modules = ['recherche' => ['viewnotice1' => ['barre_nav' => 'Notice']]]; @@ -79,13 +79,13 @@ abstract class DuplicateInProfilTestCase extends Storm_Test_ModelTestCase { $this->profils[]=$profil1; $this->profils[]=$profil2; - + Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Profil') - ->whenCalled('save') - ->answers(true) - ->whenCalled('findAllBy') - ->with(['where'=> 'parent_id is null']) - ->answers($this->profils); + ->whenCalled('save') + ->answers(true) + ->whenCalled('findAllBy') + ->with(['where'=> 'parent_id is null']) + ->answers($this->profils); } } @@ -95,28 +95,29 @@ abstract class DuplicateInProfilTestCase extends Storm_Test_ModelTestCase { class DuplicateInProfilHorizontalMenuTest extends DuplicateInProfilTestCase { public function setUp() { parent::setUp(); - $this->current_profil->duplicateHorizontalMenu(); + $this->current_profil->duplicateHorizontalMenu(); } /** @test */ public function duplicateProfilShouldInsertPratiqueToProfil1() { - $this->assertEquals('Pratique',$this->profils[1]->getCfgMenuHorizontal()[0]['libelle']) ; - + $this->assertEquals('Pratique',$this->profils[1]->getCfgMenuHorizontal()[0]['libelle']) ; + } /** @test */ public function duplicateProfilShouldInsertPanierAsSubMenuToProfil2() { - $this->assertEquals('Paniers de notices',$this->profils[1]->getCfgMenuHorizontal()[0]['sous_menus'][4]['libelle']) ; - + $datas = $this->profils[1]->getCfgMenuHorizontal()[0]['sous_menus']; + $this->assertEquals('Paniers de notices',$this->profils[1]->getCfgMenuHorizontal()[0]['sous_menus'][5]['libelle']) ; + } /** @test */ public function duplicateProfilShouldSaveProfil2() { $this->assertEquals($this->profils[1],Class_Profil::getFirstAttributeForLastCallOn('save')); - + } } @@ -126,19 +127,19 @@ class DuplicateInProfilHorizontalMenuTest extends DuplicateInProfilTestCase { class DuplicateInProfilConfigModulesTest extends DuplicateInProfilTestCase { public function setUp() { parent::setUp(); - $this->current_profil->duplicateConfigModules(); + $this->current_profil->duplicateConfigModules(); } /** @test */ public function duplicateProfilShouldHaveBarreNavRechercheNotice() { $this->assertEquals('Notice', $this->profils[1]->getCfgModulesPreferences('recherche', 'viewnotice', '1')['barre_nav']); - } + } /** @test */ public function duplicateProfilShouldSaveProfil2() { $this->assertEquals($this->profils[1],Class_Profil::getFirstAttributeForLastCallOn('save')); - + } } diff --git a/tests/library/Class/ProfilTest.php b/tests/library/Class/ProfilTest.php index d8029904e423795ad93b5e5017081b965a74d6ff..22513b4cac40647fb2b10d9fd0e8818a38bddc32 100644 --- a/tests/library/Class/ProfilTest.php +++ b/tests/library/Class/ProfilTest.php @@ -151,7 +151,7 @@ class ProfilJeunesseAstrolabeTest extends ModelTestCase { /** @test */ public function getOrCreateConfigAccueilRechSimpleShouldCreatePreferences() { $data = $this->profil_astro->getOrCreateConfigAccueil(1, 'RECH_SIMPLE'); - $this->assertEquals('Rechercher', $data['titre']); + $this->assertEquals('Boite recherche', $data['titre']); } @@ -1068,7 +1068,7 @@ class ProfilEvenementsTest extends ModelTestCase { /** @test */ public function boiteRechercheSimpleTitreShouldBeRechercher() { - $this->assertEquals('Rechercher', $this->boite_recherche['preferences']['titre']); + $this->assertEquals('Boite recherche', $this->boite_recherche['preferences']['titre']); } diff --git a/tests/library/ZendAfi/View/Helper/Accueil/KiosqueTest.php b/tests/library/ZendAfi/View/Helper/Accueil/KiosqueTest.php index c77c2fb95cc9a0de18e0e9c7f6889981fb59a0ce..592faa5c96cdc9f1bd38e96bfa75350c0b418f7f 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/KiosqueTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/KiosqueTest.php @@ -520,7 +520,7 @@ class ZendAfi_View_Helper_Accueil_KiosqueProfileRedirectTest extends ViewHelperT [[$this->getPreferencesWith('mur','142'), '//a[contains(@href, "id_profil/142")][contains(@href, "id_module/2-3")]'], [$this->getPreferencesWith('vignettes', '142'), '//a[contains(@href, "id_profil/142")][contains(@href, "id_module/2-3")]'], [$this->getPreferencesWith('chrono', '142'), '//script[contains(., "id_profil\\/142")][contains(., "id_module\\/2-3")]'], - [$this->getPreferencesWith('slide_show', '142'), '//iframe[contains(@src, "id_profil/142")][contains(@src, "id_module/2-3")][contains(@title, "Kiosque")]'], + [$this->getPreferencesWith('slide_show', '142'), '//iframe[contains(@src, "id_profil/142")][contains(@src, "id_module/2-3")][contains(@title, "Boite kiosque")]'], [$this->getPreferencesWith('protoflow', '142'), '//iframe[contains(@src, "id_profil/142")][contains(@src, "id_module/2-3")]'], [$this->getPreferencesWith('cube', '142'), '//iframe[contains(@src, "id_profil/142")][contains(@src, "id_module/2-3")]'], [$this->getPreferencesWith('diaporama', '142'), '//iframe[contains(@src, "id_profil/142")][contains(@src, "id_module/2-3")]'], diff --git a/tests/library/ZendAfi/View/Helper/Accueil/MenuVerticalTest.php b/tests/library/ZendAfi/View/Helper/Accueil/MenuVerticalTest.php index e3db7630c478a260883bb62ba1b966a10e9eea43..848cbdb0e52538198448bb44cdbf1d32d4da3405 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/MenuVerticalTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/MenuVerticalTest.php @@ -16,7 +16,7 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ require_once 'library/ZendAfi/View/Helper/ViewHelperTestCase.php'; @@ -273,7 +273,7 @@ class MenuVerticalSitothequeWithManyItemsTest extends MenuVerticalWithManyItemsT 'titre' => 'Hurd', 'description' => 'Pour tous les Gnus', 'url' => 'http://hurd.gnu.org']); - + $this->_parentLabel = 'Nos Sites'; $this->_firstItemLabel = 'LinuxFr'; $this->_secondItemLabel = 'Hurd'; @@ -445,16 +445,16 @@ class MenuVerticalWithMenuTest extends MenuVerticalTestCase { /** @test */ public function menuForProfilAdulteShouldHaveUrlIdProfilFourSelected() { - $this->assertXPathContentContains($this->_html, - '//ul/li[contains(@class, "selected_profil")]/a[contains(@href, "/id_profil/4")]', + $this->assertXPathContentContains($this->_html, + '//ul/li[contains(@class, "selected_profil")]/a[contains(@href, "/id_profil/4")]', 'Profil adulte'); } /** @test */ public function menuForProfilJeunesseShouldHaveUrlIdProfilHeightNotSelected() { - $this->assertXPathContentContains($this->_html, - '//ul/li[not(contains(@class, "selected_profil"))]/a[contains(@href, "/id_profil/8")]', + $this->assertXPathContentContains($this->_html, + '//ul/li[not(contains(@class, "selected_profil"))]/a[contains(@href, "/id_profil/8")]', 'Profil jeunesse'); } } @@ -493,21 +493,16 @@ class MenuVerticalWithMenuFromOtherProfilTest extends ViewHelperTestCase { public function setUp() { parent::setUp(); - - + Zend_Controller_Front::getInstance()->setRequest(new Zend_Controller_Request_Http()); $this->fixture('Class_Profil', ['id' => 28, - 'cfg_menus' => [ - '9' => ['libelle' => 'Menu vertical', - 'menus' => [ - ['type_menu' => 'RSS', - 'libelle' => 'Flux', - 'picto' => 'vide.gif', - 'preferences' => ['id_items' => 2, - 'id_categorie' => '', - 'nb' => 5]]] - ] - ]]); + 'cfg_menus' => ['9' => ['libelle' => 'Menu vertical', + 'menus' => [['type_menu' => 'RSS', + 'libelle' => 'Flux', + 'picto' => 'vide.gif', + 'preferences' => ['id_items' => 2, + 'id_categorie' => '', + 'nb' => 5]]]]]]); $this->helper = new ZendAfi_View_Helper_Accueil_MenuVertical(12, [ @@ -649,8 +644,8 @@ class MenuVerticalWithMenuAsLinkToProfilTest extends MenuVerticalTestCase { /** @test */ public function menuForProfilAdulteShouldHaveUrlIdProfilHeightSelected() { - $this->assertXPathContentContains($this->_html, - '//ul/li[contains(@class, "selected_profil")]/a[contains(@href, "/id_profil/4")]', + $this->assertXPathContentContains($this->_html, + '//ul/li[contains(@class, "selected_profil")]/a[contains(@href, "/id_profil/4")]', 'Menu'); } diff --git a/tests/library/ZendAfi/View/Helper/Accueil/RechSimpleTest.php b/tests/library/ZendAfi/View/Helper/Accueil/RechSimpleTest.php index b80cf718d3f36939a8d27332684acd273eef7cee..6493d12660c8ffc7f3c5f3421fa9e5fb8583a223 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/RechSimpleTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/RechSimpleTest.php @@ -70,7 +70,7 @@ class ZendAfi_View_Helper_Accueil_RechSimpleWithAdminTest extends ZendAfi_View_H /** @test */ public function configActionShouldBePresent() { - $this->assertLocalXPath('//a[@data-popup="true"][contains(@href, "/admin/accueil/rechsimple/config/accueil/id_profil/2/id_module/1/type_module/RECH_SIMPLE")]'); + $this->assertLocalXPath('//a[@data-popup="true"][contains(@href, "/admin/widget/edit-widget/id/1/id_profil/2")]'); } @@ -82,13 +82,13 @@ class ZendAfi_View_Helper_Accueil_RechSimpleWithAdminTest extends ZendAfi_View_H /** @test */ public function addBlockActionShouldBePresent() { - $this->assertLocalXPath('//a[contains(@href, "/admin/accueil/add-block/id_module/1/division/1/id_profil/2")]'); + $this->assertLocalXPath('//a[contains(@href, "/admin/widget/add/after/1/division/1/id_profil/2")]'); } /** @test */ public function deleteBlockActionShouldBePresent() { - $this->assertLocalXPath('//a[contains(@href, "/admin/accueil/delete-block/id_module/1/division/1/id_profil/2")][contains(@onclick, "return confirm(")]'); + $this->assertLocalXPath('//a[contains(@href, "/admin/widget/delete/id/1/division/1/id_profil/2")][contains(@onclick, "return confirm(")]'); } } diff --git a/tests/library/ZendAfi/View/Helper/Accueil/SitoTest.php b/tests/library/ZendAfi/View/Helper/Accueil/SitoTest.php index e9782dc1c06695084a16ed44865ada38cb37ad16..a3e6ae98e65cd056f2d4fe72c041f24b6035bca8 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/SitoTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/SitoTest.php @@ -225,7 +225,7 @@ class SitoViewHelperCachedTest extends SitoViewHelperTestCase { /** @test */ public function cacheShouldBeUse() { - $value = (new Storm_Cache())->getCache()->load('1f1d719bf0abc0f8bfe5dcea1ddbd19b'); + $value = (new Storm_Cache())->getCache()->load('faf677dfb74eb163c47d535bd09a43f3'); $this->assertNotEquals(false, $value); } } diff --git a/tests/scenarios/CiteDeLaMusique/CiteDeLaMusiqueTest.php b/tests/scenarios/CiteDeLaMusique/CiteDeLaMusiqueTest.php index 8d21ad7d842705f18f9d861304b152eeecf8d85b..44fdbcb638cd69e05185cc49f4c5ff25cd29f485 100644 --- a/tests/scenarios/CiteDeLaMusique/CiteDeLaMusiqueTest.php +++ b/tests/scenarios/CiteDeLaMusique/CiteDeLaMusiqueTest.php @@ -95,8 +95,8 @@ class CiteDeLaMusiqueActivatedAdminTest extends Admin_AbstractControllerTestCase /** @test */ public function profilAvailableMenusShouldContainsCiteDeLaMusique() { - $this->dispatch('admin/profil/menusmaj/id_profil/5/id_menu/H/mode/edit', true); - $this->assertXPathContentContains('//option[@value="CITE_DE_LA_MUSIQUE"]', + $this->dispatch('admin/widget/edit-menu/id/H/id_profil/5', true); + $this->assertXPathContentContains('//ul//li', 'Lien vers Cité de la Musique'); } } @@ -124,8 +124,8 @@ class CiteDeLaMusiqueDisabledAdminTest extends Admin_AbstractControllerTestCase /** @test */ public function profilAvailableMenusShouldNotContainsCiteDeLaMusique() { - $this->dispatch('admin/profil/menusmaj/id_profil/5/id_menu/H/mode/edit', true); - $this->assertNotXPath('//option[@value="CITE_DE_LA_MUSIQUE"]'); + $this->dispatch('admin/widget/edit-menu/id/H/id_profil/5', true); + $this->assertNotXPathContentContains('//ul//li', 'Lien vers Cité de la Musique'); } } diff --git a/tests/scenarios/Mailer/MailerTest.php b/tests/scenarios/Mailer/MailerTest.php index 5ecdf8d73c3a551eb8fc9b20f644d3cc100a2a3c..f9938f711b9aba74e4635f0f2cbd54b1fb1abd56 100644 --- a/tests/scenarios/Mailer/MailerTest.php +++ b/tests/scenarios/Mailer/MailerTest.php @@ -92,7 +92,7 @@ class MailerSearchResultPostTest extends MailerWithUserConnectedTestCase { /** @test */ public function shouldContainsScriptToRedirect() { - $this->assertXPathContentContains('//script', 'document.location.href = document.location.href;'); + $this->assertXPathContentContains('//script', 'location.reload()'); } diff --git a/tests/scenarios/MultiCards/MultiCardsTest.php b/tests/scenarios/MultiCards/MultiCardsTest.php index 7272b6beae3d56eaf3108a8b6485f59d259eb2a8..3ef384dd84c7bca0eefe86c74191acc15c5d85a7 100644 --- a/tests/scenarios/MultiCards/MultiCardsTest.php +++ b/tests/scenarios/MultiCards/MultiCardsTest.php @@ -327,7 +327,7 @@ class Scenario_AbonneMultiCardsAddCardPostActionTest extends Scenario_AbonneMult /** @test */ public function responseShouldRedirectToAddCard() { - $this->assertXPathContentContains('//script', 'document.location.href = document.location.href;'); + $this->assertXPathContentContains('//script', 'location.reload();'); } @@ -976,8 +976,8 @@ class Scenario_AbonneMultiCardsAdminMenu extends Admin_AbstractControllerTestCas /** @test */ public function profilMenusSelectShouldContainsEntryFormMyCards() { - $this->dispatch('/admin/profil/menusmaj/id_profil/2/id_menu/H/mode/edit', true); - $this->assertXPathContentContains('//select[@name="type_menu"]//option[@value="ABON_CARDS"]', 'Cartes'); + $this->dispatch('/admin/widget/edit-menu/id/H/id_profil/2', true); + $this->assertXPathContentContains('//ul//li', 'cartes'); } diff --git a/tests/scenarios/Widgets/WidgetsTest.php b/tests/scenarios/Widgets/WidgetsTest.php new file mode 100644 index 0000000000000000000000000000000000000000..7b698b4a7fe4fdcfc379b92f8838b986d54c2bdb --- /dev/null +++ b/tests/scenarios/Widgets/WidgetsTest.php @@ -0,0 +1,570 @@ +<?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 + */ + +include_once('tests/fixtures/RessourcesNumeriquesFixtures.php'); + +abstract class WidgetsNavSimpleTestCase extends Admin_AbstractControllerTestCase { + protected $_storm_default_to_volatile = true; + + public function setUp() { + parent::setUp(); + + $nav = ['H' => ['libelle' => 'News', + 'picto' => 'news.png', + 'menus' => [['type_menu' => 'MENU', + 'libelle' => '', + 'picto' => 'vide.gif', + 'preferences' => [], + 'sous_menus' => []], + ['type_menu' => 'PROFIL', + 'libelle' => '', + 'picto' => 'vide.gif', + 'preferences' => ['clef_profil' => '2']], + ['type_menu' => 'MODULE_ACCUEIL_RECH_SIMPLE', + 'libelle' => 'rechercher', + 'picto' => 'search.gif'], + ['type_menu' => 'MENU', + 'libelle' => '', + 'picto' => 'vide.gif', + 'preferences' => [], + 'sous_menus' => [['type_menu' => 'PROFIL', + 'libelle' => 'agenda', + 'picto' => 'agenda.gif', + 'preferences' => ['clef_profil' => '5']]]] + ]]]; + + $this->fixture('Class_AdminVar',['id'=>'MENU_BOITE', 'valeur' => 1]); + $profil = Class_Profil::getCurrentProfil()->setMenuHautOn(true); + $profil->setCfgMenus($nav)->assertSave(); + } +} + + + + +class WidgetsNavEditLinkInFrontTest extends WidgetsNavSimpleTestCase { + + public function setUp() { + parent::setUp(); + $this->dispatch('/opac/index', true); + } + + + /** @test */ + public function linkToEditNavShouldBePopupReady() { + $this->assertXPath('//div[@id="menu_horizontal"]//a[contains(@href, "/admin/widget/edit-menu/id/H/id_profil/2")][@data-popup="true"]'); + } + + + /** @test */ + public function linkToEditFirstEntryShouldBePresent() { + $this->assertXPath('//div[@id="menu_horizontal"]//a[contains(@href, "/admin/widget/edit-menu/id/0/id_profil/2/parent/H")][@data-popup="true"]'); + } + + + /** @test */ + public function linkToEditSecondEntryShouldBePresent() { + $this->assertXPath('//div[@id="menu_horizontal"]//a[contains(@href, "/admin/widget/edit-menu/id/1/id_profil/2/parent/H")][@data-popup="true"]'); + } + + + /** @test */ + public function linkToSearchWidgetEntryShouldBePresent() { + $this->assertXPath('//div[@id="menu_horizontal"]//a[contains(@href, "/admin/widget/edit-menu/id/2/id_profil/2/parent/H")][@data-popup="true"]'); + } +} + + + +class WidgetsEditNavTest extends WidgetsNavSimpleTestCase { + + public function setUp() { + parent::setUp(); + $this->dispatch('admin/widget/edit-menu/id/H/id_profil/2', true); + } + + + /** @test */ + public function formShouldBePresent() { + $this->assertXPath('//form[contains(@action, "/admin/widget/edit-menu/id/H")]'); + } + + + /** @test */ + public function childrenShouldContainsMenu() { + $this->assertXPath('//form//input[@name="children"][contains(@value,"0;1;2")]'); + } +} + + + +class WidgetsEditNavPostDispatchTest extends WidgetsNavSimpleTestCase { + + public function setUp() { + parent::setUp(); + $this->postDispatch('admin/widget/edit-menu/id/H/id_profil/2', + ['libelle' => 'new menu', + 'picto' => 'home.gif', + 'children' => 'PANIER;12;URL;MODULE_ACCUEIL_RECH_SIMPLE']); + } + + + /** @test */ + public function profilShouldContainsPanierWithId() { + $this->assertEquals('PANIER', Class_Profil::getCurrentProfil()->getCfgMenuHorizontal()[0]['type_module']); + $this->assertEquals('0', Class_Profil::getCurrentProfil()->getCfgMenuHorizontal()[0]['id_module']); + } + + + /** @test */ + public function profilShouldContainsUrlWithId() { + $this->assertEquals('URL', Class_Profil::getCurrentProfil()->getCfgMenuHorizontal()[1]['type_module']); + $this->assertEquals('1', Class_Profil::getCurrentProfil()->getCfgMenuHorizontal()[1]['id_module']); + } + + + /** @test */ + public function menuLabelShouldBeNewMenu() { + $this->assertEquals('new menu', Class_Profil::getCurrentProfil()->getMenu('H')['libelle']); + } + + + /** @test */ + public function menuIcoShouldBeHome() { + $this->assertEquals('home.gif', Class_Profil::getCurrentProfil()->getMenu('H')['picto']); + } + + + /** @test */ + public function profilShouldSearchWidgetWithId() { + $this->assertEquals('MODULE_ACCUEIL_RECH_SIMPLE', Class_Profil::getCurrentProfil()->getCfgMenuHorizontal()[2]['type_module']); + $this->assertEquals('2', Class_Profil::getCurrentProfil()->getCfgMenuHorizontal()[2]['id_module']); + } +} + + + + +class WidgetsEditNavEntryTest extends WidgetsNavSimpleTestCase { + + public function setUp() { + parent::setUp(); + $this->dispatch('/admin/widget/edit-menu/id/1/id_profil/2/parent/H', true); + } + + + /** @test */ + public function formShouldBePresent() { + $this->assertXPath('//form[contains(@action, "/admin/widget/edit-menu/id/1")]'); + } + + + /** @test */ + public function profilSelectorShouldBePresent() { + $this->assertXPath('//form//select[@name="clef_profil"]//option[@value="2"][@selected]'); + } +} + + + + +class WidgetsEditNavEntryPostDispatchTest extends WidgetsNavSimpleTestCase { + + /** @test */ + public function profilShouldContainsLinkToProfil() { + $this->postDispatch('admin/widget/edit-menu/id/1/id_profil/2/parent/H', ['libelle' => 'home', + 'picto' => 'home.gif', + 'clef_profil' => '25']); + $this->assertEquals('PROFIL', Class_Profil::getCurrentProfil()->getCfgMenuHorizontal()[1]['type_menu']); + $this->assertEquals('1', Class_Profil::getCurrentProfil()->getCfgMenuHorizontal()[1]['id_module']); + $this->assertEquals('25', Class_Profil::getCurrentProfil()->getCfgMenuHorizontal()[1]['clef_profil']); + $this->assertEquals('25', Class_Profil::getCurrentProfil()->getCfgMenuHorizontal()[1]['preferences']['clef_profil']); + } + + + /** @test */ + public function profilShouldContainsMenu() { + $this->postDispatch('admin/widget/edit-menu/id/3/id_profil/2/parent/H', ['libelle' => 'menu', + 'picto' => 'vide.gif', + 'children' => 'PANIER;4;RECH_SIMPLE;']); + $this->assertEquals('MENU', Class_Profil::getCurrentProfil()->getCfgMenuHorizontal()[3]['type_menu']); + $this->assertEquals('3', Class_Profil::getCurrentProfil()->getCfgMenuHorizontal()[3]['id_module']); + $this->assertEquals([4 => ['type_module' => 'PANIER', + 'type_menu' => 'PANIER', + 'id_module' => 4, + 'libelle' => 'Lien vers mes paniers', + 'picto' => '', + 'action' => '', + 'preferences' => []], + 5 => ['type_menu' => 'PROFIL', + 'libelle' => 'agenda', + 'picto' => 'agenda.gif', + 'id_module' => 5, + 'preferences' => ['clef_profil' => '5']], + 6 => ['type_module' => 'RECH_SIMPLE', + 'type_menu' => 'RECH_SIMPLE', + 'id_module' => 6, + 'libelle' => 'Lien vers la recherche', + 'picto' => '', + 'action' => '', + 'preferences' => []]], Class_Profil::getCurrentProfil()->getCfgMenuHorizontal()[3]['sous_menus']); + } + + + /** @test */ + public function profilShouldContainsLinkToProfilAgenda() { + $this->postDispatch('admin/widget/edit-menu/id/4/id_profil/2/parent/H', ['libelle' => 'agenda', + 'picto' => 'agenda.svg', + 'clef_profil' => '7']); + $this->assertEquals(['type_menu' => 'PROFIL', + 'type_module' => 'PROFIL', + 'action' => '', + 'libelle' => 'agenda', + 'picto' => 'agenda.svg', + 'clef_profil' => '7', + 'preferences' => ['clef_profil' => '7', + 'type_module' => 'PROFIL', + 'type_menu' => 'PROFIL', + 'id_module' => '4', + 'libelle' => 'agenda', + 'picto' => 'agenda.svg', + 'action' => ''], + 'id_module' => 4], + Class_Profil::getCurrentProfil()->getCfgMenuHorizontal()[3]['sous_menus'][4]); + } +} + + + + +class WidgetsEditNavPostReorderDispatchTest extends WidgetsNavSimpleTestCase { + + public function setUp() { + parent::setUp(); + $this->postDispatch('admin/widget/edit-menu/id/H/id_profil/2', + ['libelle' => 'new menu', + 'picto' => 'home.gif', + 'children' => '2;0;1']); + } + + + /** @test */ + public function firstChildShouldBeSearchWidget() { + $this->assertEquals('MODULE_ACCUEIL_RECH_SIMPLE', Class_Profil::getCurrentProfil()->getCfgMenuHorizontal()[0]['type_menu']); + $this->assertEquals('0', Class_Profil::getCurrentProfil()->getCfgMenuHorizontal()[0]['id_module']); + } + + + /** @test */ + public function secondChildShouldBeMenu() { + $this->assertEquals('MENU', Class_Profil::getCurrentProfil()->getCfgMenuHorizontal()[1]['type_menu']); + $this->assertEquals('1', Class_Profil::getCurrentProfil()->getCfgMenuHorizontal()[1]['id_module']); + } +} + + + + +class WidgetsDispatchAllMenusTest extends Admin_AbstractControllerTestCase { + protected $_storm_default_to_volatile = true; + + public function entries() { + RessourcesNumeriquesFixtures::activateCVS(); + + $this->fixture('Class_AdminVar', ['id'=>'MENU_BOITE', 'valeur' => 1]); + + $this->fixture('Class_AdminVar', ['id' => 'FORMATIONS', 'valeur' => 1]); + + $datas = []; + foreach((new Class_Systeme_ModulesMenu())->getEntries() as $menu) + $datas[] = [$menu->getForm(), + $menu->getLabel()]; + + return $datas; + } + + + /** + * @dataProvider entries + * @test + */ + public function allMenuShouldHaveADedicatedForm($form, $definition) { + $this->assertNotNull($form, $definition); + } + + + /** + * @dataProvider entries + * @test + */ + public function formsShouldExists($form, $definition) { + $this->assertNotNull(call_user_func([$form, 'newWith'])); + } +} + + + + +class WidgetsNavMenuPostTest extends Admin_AbstractControllerTestCase { + protected $_storm_default_to_volatile = true; + + public function setUp() { + parent::setUp(); + + $nav = ['H' => ['libelle' => 'News', + 'picto' => 'news.png', + 'menus' => [['type_menu' => 'MENU', + 'libelle' => '', + 'picto' => 'vide.gif', + 'preferences' => [], + 'sous_menus' => [['type_menu' => 'PROFIL', + 'libelle' => '', + 'picto' => 'vide.gif', + 'preferences' => ['clef_profil' => '2']]]]]]]; + $this->fixture('Class_AdminVar',['id'=>'MENU_BOITE', 'valeur' => 1]); + $profil = Class_Profil::getCurrentProfil()->setMenuHautOn(true); + $profil->setCfgMenus($nav)->assertSave(); + + $this->postDispatch('admin/widget/edit-menu/id/1/id_profil/2/parent/H', + ['libelle' => 'new profil', + 'picto' => 'home.gif', + 'clef_profil' => '4']); + } + + + /** @test */ + public function profilShouldHaveBeenUpdated() { + $this->assertEquals(['type_menu' => 'PROFIL', + 'type_module' => 'PROFIL', + 'action' => '', + 'libelle' => 'new profil', + 'picto' => 'home.gif', + 'preferences' => ['clef_profil' => '4', + 'type_module' => 'PROFIL', + 'type_menu' => 'PROFIL', + 'id_module' => '1', + 'libelle' => 'new profil', + 'picto' => 'home.gif', + 'action' => ''], + 'id_module' => 1, + 'clef_profil' => '4'], Class_Profil::getCurrentProfil()->getCfgMenuHorizontal()[0]['sous_menus'][1]); + } +} + + + +abstract class WidgetsSimpleTestCase extends WidgetsNavSimpleTestCase { + + public function setUp() { + parent::setUp(); + + $simple_widgets = ['modules' => ['1' => ['division' => '4', + 'type_module' => 'RECH_SIMPLE', + 'preferences' => []], + '6' => ['division' => '3', + 'type_module' => 'MENU_VERTICAL', + 'preferences' => ['menu' => '5-8']], + '4' => ['division' => '4', + 'type_module' => 'CALENDRIER']]]; + + Class_Profil::getCurrentProfil() + ->setCfgAccueil($simple_widgets) + ->save(); + + $profil = $this->fixture('Class_Profil', + ['id' => 5]); + + $menus = ['H' => ['libelle' => 'News', + 'picto' => 'news.png', + 'menus' => []], + '8' => ['libelle' => 'Menu used in an other profil', + 'menus' => [['type_menu' => 'PROFIL', + 'id_module' => 0, + 'libelle' => '', + 'picto' => 'vide.gif', + 'preferences' => ['clef_profil' => '2']]]]]; + + $profil->setCfgMenus($menus)->save(); + } +} + + + +class WidgetsEditLinksTest extends WidgetsSimpleTestCase { + + public function setUp() { + parent::setUp(); + $this->dispatch('/opac', true); + } + + + /** @test */ + public function linkToEditWidgetSearchShouldBePresent() { + $this->assertXPath('//div[contains(@class, "boite")]//a[contains(@href, "admin/widget/edit-widget/id/1/id_profil/2")]'); + } + + + /** @test */ + public function linkToEditMenuShouldBePresent() { + $this->assertXPath('//div[contains(@class, "boite")]//a[contains(@href, "admin/widget/edit-menu/id/8/id_profil/5")]'); + } + + + /** @test */ + public function linkToEditSubMenuEntryOfMenuShouldBePresent() { + $this->assertXPath('//div[contains(@class, "boite")]//a[contains(@href, "admin/widget/edit-menu/id/0/id_profil/5/parent/8")]'); + } +} + + + + +class WidgetsEditWidgetTest extends WidgetsSimpleTestCase { + + public function setUp() { + parent::setUp(); + $this->dispatch('admin/widget/edit-widget/id/1/id_profil/2', true); + } + + + /** @test */ + public function searchButtonInputShouldBePresent() { + $this->assertXpath('//form//input[@type="text"][@name="search_button"]'); + } +} + + + + +class WidgetsPostEditVerticalMenuTest extends WidgetsSimpleTestCase { + + public function setUp() { + parent::setUp(); + $this->postDispatch('admin/widget/edit-widget/id/6/id_profil/2', ['menu' => 'new_menu']); + Class_Profil::clearCache(); + } + + + /** @test */ + public function newMenuIdShouldHaveBeenSetInMenuVerticalSettongs() { + $this->assertEquals('2-0', Class_Profil::getCurrentProfil()->getCfgAccueilAsArray()['modules'][6]['menu']); + } + + + /** @test */ + public function newMenuShouldInMenuCfg() { + $this->assertEquals(['libelle' => 'Nouveau menu', + 'picto' => '', + 'menus' => []], Class_Profil::getCurrentProfil()->getCfgMenusAsArray()[0]); + } +} + + + + +class WidgetsVerticalMenuWithDeepMenuTest extends WidgetsSimpleTestCase { + + public function setUp() { + parent::setUp(); + $profil = Class_Profil::getCurrentProfil(); + $cfg = $profil->getCfgMenusAsArray(); + $h = $cfg['H']; + $cfg['V'] = $h; + + $profil->setCfgMenus($cfg)->save(); + + $this->dispatch('admin/profil/menusindex/id_profil/2', true); + } + + + /** @test */ + public function editMenuShouldBePresent() { + $this->assertXPath('//a[contains(@href, "admin/widget/edit-menu/id/3/id_profil/2/parent/V/")][contains(@title, "Modifier le menu")]'); + } + + + /** @test */ + public function editFirstSubMenuEntryShouldBePresent() { + $this->assertXPath('//ul//li//ul//li//a[contains(@href, "admin/widget/edit-menu/id/4/id_profil/2/parent/V/")][contains(@title, "Modifier l\'entrée")]'); + } +} + + + +class WidgetsDeleteMenuTest extends WidgetsSimpleTestCase { + + public function setUp() { + parent::setUp(); + $profil = Class_Profil::getCurrentProfil(); + $cfg = $profil->getCfgMenusAsArray(); + $h = $cfg['H']; + $cfg['V'] = $h; + + $profil->setCfgMenus($cfg)->save(); + + $this->dispatch('admin/widget/delete-menu/id/V/id_profil/2', true); + } + + + /** @test */ + public function shouldRedirect() { + $this->assertRedirect(); + } + + + /** @test */ + public function verticalMenuShouldHaveBeenDeleted() { + Class_Profil::clearCache(); + $cfg = Class_Profil::getCurrentProfil()->getCfgMenusAsArray(); + $this->assertFalse(isset($cfg['V'])); + } +} + + + +class WidgetsPopupMenuTest extends WidgetsSimpleTestCase { + + public function setUp() { + parent::setUp(); + $this->dispatch('admin/widget/edit-menu/id/H/id_profil/2/render/popup', true); + } + + + /** @test */ + public function continueButtonShouldBePresent() { + $this->assertContains('Valider et continuer', $this->_response->getBody()); + } +} + + +class WidgetsButtonsTest extends WidgetsNavSimpleTestCase { + + public function setUp() { + parent::setUp(); + $this->dispatch('admin/widget/edit-menu/id/H/id_profil/2', true); + } + + + /** @test */ + public function continueButtonShouldNotBePresent() { + $this->assertNotXPathContentContains('//button', 'Valider et continuer'); + } +} \ No newline at end of file