Monday, April 26, 2010

FCK editor ийг symfony дээр тохируулах

FCKeditor ийг symfony 1.0 дээр тохируулах тухай нэг бичлэг оруулъя.
1. FCKeditor -ийг татаж авна. http://ckeditor.com/blog/FCKeditor_2.6.6_released
2. Symfony -ийн /web/js/ директор дотор задална.
3. symfony дотор //config/settings.yml файлыг ямар нэг эдитор програмаар нээж дараахь өөрчлөлтийг хийнэ.
.settings:
rich_text_fck_js_dir: js/fckeditor
4. /web/js/fckeditor/fckconfig.js javascript файлыг нээж edit хийнэ.

var _FileBrowserLanguage = 'php' ; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = 'php' ; // asp | aspx | cfm | lasso | php

5. Дараа нь /web/js/fckeditor/editor/filemanager/connectors/php/config.php файл дотор
$Config['Enabled'] = true;
$Config['UserFilesPath'] = '/userfiles/' ;
/эдгээр нь 28-32 р мөрөнд байгаа байх/
тохиргоог хийж өөрийн upload хийх директорыг тохируулна. Сонгосон директорынхоо permission -ийг 777 болгохоо мартав даа.

6. Эцэст нь template хэсэг дээр ашиглахдаа
$options = array(
'rich' => 'fck',
'height' => 500,
'width' => 500,
);
echo textarea_tag('inputname', 'text', $options );

-----------------------------------------------------
Нэмэлт мэдээлэл:
'''Custom settings recommandation'''

'''FCKeditor 2.5.x Resources Browser configuration'''

The Resources Browser of FCKeditor 2.5 is in the normal configuration not working. Take the following steps to solve this problem:

1. Make the following changes in the config.php (web/js/fckeditor/editor/filemanager/connectors/php):

// Old code: $Config['Enabled'] = false ;
$Config['Enabled'] = true ;

// Old code: $Config['UserFilesPath'] = '/userfiles/' ;
$Config['UserFilesPath'] = DIRECTORY_SEPARATOR . 'userfiles' . DIRECTORY_SEPARATOR ;

// Old code: $Config['UserFilesAbsolutePath'] = '' ;
$Config['UserFilesAbsolutePath'] = $_SERVER[DOCUMENT_ROOT] . $Config['UserFilesPath'] ;

// Old code: $Config['QuickUploadPath']['File'] = $Config['UserFilesPath'] ;
// Old code: $Config['QuickUploadAbsolutePath']['File']= $Config['UserFilesAbsolutePath'] ;
$Config['QuickUploadPath']['File'] = $Config['FileTypesPath']['File'] ;
$Config['QuickUploadAbsolutePath']['File'] = $Config['FileTypesAbsolutePath']['File'] ;

// Old code: $Config['QuickUploadPath']['Image'] = $Config['UserFilesPath'] ;
// Old code: $Config['QuickUploadAbsolutePath']['Image']= $Config['UserFilesAbsolutePath'] ;
$Config['QuickUploadPath']['Image'] = $Config['FileTypesPath']['Image'] ;
$Config['QuickUploadAbsolutePath']['Image'] = $Config['FileTypesAbsolutePath']['Image'] ;

// Old code: $Config['QuickUploadPath']['Flash'] = $Config['UserFilesPath'] ;
// Old code: $Config['QuickUploadAbsolutePath']['Flash']= $Config['UserFilesAbsolutePath'] ;
$Config['QuickUploadPath']['Flash'] = $Config['FileTypesPath']['Flash'] ;
$Config['QuickUploadAbsolutePath']['Flash'] = $Config['FileTypesAbsolutePath']['Flash'] ;

// Old code: $Config['QuickUploadPath']['Media'] = $Config['UserFilesPath'] ;
// Old code: $Config['QuickUploadAbsolutePath']['Media']= $Config['UserFilesAbsolutePath'] ;
$Config['QuickUploadPath']['Media'] = $Config['FileTypesPath']['Media'] ;
$Config['QuickUploadAbsolutePath']['Media'] = $Config['FileTypesAbsolutePath']['Media'] ;

2. An extra addition that should be made to the file is the insertion of security logic around the statement

$Config['Enabled'] = true ;

to ensure that only authenticated users with a certain role are able to upload etc.

3. Additional steps needed:
a. create directory userfiles in the document-root
b. create sub-directory file in directory userfiles
c. create sub-directory image in directory userfiles
d. create sub-directory flash in directory userfiles
e. create sub-directory media in directory userfiles
f. chmod the directories to 0777
g. optional: chown the directories with an appropriate user and group

3 comments:

Altansuh said...

hi form-in upload deer yaj ajax upload hiihvv. bi form-oo Form.class.php dreesei uusgechihsen. Google-s jishee harahaar dandaa indexSuccess.php huudas deeree "js" bicheed html-n "id" ru hewlesen bh yum.

Altansuh said...
This comment has been removed by the author.
Баатарчулуун said...

Комментыг харсангүй удчихлаа, уучлаарай. ajax upload -ын тухай удахгүй нэг бичлэг оруулъя