FCKEditor + AjaxFileManager

Default file browser embedded with FCKEditor is very light.

I prefer AjaxFileManager, a rich browser / uploader / manager for your files, most intuitive.

But, in order to include it with your FCKEditor installation, you need to tweak some files.

When following directives here, step by step : http://www.phpletter.com/Our-Projects/Fckeditor-Ajax-File-Manager-Project/ , you will have to :

  • put  all the “ajaxfilemanager” directory in “filemanager/browser” directory of fckeditor
  • edit fckconfig.js to get something like that :
    • FCKConfig.LinkBrowser = true ;
      //FCKConfig.LinkBrowserURL = FCKConfig.BasePath + ‘filemanager/browser/default/browser.html?Connector=’ + encodeURIComponent( FCKConfig.BasePath + ‘filemanager/connectors/’ + _FileBrowserLanguage + ‘/connector.’ + _FileBrowserExtension ) ;
      //FCKConfig.LinkBrowserWindowWidth    = FCKConfig.ScreenWidth * 0.7 ;        // 70%
      //FCKConfig.LinkBrowserWindowHeight    = FCKConfig.ScreenHeight * 0.7 ;    // 70%
      FCKConfig.LinkBrowserURL = FCKConfig.BasePath + ‘filemanager/browser/ajaxfilemanager/ajaxfilemanager.php’ ;
      FCKConfig.LinkBrowserWindowWidth    = 782 ;
      FCKConfig.LinkBrowserWindowHeight    = 440 ;FCKConfig.ImageBrowser = true ;
      //FCKConfig.ImageBrowserURL = FCKConfig.BasePath + ‘filemanager/browser/default/browser.html?Type=Image&Connector=’ + encodeURIComponent( FCKConfig.BasePath + ‘filemanager/connectors/’ + _FileBrowserLanguage + ‘/connector.’ + _FileBrowserExtension ) ;
      //FCKConfig.ImageBrowserWindowWidth  = FCKConfig.ScreenWidth * 0.7 ;    // 70% ;
      //FCKConfig.ImageBrowserWindowHeight = FCKConfig.ScreenHeight * 0.7 ;    // 70% ;
      FCKConfig.ImageBrowserURL = FCKConfig.BasePath + ‘filemanager/browser/ajaxfilemanager/ajaxfilemanager.php’ ;
      FCKConfig.ImageBrowserWindowWidth  = 782 ;
      FCKConfig.ImageBrowserWindowHeight = 440 ;

      FCKConfig.FlashBrowser = true ;
      //FCKConfig.FlashBrowserURL = FCKConfig.BasePath + ‘filemanager/browser/default/browser.html?Type=Flash&Connector=’ + encodeURIComponent( FCKConfig.BasePath + ‘filemanager/connectors/’ + _FileBrowserLanguage + ‘/connector.’ + _FileBrowserExtension ) ;
      //FCKConfig.FlashBrowserWindowWidth  = FCKConfig.ScreenWidth * 0.7 ;    //70% ;
      //FCKConfig.FlashBrowserWindowHeight = FCKConfig.ScreenHeight * 0.7 ;    //70% ;
      FCKConfig.FlashBrowserURL = FCKConfig.BasePath + ‘filemanager/browser/ajaxfilemanager/ajaxfilemanager.php’ ;
      FCKConfig.FlashBrowserWindowWidth  = 782 ;
      FCKConfig.FlashBrowserWindowHeight = 440 ;

      //FCKConfig.LinkUpload = true ;
      FCKConfig.LinkUpload = false ;
      FCKConfig.LinkUploadURL = FCKConfig.BasePath + ‘filemanager/connectors/’ + _QuickUploadLanguage + ‘/upload.’ + _QuickUploadExtension ;
      FCKConfig.LinkUploadAllowedExtensions    = “.(7z|aiff|asf|avi|bmp|csv|doc|fla|flv|gif|gz|gzip|jpeg|jpg|mid|mov|mp3|mp4|mpc|mpeg|mpg|ods|odt|pdf|png|ppt|pxd|qt|ram|rar|rm|rmi|rmvb|rtf|sdc|sitd|swf|sxc|sxw|tar|tgz|tif|tiff|txt|vsd|wav|wma|wmv|xls|xml|zip)$” ;            // empty for all
      FCKConfig.LinkUploadDeniedExtensions    = “” ;    // empty for no one

      //FCKConfig.ImageUpload = true ;
      FCKConfig.ImageUpload = false ;
      FCKConfig.ImageUploadURL = FCKConfig.BasePath + ‘filemanager/connectors/’ + _QuickUploadLanguage + ‘/upload.’ + _QuickUploadExtension + ‘?Type=Image’ ;
      FCKConfig.ImageUploadAllowedExtensions    = “.(jpg|gif|jpeg|png|bmp)$” ;        // empty for all
      FCKConfig.ImageUploadDeniedExtensions    = “” ;                            // empty for no one

      //FCKConfig.FlashUpload = true ;
      FCKConfig.FlashUpload = false ;
      FCKConfig.FlashUploadURL = FCKConfig.BasePath + ‘filemanager/connectors/’ + _QuickUploadLanguage + ‘/upload.’ + _QuickUploadExtension + ‘?Type=Flash’ ;
      FCKConfig.FlashUploadAllowedExtensions    = “.(swf|flv)$” ;        // empty for all
      FCKConfig.FlashUploadDeniedExtensions    = “” ;

  • edit ‘config.base.php’ in ajaxfilemanager/inc directory and change these lines :
    • define(‘CONFIG_SYS_DEFAULT_PATH’, ‘../../../../../../uploads/images/fckeditor/’); //accept relative path only
      define(‘CONFIG_SYS_ROOT_PATH’, ‘../../../../../../uploads/images/fckeditor/’);    //accept relative path only
    • //define(‘CONFIG_EDITOR_NAME’, (CONFIG_QUERY_STRING_ENABLE && !empty($_GET[‘editor’])?secureFileName($_GET[‘editor’]):’stand_alone’));
      define(‘CONFIG_EDITOR_NAME’, (CONFIG_QUERY_STRING_ENABLE && !empty($_GET[‘editor’])?secureFileName($_GET[‘editor’]):’fckeditor’));
  • patch ajaxfilemanager/jscripts/for_fckeditor.js with this new function (comment original ‘selectFile’ function) :
    • function selectFile(absoluteurl)
      {
      //var relative=absoluteurl.split(document.domain);
      var relative = absoluteurl.split(‘/uploads/’);
      var url =  ‘/uploads/’ + relative[1];if (url != ”)
      {
      window.opener.SetUrl(url) ;
      window.close() ;
      }else
      {
      alert(noFileSelected);
      }
      }

Hope this helps !

Leave a Reply

Your email address will not be published. Required fields are marked *