diff --git a/application/modules/admin/controllers/CatalogueController.php b/application/modules/admin/controllers/CatalogueController.php index 68eda58262106e407855b8d3dc2c9e2861cffac6..815dd87b194c05470acaef34fbd8969af09e58f6 100644 --- a/application/modules/admin/controllers/CatalogueController.php +++ b/application/modules/admin/controllers/CatalogueController.php @@ -36,7 +36,6 @@ class Admin_CatalogueController extends ZendAfi_Controller_Action { } - public function testerAction() { if (!$catalogue = Class_Catalogue::find((int)$this->_getParam("id_catalogue", 0))) $this->_redirect("admin/catalogue/index"); @@ -76,12 +75,20 @@ class Admin_CatalogueController extends ZendAfi_Controller_Action { } $this->view->catalogue = $catalogue; + + $params = $catalogue->toArray(); + $params['domain'] = $catalogue; + $this->view->form = ZendAfi_Form_Configuration_Domain::newWith($params); + $this->view->form->setAction($this->view->url()); + + if($this->_request->isPost()) + $this->view->form->isValid($this->_request->getPost()); + $this->view->titre = $this->_('Ajout de domaine'); $this->getHelper('ViewRenderer')->renderScript('catalogue/form.phtml'); } - protected function updateConfigKiosque($id_module, $catalogue){ $profil = Class_Profil::getCurrentProfil(); $module_config = $profil->getModuleAccueilConfig($id_module, 'KIOSQUE'); @@ -106,12 +113,16 @@ class Admin_CatalogueController extends ZendAfi_Controller_Action { } $this->view->titre = $this->_('Modification du domaine: %s', $catalogue->getLibelle()); + $this->view->catalogue = $catalogue; $params = $catalogue->toArray(); $params['domain'] = $catalogue; $this->view->form = ZendAfi_Form_Configuration_Domain::newWith($params); $this->view->form->setAction($this->view->url()); + if($this->_request->isPost()) + $this->view->form->isValid($this->_request->getPost()); + $this->getHelper('ViewRenderer')->renderScript('catalogue/form.phtml'); } @@ -132,6 +143,10 @@ class Admin_CatalogueController extends ZendAfi_Controller_Action { $new_catalogue = $catalogue->copy(); $this->view->titre = $this->_('Duplication du domaine: %s', $catalogue->getLibelle()); $this->view->catalogue = $new_catalogue; + $params = $new_catalogue->toArray(); + $params['domain'] = $new_catalogue; + $this->view->form = ZendAfi_Form_Configuration_Domain::newWith($params); + $this->view->form->setAction($this->view->url()); $this->getHelper('ViewRenderer')->renderScript('catalogue/form.phtml'); } diff --git a/library/ZendAfi/Form/Configuration/Domain.php b/library/ZendAfi/Form/Configuration/Domain.php index cb9c5f98bff8e22381a67e60ee5c725b779a41c4..296fe47187e615188e705720f6c1c6a6d9c5356d 100644 --- a/library/ZendAfi/Form/Configuration/Domain.php +++ b/library/ZendAfi/Form/Configuration/Domain.php @@ -142,7 +142,7 @@ class ZendAfi_Form_Configuration_Domain extends ZendAfi_Form { if (Class_AdminVar::isOAIServerEnabled()) $this->addElement('text', - 'oai-spec', + 'oai_spec', ['label' => $this->_('Serveur OAI')]); } @@ -205,7 +205,8 @@ class ZendAfi_Form_Configuration_Domain extends ZendAfi_Form { ->addDisplayGroup(['url_img', 'description', - 'indexer'], + 'indexer', + 'oai_spec'], 'other', ['legend' => $this->_('Autres')]); diff --git a/tests/application/modules/admin/controllers/CatalogueControllerTest.php b/tests/application/modules/admin/controllers/CatalogueControllerTest.php index aba261bd287f7883de3fa84f9741cae2c1737fcf..b965f182f96faf423e85d321d36173d22b07743f 100644 --- a/tests/application/modules/admin/controllers/CatalogueControllerTest.php +++ b/tests/application/modules/admin/controllers/CatalogueControllerTest.php @@ -269,14 +269,14 @@ class CatalogueControllerWithAdminBibAndRightTotalAccessTest extends AdminCatalo /** @test */ public function editCatalogueShouldShowValiderButton() { $this->dispatch('/admin/catalogue/edit/id_catalogue/300'); - $this->assertXPathContentContains('//td', 'Valider'); + $this->assertXPathContentContains('//button', 'Valider'); } /** @test */ public function editCatalogueShouldAddToBookmarksCheckboxBePresent() { $this->dispatch('/admin/catalogue/edit/id_catalogue/300'); - $this->assertXPathContentContains('//td//input[@type="checkbox"][@id="indexer"]/following-sibling::span', 'Nécessite une intégration'); + $this->assertXPathContentContains('//td', 'Nécessite une intégration'); } } @@ -949,7 +949,7 @@ class CatalogueControllerDuplicateCatalogueTest extends AdminCatalogueController /** @test */ public function inputLibelleShouldContainsNouveauDomaine() { - $this->assertXPath('//input[@name="libelle"][@value="** Nouveau Domaine **"]',$this->_response->getBody()); + $this->assertXPath('//input[@name="libelle"][@value="** Nouveau Domaine **"]'); } @@ -960,7 +960,6 @@ class CatalogueControllerDuplicateCatalogueTest extends AdminCatalogueController $this->assertXPathContentContains('//select[@name="parent_id"]//option[@value="200"]', 'Politique'); $this->assertXPathContentContains('//select[@name="parent_id"]//option[@value="300"]', 'Moyen-age'); } - } @@ -1002,6 +1001,7 @@ class CatalogueControllerAddCatalogueTest extends AdminCatalogueControllerTestCa $this->dispatch('/admin/catalogue/add/id_catalogue/100', true); } + /** @test */ public function inputDeweyShouldBePresent() { $this->assertXPath('//input[@name="dewey"]'); @@ -1151,27 +1151,22 @@ class CatalogueControllerAddCatalogueInvalidePostTest extends AdminCatalogueCont public function setUp() { parent::setUp(); - $this->postDispatch('/admin/catalogue/add', array('libelle' => '', - 'pcdm4' => '5', - 'annee_debut' => '2012', - 'annee_fin' => '2010')); + $this->postDispatch('/admin/catalogue/add', ['libelle' => '', + 'pcdm4' => '5', + 'annee_debut' => '2012', + 'annee_fin' => '2010']); } /** @test */ public function pageShouldDisplayErrorsLibelleRequis() { - $this->assertXPathContentContains('//p[@class="error"]', 'Le libellé est requis'); - } - - - /** @test */ - public function pageShouldDisplayErrorAnneeFinSuperieurAnneeDebut() { - $this->assertXPathContentContains('//p[@class="error"]', "L'année de début doit être inférieure ou égale à l'année de fin"); + $this->assertXPathContentContains('//form', 'Une valeur est requise'); } } + class CatalogueControllerDeleteAction extends AdminCatalogueControllerTestCase { public function setUp() { parent::setUp(); @@ -1245,7 +1240,7 @@ class CatalogueControllerEditActionForReferent extends AdminCatalogueControllerT /** @test */ public function shouldAccessItsDomainEdition() { $this->dispatch('/admin/catalogue/edit/id_catalogue/300'); - $this->assertXPathContentContains('//td', 'Valider'); + $this->assertXPathContentContains('//button', 'Valider'); } }