diff --git a/VERSIONS_HOTLINE/72797 b/VERSIONS_HOTLINE/72797 new file mode 100644 index 0000000000000000000000000000000000000000..a340c2f2a0b800fae35683924bb9e89c312190b4 --- /dev/null +++ b/VERSIONS_HOTLINE/72797 @@ -0,0 +1,2 @@ + - ticket #72797 : Administration : correction du placement de la localisation de documents sur un plan. + \ No newline at end of file diff --git a/VERSIONS_HOTLINE/72890 b/VERSIONS_HOTLINE/72890 new file mode 100644 index 0000000000000000000000000000000000000000..afaa94e6467f0533620658f39e817fcd1478c301 --- /dev/null +++ b/VERSIONS_HOTLINE/72890 @@ -0,0 +1,2 @@ + - ticket #72890 : Explorateur de fichiers : correction des liens d'édition des articles, des profils et des domaines. + \ No newline at end of file diff --git a/application/modules/admin/controllers/BibController.php b/application/modules/admin/controllers/BibController.php index 5c1ed5701526c36b2a22a9e0415e5ecad5de0a64..9ef8c5dc22073eeaf0d1eb9d3324a77bc1147a0b 100644 --- a/application/modules/admin/controllers/BibController.php +++ b/application/modules/admin/controllers/BibController.php @@ -65,8 +65,10 @@ class Admin_BibController extends ZendAfi_Controller_Action { protected function _checkPost($localisation) { $this->view->localisation = $localisation; + if (!$this->_request->isPost()) return false; + $erreurs=[]; $data = $this->_request->getPost(); if ($data) @@ -85,8 +87,7 @@ class Admin_BibController extends ZendAfi_Controller_Action { if (!$localisation->save()) return false; - $this->_redirect('admin/bib/localisations/id_bib/'.$id_bib); - return true; + return $this->_redirectToReferer(); } diff --git a/application/modules/admin/views/scripts/bib/localisationsmaj.phtml b/application/modules/admin/views/scripts/bib/localisationsmaj.phtml index 5791a3e6bdc5794525a61ba7a43eddce13495d1f..b418c794ee1886bcd7fb6a06647b0b3dd62ce20e 100644 --- a/application/modules/admin/views/scripts/bib/localisationsmaj.phtml +++ b/application/modules/admin/views/scripts/bib/localisationsmaj.phtml @@ -4,75 +4,80 @@ Class_ScriptLoader::getInstance()->addTagSelection(); <link rel="stylesheet" type="text/css" media="screen" href="<?php echo URL_ADMIN_JS ?>slimbox/slimbox2.css"> <script type="text/javascript" src="<?php echo URL_ADMIN_JS?>slimbox/slimbox2.js"> </script> -<script type="text/javascript" src="<?php echo URL_ADMIN_JS?>jquery_ui/jquery.ui.core.min.js"> </script> -<script type="text/javascript" src="<?php echo URL_ADMIN_JS?>jquery_ui/jquery.ui.widget.min.js"> </script> -<script type="text/javascript" src="<?php echo URL_ADMIN_JS?>jquery_ui/jquery.ui.mouse.min.js"> </script> -<script type="text/javascript" src="<?php echo URL_ADMIN_JS?>jquery_ui/jquery.ui.draggable.min.js"> </script> <script> - // Rendre le point draggable et effacer le x,y si on change de plan - $(function() - { - $('#point_localisation').draggable - ({ - containment: '#lbImage', - drag: function(event, ui) - { - container=$('#lbImage').offset(); - $('#POS_Y').attr('value',ui.position.top-container.top); - $('#POS_X').attr('value',ui.position.left-container.left); - } - }) - $('#id_plan').change(function() - { - $('#POS_X').attr('value','0'); - $('#POS_Y').attr('value','0'); - }); - }); - - - // Init function de fin du load ajax - jQuery(function($) - { - $('#plan').ajaxStop(function() - { - $('#patience').css('display','none'); - if($(this).html()=="ERREUR") {alert("Impossible de trouver l'image de ce plan."); return;} - $('#ref_plan').attr('title',$('#libelle').val()); - jQuery(function($) { - $("a[rel^='lightbox']").slimbox({onClose:function(){$('#point_localisation').css('display','none')}},null,null); - }); - $('#point_localisation > img').attr('src',$('#select_ANIMATION').attr('src')); - $('#img_plan').trigger('click'); - imageLoaded(); - }); - }); - - // Verif si le slimbox est affiché - function imageLoaded() - { - if($('#lbBottomContainer').css('display')=='none') - { - window.setTimeout(imageLoaded,1000); - return; - } - container=$('#lbImage').offset(); - x=container.left+parseInt($('#POS_X').val()); - y=container.top+parseInt($('#POS_Y').val()); - $('#point_localisation') - .css('display','block') - .css('top',y+'px') - .css('left',x+'px'); - } - - // Affichage du plan - function afficherPlan() - { - var id_plan=$("#id_plan").val(); - if(id_plan=="0") {alert("Sélectionnez le plan a associer à cette localisation."); return; } - $('#patience').css('display','block'); - $('#plan').load('<?php echo BASE_URL ?>/admin/bib/ajaximageplan/id_plan/'+id_plan); - } + // Rendre le point draggable et effacer le x,y si on change de plan + $(function() + { + $('#point_localisation').draggable( + { + containment: '#lbImage', + drag: function(event, ui) { + container=$('#lbImage').offset(); + $('.modules .form input').change(); + $('#POS_Y').attr('value',ui.position.top-container.top); + $('#POS_X').attr('value',ui.position.left-container.left); + } + }); + $('#id_plan').change(function() { + $('#POS_X').attr('value','0'); + $('#POS_Y').attr('value','0'); + }); + }); + + + function displayPlan() { + $('#patience').hide(); + + if($('#plan').html()=="ERREUR") { + alert("Impossible de trouver l'image de ce plan."); + return; + } + + $('#ref_plan').attr('title', + $('#libelle').val()); + + $("a[rel^='lightbox']").slimbox({ + onClose:function() { + $('#point_localisation').css('display','none')} + }, + null, + null); + + $('#point_localisation > img').attr('src', $('#select_ANIMATION').attr('src')); + $('#img_plan').trigger('click'); + imageLoaded(); + } + + // Verif si le slimbox est affiché + function imageLoaded() { + if($('#lbBottomContainer').css('display') == 'none') { + window.setTimeout(imageLoaded, 1000); + return; + } + $('#lbBottomContainer, #lbBottomContainer * ').css('z-index', '9998'); + + container=$('#lbImage').offset(); + x=container.left+parseInt($('#POS_X').val()); + y=container.top+parseInt($('#POS_Y').val()); + $('#point_localisation') + .css('display','block') + .css('top',y+'px') + .css('left',x+'px'); + } + + // Affichage du plan + function afficherPlan() { + $('#patience').show(); + var id_plan = $("#id_plan").val(); + + if(id_plan=="0") { + alert("Sélectionnez le plan a associer à cette localisation."); + return; + } + + $('#plan').load('<?php echo BASE_URL ?>/admin/bib/ajaximageplan/id_plan/'+id_plan, [], displayPlan()); + } </script> <div id="plan" style="display:none"></div> @@ -80,7 +85,6 @@ Class_ScriptLoader::getInstance()->addTagSelection(); <h3>Bibliothèque : <?php echo $this->nom_bib ?></h3> -<center> <div class="form" align="center" > <form name="form" action="<?php echo $this->url() ?>" method="post"> @@ -112,7 +116,7 @@ Class_ScriptLoader::getInstance()->addTagSelection(); <input type="hidden" name="POS_Y" id="POS_Y" value="<?php echo $this->localisation->getPosY() ?>"> <?php echo $this->formSelect("id_plan", $this->localisation->getPlan() ? $this->localisation->getPlan()->getId(): 0,"",$this->plans) ?> - <a href="#" onclick="afficherPlan()">» Placer sur le plan</a> + <a href="#" onclick="afficherPlan();">» Placer sur le plan</a> </td> </tr> @@ -182,21 +186,12 @@ Class_ScriptLoader::getInstance()->addTagSelection(); </tr> </table> </fieldset> - - <table> - <tr> - <td align="right" style="padding-right:5px;"> - <?php echo $this->button_Submit(); ?> - </td> - <td align="left" style="padding-left:5px;"> - <?php - echo $this->button_Back( - (new Class_Entity())->setUrl($this->url(['action' => 'localisations', - 'id_bib' => $this->id_bib]))); - ?> - </td> - </tr> - </table> </form> + <?php + $back_buttton_settings = (new Class_Entity())->setUrl($this->url(['action' => 'localisations', + 'id_bib' => $this->id_bib])); + echo $this->tag('div', + $this->button_Submit() . $this->button_Back($back_buttton_settings), + ['class' => 'admin-buttons']); + ?> </div> -</center> diff --git a/application/modules/opac/controllers/RechercheController.php b/application/modules/opac/controllers/RechercheController.php index 12f4c025050f2a9b81d8ca96fdc37019ba3284b6..5c7b3423157387a6ecb88445987d045d085b3fe3 100644 --- a/application/modules/opac/controllers/RechercheController.php +++ b/application/modules/opac/controllers/RechercheController.php @@ -112,10 +112,7 @@ class RechercheController extends ZendAfi_Controller_Action { && !$criteres_recherche->ownedBy(Class_Users::getIdentity())) return $this->_redirect('opac/auth/login?redirect=' . urlencode(Class_Url::absolute($this->view->url()))); - $this->getFrontController()->getRouter()->getCurrentRoute() - ->match(str_replace(BASE_URL, - '', - $this->view->url($criteres_recherche->getCriteres()))); + $this->_helper->addQuery($this->view, $criteres_recherche->getCriteres()); $this->_runSearchAndRender($criteres_recherche); } diff --git a/library/ZendAfi/Controller/Action/Helper/AddQuery.php b/library/ZendAfi/Controller/Action/Helper/AddQuery.php new file mode 100644 index 0000000000000000000000000000000000000000..abf52755d86ccf7775fd3690e342746b369a6521 --- /dev/null +++ b/library/ZendAfi/Controller/Action/Helper/AddQuery.php @@ -0,0 +1,33 @@ +<?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_Controller_Action_Helper_AddQuery extends Zend_Controller_Action_Helper_Abstract { + + public function direct($view, array $params = []) { + $this->getFrontController() + ->getRouter() + ->getCurrentRoute() + ->match(str_replace(BASE_URL, + '', + $view->url($params ? $params : $this->getRequest()->getQuery()))); + } +} \ 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 8c0217170fc63ae3a84bccb985c0cebf0071c5fd..f7ea6550a77db96850e9e1b78a665b9b586d364c 100644 --- a/library/ZendAfi/Controller/Plugin/Manager/Manager.php +++ b/library/ZendAfi/Controller/Plugin/Manager/Manager.php @@ -140,6 +140,8 @@ class ZendAfi_Controller_Plugin_Manager_Manager extends ZendAfi_Controller_Plugi if ($this->_response->isRedirect()) return; + $this->_helper->addQuery($this->_view); + if (!$model = $this->_findModel()) { $this->_redirectToIndex(); return; diff --git a/tests/application/modules/admin/controllers/BibControllerTest.php b/tests/application/modules/admin/controllers/BibControllerTest.php index 4d84e2f15dc56590ce454f0819d5679e5c287347..75192b2ea8e00779510fefdb6842b2dbca04bd58 100644 --- a/tests/application/modules/admin/controllers/BibControllerTest.php +++ b/tests/application/modules/admin/controllers/BibControllerTest.php @@ -1217,12 +1217,14 @@ class BibControllerLocalisationNewTest extends BibControllerTestCase { } + + + class BibControllerLocalisationNewPostTest extends BibControllerTestCase { public function setUp() { parent::setUp(); $file_system = Storm_Test_ObjectWrapper::mock() ->whenCalled('file_exists') -// ->with(ROOT_PATH . '/userfiles/photobib/localisations/bib_2_localisation_9.jpg') ->answers(true) ->whenCalled('rename') ->answers(true) @@ -1239,9 +1241,8 @@ class BibControllerLocalisationNewPostTest extends BibControllerTestCase { /** @test */ - public function responseShouldRedirectToLocalisationList() { - $this->assertRedirectTo('/admin/bib/localisations/id_bib/2', - $this->getResponseLocation()); + public function responseShouldRedirectToReferer() { + $this->assertRedirect(); } @@ -1250,13 +1251,12 @@ class BibControllerLocalisationNewPostTest extends BibControllerTestCase { $this->assertNotNull(Class_Localisation::findFirstBy(['libelle' => '5eme Etage'])); } + /** @test */ public function imageShouldExists(){ $localisation = Class_Localisation::findFirstBy(['libelle' => '5eme Etage']); $this->assertEquals('bib_2_localisation_1.png',$localisation->getImage()); } - - } @@ -1267,7 +1267,6 @@ class BibControllerLocalisatonDeleteTest extends BibControllerTestCase { parent::setUp(); $file_system = Storm_Test_ObjectWrapper::mock() ->whenCalled('file_exists') -// ->with(ROOT_PATH . '/userfiles/photobib/localisations/bib_2_localisation_9.jpg') ->answers(true) ->whenCalled('unlink') ->answers(true) @@ -1527,6 +1526,11 @@ class BibControllerLocalisationMajTest extends BibControllerTestCase { $this->assertXPath('//iframe[contains(@src,"filename=bib_2_localisation_9.jpg")]'); } + + /** @test */ + public function scriptShouldContainsDisplayPlan() { + $this->assertXPath('//script', 'function displayPlan()'); + } } diff --git a/tests/application/modules/admin/controllers/CmsControllerTest.php b/tests/application/modules/admin/controllers/CmsControllerTest.php index 906e951e9cabee88faf3da4d54f32a5061cb77a0..85c8d47a4ad38e37dd0489830c2ab791ac5d4d12 100644 --- a/tests/application/modules/admin/controllers/CmsControllerTest.php +++ b/tests/application/modules/admin/controllers/CmsControllerTest.php @@ -2993,7 +2993,7 @@ class CmsControllerEditArticleWithDate30December2014Test extends CmsControllerte Class_Users::getIdentity()->setRoleLevel(ZendAfi_Acl_AdminControllerRoles::SUPER_ADMIN); - $this->dispatch('/admin/cms/edit/id/4'); + $this->dispatch('/admin/cms/edit/id/4', true); } @@ -3008,3 +3008,24 @@ class CmsControllerEditArticleWithDate30December2014Test extends CmsControllerte $this->assertXPath('//input[@checked="checked"][@value="1"]'); } } + + + + +class CmsControllerEditArticleWithQueryTest extends CmsControllertestCase { + + public function setup() { + parent::setup(); + $this->concert->setFin('2014-12-30'); + + Class_Users::getIdentity()->setRoleLevel(ZendAfi_Acl_AdminControllerRoles::SUPER_ADMIN); + + $this->dispatch('/admin/cms/edit?id=4', true); + } + + + /** @test */ + public function formActionShouldContainsId4() { + $this->assertXPath('//form[@action="/admin/cms/edit/id/4"]'); + } +} \ No newline at end of file diff --git a/tests/application/modules/opac/controllers/RechercheControllerTest.php b/tests/application/modules/opac/controllers/RechercheControllerTest.php index f71b3af9aa467a367e0845cfff12a19f0256d03a..13cd4d2015e81d3f6e26557d667013357c46f868 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerTest.php @@ -1234,6 +1234,12 @@ class RechercheAvanceeControllerSimpleActionWithDefaultConfigTest extends Recher } + /** @test */ + public function pageShouldContainsRechTitresMaupassantWrappedInSlahes() { + $this->assertXPath('//a[contains(@href, "/rech_titres/maupassant")]'); + } + + /** @test */ public function userSettingBookmarkedDomainShouldBeOne() { $this->assertEquals(1,