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

dev #118011 : remove flash from ckeditor

parent 4f932a30
Branches
Tags
1 merge request!3650dev #118011 : remove flash from ckeditor
Pipeline #11149 failed with stage
in 48 minutes and 58 seconds
- ticket #118011 : Éditeur HTML : suppression du bouton "flash" suite à l'abandon de cette technologie
\ No newline at end of file
......@@ -21,8 +21,7 @@
include_once(CKBASEPATH . "ckeditor.php");
class ZendAfi_View_Helper_CkEditor extends ZendAfi_View_Helper_BaseHelper
{
class ZendAfi_View_Helper_CkEditor extends ZendAfi_View_Helper_BaseHelper {
/*
* @param $initial Initial content for the editor
*/
......@@ -42,17 +41,10 @@ class ZendAfi_View_Helper_CkEditor extends ZendAfi_View_Helper_BaseHelper
http_build_query(['full_screen' => 1,
'browser' => 'userfiles/image',
'selectable_extensions' => Class_AdminVar::getSelectableExtensions()]);
$config['filebrowserFlashBrowseUrl'] = $this->view->url(['module' => 'admin',
'controller' => 'file-manager'], null, true) .
'?' .
http_build_query(['full_screen' => 1,
'browser' => 'userfiles/flash',
'selectable_extensions' => 'swf']);
}
$config['filebrowserUploadUrl'] = CKBASEURL."filemanager/upload/php/upload.php?ServerPath=".USERFILESURL;
$config['filebrowserImageUploadUrl'] = CKBASEURL."filemanager/upload/php/upload.php?Type=Image&ServerPath=".USERFILESURL;
$config['filebrowserFlashUploadUrl'] = CKBASEURL."filemanager/upload/php/upload.php?Type=Flash&ServerPath=".USERFILESURL;
$config['imagesPath'] = URL_ADMIN_IMG."ckeditor_templates/";
$config['templates_files'] = [URL_ADMIN_JS."ckeditor_templates.js"];
$config['contentsCss'] = [BASE_URL . '/public/opac/css/global.css',
......@@ -66,7 +58,7 @@ class ZendAfi_View_Helper_CkEditor extends ZendAfi_View_Helper_BaseHelper
'/',
['HorizontalRule'],
['Link','Unlink','Anchor'],
['Image','Flash','Table','Iframe','oembed','Slideshow', 'SpecialChar','Kiosk'],
['Image','Table','Iframe','oembed','Slideshow', 'SpecialChar','Kiosk'],
];
$config['extraAllowedContent'] = [
......@@ -116,6 +108,7 @@ class ZendAfi_View_Helper_CkEditor extends ZendAfi_View_Helper_BaseHelper
$oCKeditor = new CKeditor(CKBASEURL);
$oCKeditor->returnOutput = true;
return $oCKeditor->editor($editorId, $initial, $config);
}
}
......@@ -22,155 +22,149 @@ require_once 'ViewHelperTestCase.php';
require_once 'ZendAfi/View/Helper/CkEditor.php';
class CkEditorWithFormulaireEnabledTest extends ViewHelperTestCase {
abstract class CkEditorTestCase extends ViewHelperTestCase {
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
$this->_helper = new ZendAfi_View_Helper_CkEditor();
$this->_helper->setView($this->view);
if (!defined('URL_CSS'))
define('URL_CSS','');
Class_AdminVar::newInstanceWithId('CMS_FORMULAIRES')->setValeur(1);
$this->_html=$this->_helper->ckeditor('','','');
}
}
/** @test **/
public function cmsFormulaireOptionEnabledShouldDisplayFormulaire() {
$this->assertContains('HiddenField',$this->_html);
}
class CkEditorWithFormulaireEnabledTest extends CkEditorTestCase {
/** @test **/
public function pageShouldContainsFormConfiguration() {
Class_AdminVar::newInstanceWithId('CMS_FORMULAIRES')->setValeur(1);
$this->_html = $this->_helper->ckeditor('', '', false);
$this->assertContains('HiddenField', $this->_html);
}
}
class CkEditorWithFormulaireDisabledTest extends ViewHelperTestCase {
public function setUp() {
parent::setUp();
$this->_helper = new ZendAfi_View_Helper_CkEditor();
$this->_helper->setView(new ZendAfi_Controller_Action_Helper_View());
if (!defined('URL_CSS'))
define('URL_CSS','');
class CkEditorWithFormulaireDisabledTest extends CkEditorTestCase {
/** @test **/
public function pageShouldNotContainsFormCongiguration() {
Class_AdminVar::newInstanceWithId('CMS_FORMULAIRES')->setValeur(0);
$this->_html=$this->_helper->ckeditor('','','');
$this->_html = $this->_helper->ckeditor('', '', false);
$this->assertNotContains('HiddenField', $this->_html);
}
}
/** @test **/
public function cmsFormulaireOptionDisabledShouldNotDisplayFormulaire() {
$this->assertNotContains('HiddenField',$this->_html);
}
}
class CkEditorViewHelperTest extends ViewHelperTestCase {
class CkEditorViewHelperTest extends CkEditorTestCase {
public function setUp() {
parent::setUp();
$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('','','');
$this->_html = $this->_helper->ckeditor('', '', false);
}
/** @test */
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);
public function stylesAttributeShouldBeAllowed() {
$this->assertContains('"*":{"attributes":"id","styles":"*"}', $this->_html);
}
/** @test */
public function editorShouldNotAllowedContentForSimpleUser() {
$this->assertNotContains('"allowedContent":true',$this->_html);
public function editorShouldNotAllowContent() {
$this->assertNotContains('"allowedContent":true', $this->_html);
}
/** @test */
public function editorShouldAddParagraphTagsForSimpleUser() {
$this->assertNotContains('"autoParagraph":false',$this->_html);
public function editorShouldAddParagraphTags() {
$this->assertNotContains('"autoParagraph":false', $this->_html);
}
}
}
class CkEditorAdminViewHelperTest extends ViewHelperTestCase {
abstract class CkEditorAdminTestCase extends CkEditorTestCase {
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,
'date_maj' => '',
'user_groups' => [Class_UserGroup::find(22)]]);
$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,
'date_maj' => '',
'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('','','');
class CkEditorAdminWithoutFileBrowserTest extends CkEditorAdminTestCase {
public function setUp() {
parent::setUp();
$this->_html = $this->_helper->ckeditor('', '', false);
}
/** @test */
public function editorShouldAllowedContentForModoUser() {
$this->assertContains('"allowedContent":true',$this->_html);
public function shouldAllowContent() {
$this->assertContains('"allowedContent":true', $this->_html);
}
/** @test */
public function editorShouldNotAddParagraphTags() {
$this->assertContains('"autoParagraph":false',$this->_html);
$this->assertContains('"autoParagraph":false', $this->_html);
}
}
class CkeditorWithShowFileBrowserTest extends ViewHelperTestCase {
class CkEditorAdminWithFileBrowserTest extends CkEditorAdminTestCase {
public function setUp() {
parent::setUp();
$this->_html = $this->_helper->ckeditor('', '');
}
$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',
'date_maj' => '',
'password' => 'toto',
'role_level' => ZendAfi_Acl_AdminControllerRoles::MODO_BIB,
'user_groups' => [Class_UserGroup::find(22)]]);
ZendAfi_Auth::getInstance()->logUser($this->_admin_bib);
/** @test */
public function editorConfigShouldContainsSelectableExtensions() {
$this->assertContains('/file-manager?full_screen=1&browser=userfiles%2Ffile&selectable_extensions=svg%3Bgif%3Bjpg%3Bjpeg%3Bpng%3Bgeojson%3Bpdf%3Bcss%3Bmp3%3Bmp4%3Bogg%3Bm4v%3Bico%3Bepub',
$this->_html);
}
$this->_helper = new ZendAfi_View_Helper_CkEditor();
$this->_helper->setView($this->view);
if (!defined('URL_CSS'))
define('URL_CSS','');
/** @test */
public function shouldNotContainsSwfFileExtension() {
$this->assertNotContains('swf', $this->_html);
}
$this->_html = $this->_helper->ckeditor('','', true);
/** @test */
public function shouldNotContainsUrlWithTypeFlash() {
$this->assertNotContains('upload.php?Type=Flash', $this->_html);
}
/** @test */
public function editorConfigShouldContainsSelectableExtensions() {
$this->assertContains('/file-manager?full_screen=1&browser=userfiles%2Ffile&selectable_extensions=svg%3Bgif%3Bjpg%3Bjpeg%3Bpng%3Bgeojson%3Bpdf%3Bcss%3Bmp3%3Bmp4%3Bogg%3Bm4v%3Bico%3Bepub', $this->_html);
public function shouldNotContainsFlashButton() {
$this->assertNotContains('"Flash",', $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