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

Merge branch 'dev#23904_ckeditor_deactivate_html_filter' into 'master'

Dev#23904 ckeditor deactivate html filter

See merge request !825
parents f306b2fc 61da0a56
Branches
Tags
1 merge request!896Master
- ticket #23904 : Le filtrage du contenu dans ckeditor est désactivé pour les administrateurs
......@@ -47,7 +47,6 @@ CKEDITOR.editorConfig = function( config )
config.templates_replaceContent = false;
config.bodyClass = 'boiteMilieu ckeditor_content';
// Toolbar par défaut:
// config.toolbar_Full =
//[
......
......@@ -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
*/
include_once(CKBASEPATH . "ckeditor.php");
......@@ -73,6 +73,10 @@ class ZendAfi_View_Helper_CkEditor extends ZendAfi_View_Helper_BaseHelper
'styles' => '*'
]
];
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'];
......@@ -86,7 +90,7 @@ class ZendAfi_View_Helper_CkEditor extends ZendAfi_View_Helper_BaseHelper
$config['extraPlugins'] = 'colordialog';
$oCKeditor = new CKeditor(CKBASEURL);
$oCKeditor->returnOutput = true;
return $oCKeditor->editor($editorId, $initial, $config);
......
......@@ -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