Skip to content
Snippets Groups Projects
Commit 5b228717 authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

Merge branch 'hotline#77676_modify_author_function_unimarc' into 'hotline'

Hotline#77676 modify author function unimarc

See merge request !2749
parents 2d30341a 7ddef61a
Branches
Tags
3 merge requests!2767Hotline,!2755Hotline,!2749Hotline#77676 modify author function unimarc
Pipeline #4645 canceled with stage
in 3 minutes and 4 seconds
Showing
with 245 additions and 5 deletions
- ticket #77676 : Administration : Ajout des fonctions auteur dans l'explorateur de codifications
\ No newline at end of file
<?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 Admin_AuthorFunctionBrowserController extends ZendAfi_Controller_Action {
public function getPlugins() {
return ['ZendAfi_Controller_Plugin_ResourceDefinition_AuthorFunction',
'ZendAfi_Controller_Plugin_Manager_AuthorFunction'];
}
}
\ No newline at end of file
<?php
echo $this->renderForm($this->form);
......@@ -70,11 +70,11 @@ class ZendAfi_Acl_AdminControllerGroup {
];
$this->_activated = array_merge($this->_activated,
$this->_codififications());
$this->_codifications());
}
protected function _codififications() {
protected function _codifications() {
$enabled = Class_AdminVar::isCodificationBrowserEnabled();
return array_fill_keys(['codification-browser',
......@@ -89,6 +89,7 @@ class ZendAfi_Acl_AdminControllerGroup {
'subject-browser',
'tag-browser',
'doctype-browser',
'author-function-browser',
'pcdm4-browser',
'dewey-browser',
'interest-browser',
......
......@@ -56,6 +56,10 @@ class ZendAfi_Controller_Action_Helper_ListViewMode_Codification
->setLibelle($this->_('Emplacements'))
->setController('location-browser'),
(new Class_CodifAuteurFonction)
->setLibelle($this->_('Fonctions auteurs'))
->setController('author-function-browser'),
(new Class_CodifGenre)
->setLibelle($this->_('Genres'))
->setController('genre-browser'),
......@@ -86,7 +90,8 @@ class ZendAfi_Controller_Action_Helper_ListViewMode_Codification
(new Class_TypeDoc)
->setLabel($this->_('Types de documents'))
->setController('doctype-browser')];
->setController('doctype-browser'),
];
}
......
<?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_Controller_Action_Helper_ListViewMode_Codification_AuthorFunction
extends ZendAfi_Controller_Action_Helper_ListViewMode_Codification_Flat {
public function ListViewMode_Codification_Text($params) {
$this->_initParams($params);
return $this;
}
public function direct($params) {
return $this->ListViewMode_Codification_Text($params);
}
protected function _describeItemsIn($description) {
return $description
->addColumn($this->_('code unimarc'), ['attribute' => 'id_fonction'])
->addColumn($this->_('Libellé'), ['attribute' => 'libelle',
'callback' => function($model, $attrib)
{
return $this->_renderItem($model, $attrib);
}])
->setSorterServer();
}
}
\ No newline at end of file
......@@ -25,7 +25,6 @@ class ZendAfi_Controller_Action_Helper_ListViewMode_Codification_Flat
protected $_model_class;
protected function _initParams($params) {
$this->_params = $params;
$this->_model_class = get_class($this->getModel());
......
<?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_Controller_Plugin_Manager_AuthorFunction
extends ZendAfi_Controller_Plugin_Manager_Manager {
public function getActions($model) {
return $model
? [
['url' => ['module' => 'admin',
'controller' => 'author-function-browser',
'action' => 'edit',
'id' => '%s'],
'icon' => 'edit',
'label' => $this->_('Modifier la fonction auteur')]]
: [];
}
}
\ No newline at end of file
<?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_Controller_Plugin_ResourceDefinition_AuthorFunction extends ZendAfi_Controller_Plugin_ResourceDefinition_Abstract {
public function getDefinitions() {
return
['model' => ['class' => 'Class_CodifAuteurFonction',
'name' => 'author',
'order' => 'libelle'],
'listViewMode' => ['helper_method' => 'ListViewMode_Codification_AuthorFunction',
'label' => $this->_('Fonctions auteurs'),
'controller' => 'author-function-browser'],
'actions' => ['index' => ['title' => $this->_('Parcourir les fonctions auteurs')],
'edit' => ['title' => $this->_("Modifier la fonction auteur")]],
'form_class_name' => 'ZendAfi_Form_Admin_AuthorFunction'];
}
}
\ No newline at end of file
<?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_Admin_AuthorFunction extends ZendAfi_Form {
public function init() {
parent::init();
$this
->addElement('text',
'id_fonction',
['label' => $this->_('Code'),
'required' => true,
'allowEmpty' => false])
->addElement('text',
'libelle',
['label' => $this->_('Libellé'),
'required' => true,
'allowEmpty' => false,
'placeholder' => $this->_('** libellé **')])
->addUniqDisplayGroup('authorfunction');
}
}
......@@ -47,6 +47,7 @@ class CodificationBrowserIndexDispatchTest extends Admin_AbstractControllerTestC
['doctype-browser', 'Types de documents'],
['pcdm4-browser', 'PCDM4'],
['dewey-browser', 'Dewey'],
['author-function-browser', 'Fonctions auteurs'],
['interest-browser', 'Centres d\'intérêts'],
['library-browser', 'Bibliothèques']];
}
......@@ -57,7 +58,7 @@ class CodificationBrowserIndexDispatchTest extends Admin_AbstractControllerTestC
* @dataProvider datas
*/
public function categoriesShouldBeInTable($controller, $label) {
$this->assertXPathContentContains('//td//a[@href="/admin/' . $controller . '"]', $label);
$this->assertXPathContentContains('//td//a[@href="/admin/' . $controller . '"]', $label, $this->_response->getBody());
}
......@@ -114,6 +115,43 @@ class CodificationBrowserAuthorSimpleIndexTest extends CodificationBrowserSimple
class CodificationBrowserAuthorFunctionSimpleIndexTest extends AbstractControllerTestCase {
protected
$_storm_default_to_volatile = true,
$_controller = 'author-function-browser',
$_model = 'Class_CodifAuteurFonction';
public function setUp() {
parent::setUp();
Class_AdminVar::set('CODIFICATION_BROWSER', 1);
$this->fixture('Class_CodifAuteurFonction', ['id' => '330',
'libelle' => 'Auteur douteux']);
}
/** @test */
public function itemShouldBeInTable() {
$this->dispatch('/admin/' . $this->_controller, true);
$this->assertXPathContentContains('//td', 'Auteur douteux', $this->_response->getBody());
}
/** @test */
public function editCodifShouldDisplayForm() {
$this->dispatch('/admin/author-function-browser/edit/id/330', true);
xdebug_break();
$this->assertXPathContentContains('//td', 'Auteur douteux', $this->_response->getBody());
}
}
class CodificationBrowserThesauriSimpleIndexTest extends CodificationBrowserSimpleIndexTestCase {
protected
$_controller = 'thesauri',
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment