FCKeditor

From Dokeos

Jump to: navigation, search

FCKEditor is a WYSIWYG editor, which is used many times in Dokeos. I will only speak about its integration with FormValidator (for further informations, see [[1]]).

Use the FCKeditor

There are 2 ways to add the FCKEditor with FormValidator :

1/
$form = new FormValidator('form_name');
$form->addElement('html_editor', 'field_name', get_lang('label'));
2/
$form = new FormValidator('form_name');
$form->add_html_editor(get_lang('label'),"field_name", $required);


FCKEditor customization :

We can customize FCKeditor (height, width) by using the array $fck_attribute. Example :

$fck_attribute['Width'] = '100%';
$fck_attribute['Height'] = '400';

By default, the default toolbar is in the file : /main/inc/lib/fckeditor/fckconfig.js. We can customize it by creating a new one in the file /main/inc/lib/fckeditor/myconfig.js. There are already many examples of custom toolbars in this file so I won't explain the way to make a new toolbar. When the new toolbar is created, we use it with the fck_attribute array :

$fck_attribute['ToolbarSet'] = 'custom_toolbar_name';

The newly created toolbar could be not considered because of a cache problem. With Firefox, it's sometimes very hard to make appear a new toolbar.

If you use $fck_attribute array inside a function for example, don't forget to add this line :

global $fck_attribute;

Image Manager, Flash and mp3 upload :

For the moment, 3 types of media can be uploaded : pictures, flash and audio. . When a teacher uploads a document (flash, image or mp3), the uploaded file is stored in the course documents folder according to the file type. So there are 3 folders : images, flash, audio.

Ex for flash file : courses_folder/current_course_folder/document/flash/uploaded_file


If a student is able to access the page, we must add 3 variables in the fck_attribute array because the upload path is not the same as teachers. During the course creation, 3 folders are automatically added : forum, blog and test. For the moment, it's the 3 Dokeos tools where a student is allowed to access and upload documents.

$fck_attribute['Config']['IMUploadPath'] = 'upload/tool_name/';
$fck_attribute['Config']['FlashUploadPath'] = 'upload/tool_name/';
$fck_attribute['Config']['UserStatus'] = 'student';
Personal tools