듀라가 쓸만한 에디터를 찾아보는중 FCK를 알게되었습니다...
작년인가... ASP버전을 보고 호~좋구나 이랬는데...

들리는 소문에 의하면 속도가 많이 안나온다고 하네요...

이번에 이거 한번 세팅해볼까 하면서 찾아본 자료입니다.


1.  파일 다운로드

    http://www.fckeditor.net/download  에서 FCKeditor 2.3b 파일 받고,

    C:\Inetpub\wwwroot\test\FCKeditor 에 압축 풀었음.


    FCKeditor.net 다운받아서 Release\FredCK.FCKeditorV2.dll 파일은 test\bin 에 넣음

    \_samples\aspx 폴더를 test\FCKeditor\_samples\ 아래로 잘라 붙여넣음


2. 웹사이트 생성 
   IIS에서 test 폴더를 application으로 만들고, Visual Studio 2003에서 test 프로젝트 생성

   test\bin\FredCK.FCKeditorV2.dll 참조 추가


3. 샘플 실행

http://localhost/test/FCKeditor/_samples/aspx/sample01.aspx

2.2 버전과 다른 점: _whatsnew.html 파일 볼 것. 플러그인 FitWindow 버튼이 자체 포함되었다.


----------------------------------------------------------------------------------------




4. 이미지 업로드 기능



테스트: 위의 aspx 테스트 페이지에서 툴바 -> 이미지 버튼 클릭 -> 서버보기
XML 500 에러 나는 경우는 웹폴더의 퍼미션을 조정하면 된다.


4.1)  FCKeditor는 aspx 페이지 안에 포함될 것이지만, 업로드 기능은 그냥 asp로 둬도 무방.

        aspx 업로드 코드는 dll 안에.


  FCKeditor\fckconfig.js 파일에서 아래 부분을 default인 asp 그대로 두면 됨

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



4.2)  2개의 파일에서 변수값을 아래와 같이 수정, 업로드 기능을 활성화 시킴

test\FCKeditor\editor\filemanager\browser\default\connectors\asp\config.asp

test\FCKeditor\editor\filemanager\upload\asp\config.asp 

' SECURITY: You must explicitelly enable this
Dim ConfigIsEnabled
ConfigIsEnabled = True   'False에서 True로 바꿈

 

' Path to user files relative to the document root.
Dim ConfigUserFilesPath
ConfigUserFilesPath = "/test/Data/"    '파일을 업로드 할 폴더 설정


 

4.3)  이미지 업로더에서 'Create New Folder' 버튼을 없애고 싶어서

test\FCKeditor\editor\filemanager\browser\default\browser.html 파일 열고 <frameset cols="150 ,*,0" ....> 부분에서 150을 0으로 바꿔서 있어도 없는 듯 처리 --;

명확히 하려면 frmcreatefolder.html 파일의 window.top.IsLoadedCreateFolder 값을 false로 변경.

 

 

4.4)  업로드한 이미지 경로를 절대경로로 표시

이미지 업로드 해보면 <img src='/설정경로/이미지이름'> 이런 식의 상대 주소가 들어감.

html 편집 후 메일로 보내거나 하면 링크가 깨지기 때문에.. 절대경로를 읽어오고자 함.


test\FCKeditor\editor\filemanager\browser\default\frmresourceslist.html 파일의 자바스크립트 함수를 원하는대로 수정하면 됨.

function OpenFile( fileUrl )
{
        //이미지 상대링크를 웹 절대 경로로 바꿈

        //현재 페이지 전체 주소에서 도메인 주소만 가져오기
        var tmpStr = document.location.href.toString() ;

        var fullUrl = tmpStr.substring(0, tmpStr.indexOf("/")+2) ;  //  http://에
        tmpStr = tmpStr.substring(tmpStr.indexOf("/")+2, tmpStr.length) ;
        fullUrl += tmpStr.substring(0, tmpStr.indexOf("/")) ;  //  도메인주소 더하고
        fullUrl += fileUrl;  // 파일 경로 더하고

       

        window.top.opener.SetUrl( fullUrl ) ;
        window.top.close() ;
        window.top.opener.focus() ;
}



4.5)  한글 파일 이름이 깨지는 문제

초간단.. test\FCKeditor\editor\filemanager\browser\default\frmupload.html

<head> 바로 밑에 인코딩 메타태그만 넣어주면 된다. 이름에 공백 들어간 파일도 업로드 잘 됨.

<html xmlns=http://www.w3.org/1999/xhtml">
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <link href="browser.css" type="text/css" rel="stylesheet" />
  <script type="text/javascript" src="js/common.js"></script>
  <script type="text/javascript">





.... 또 뭐 수정했더라. 생각 더 나면 추가를.. --;

+ Recent posts