Skip to content
Snippets Groups Projects
Commit da6c2ca5 authored by efalcy's avatar efalcy
Browse files

dev #23904 : Ckeditor allowedContent=true and autoparagraph=false for administrators

parent 0aa56d2a
Branches
Tags
3 merge requests!896Master,!825Dev#23904 ckeditor deactivate html filter,!815Dev#23904 ckeditor deactivate html filter
......@@ -73,8 +73,10 @@ class ZendAfi_View_Helper_CkEditor extends ZendAfi_View_Helper_BaseHelper
'styles' => '*'
]
];
if (($user = Class_Users::getIdentity()) ? $user->isBibliothecaire():false)
if (($user = Class_Users::getIdentity()) ? $user->isBibliothecaire():false) {
$config['allowedContent']=true;
$config['autoParagraph'] = false;
}
if (Class_AdminVar::isCmsFormulairesEnabled()) {
$config['toolbar'][]=['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'];
......
......@@ -80,4 +80,56 @@ class CkEditorViewHelperTest extends ViewHelperTestCase {
public function cmsFormulaireShouldAllowStyleAttribute() {
$this->assertContains('"extraAllowedContent":{"audio video":{"attributes":"*"},"source":{"attributes":["src","type"]},"map":{"attributes":"name"},"area":{"attributes":["shape","coords","href","alt"]},"span":{"classes":"*"},"*":{"attributes":"id","styles":"*"}}', $this->_html);
}
/** @test */
public function editorShouldNotAllowedContentForSimpleUser() {
$this->assertNotContains('"allowedContent":true',$this->_html);
}
/** @test */
public function editorShouldAddParagraphTagsForSimpleUser() {
$this->assertNotContains('"autoParagraph":false',$this->_html);
}
}
class CkEditorAdminViewHelperTest extends ViewHelperTestCase {
public function setUp() {
parent::setUp();
$annecy = $this->fixture('Class_Bib',['id' => 1,
'id_zone' => 4,
'libelle' => 'Annecy'
]);
$this->_admin_bib = $this->fixture('Class_Users',['id' => 10,
'login' => 'AdminBibConnected',
'bib' => $annecy,
'role' => 'admin_bib',
'mail' => 'admin@afi-sa.fr',
'password' => 'toto',
'role_level' => ZendAfi_Acl_AdminControllerRoles::MODO_BIB,
'user_groups' => [Class_UserGroup::find(22)]]);
ZendAfi_Auth::getInstance()->logUser($this->_admin_bib);
$this->_helper = new ZendAfi_View_Helper_CkEditor();
$this->_helper->setView(new ZendAfi_Controller_Action_Helper_View());
if (!defined('URL_CSS'))
define('URL_CSS','');
$this->_html=$this->_helper->ckeditor('','','');
}
/** @test */
public function editorShouldAllowedContentForModoUser() {
$this->assertContains('"allowedContent":true',$this->_html);
}
/** @test */
public function editorShouldNotAddParagraphTags() {
$this->assertContains('"autoParagraph":false',$this->_html);
}
}
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