[Original] Let FCKeditor's file Manager support "delete" (PHP), how to handle

Source: Internet
Author: User
[Original] Let FCKeditor's file Manager support "delete" (PHP)
FCKeditor is a very useful WYSIWYG editor, the built-in File Manager also implements the basic document management functions, the only regret is that the deletion is not supported ...

It doesn't matter, in fact, you can delete files and folders in just the following steps:

1, fckeditor\editor\filemanager\browser\default\frmresourceslist.html, editor:
PHP Code
  
   olistmanager.getfolderrowhtml = function (FolderName, FolderPath, FolderUrl) {//Build the link to view the Folder.var sLi NK = '; return ' + ' +slink + ' <\/a> ' + ' <\/td> ' +slink +foldername + ' <\/a> ' + ' <\/td>-delete< \/tr> ';}

2, fckeditor\editor\filemanager\browser\default\frmresourceslist.html, editor:
PHP Code
  
   olistmanager.getfilerowhtml = function (FileName, FILEURL, fileSize) {//Build the link to view the Folder.var slink = ' ;//Get the file Icon.var Sicon = Oicons.geticon (fileName); return ' + ' +slink + ' <\/a> ' + ' <\/td> ' +slink +filename + ' <\/a> ' + ' <\/td> ' +filesize + ' KB ' + ' <\/td>-delete<\/tr> ';}

3, fckeditor\editor\filemanager\browser\default\frmresourceslist.html, added:
PHP Code
  
   function DeleteFile (filename, fileUrl) {if (Confirm (' is sure you wish to delete ' + FileName + '? ')) {Oconnector.sendcommand (' DeleteFile ', "fileurl=" + Escape (FILEURL), Refresh);}} function DeleteFolder (folderName, FolderPath) {if (Confirm (' is ' sure you wish to delete \ ' + folderName + ' \ ' and Al l files in it? ')) {Oconnector.sendcommand (' DeleteFolder ', "foldername=" + Escape (FolderPath + FolderName), Refresh);}}

4, fckeditor\editor\filemanager\browser\default\frmresourceslist.html, editor:
PHP Code
  
   Ohtml.append (olistmanager.getfolderrowhtml (sfoldername, Scurrentfolderpath + sfoldername + "/", SCURRENTFOLDERURL));



5, fckeditor\editor\filemanager\connectors\php\commands.php, add:
PHP Code
  function DeleteFile ($resourceType, $currentFolder) {$file = $_server[' document_root '].$_get[' FileUrl '];if (Is_file ($ File) {unlink ($file);} else {echo '
  
   
    ";}} function DeleteFolder ($resourceType, $currentFolder) {$folder = $_server[' document_root '].$_get[' FolderName '];if (IS _dir ($folder)) {delete_recursive_dirs ($folder);} else {echo ' 
    
     ";}} function Delete_recursive_dirs ($dirname) {//RECURSIVE function to delete//all subdirectories and Contents:if (Is_dir ($d irname)) $dir _handle=opendir ($dirname), while ($file =readdir ($dir _handle)) {if ($file! = "." && $file! = "...") {if (!is_dir ($dirname. ") /". $file)" {unlink ($dirname. ") /". $file);} else {delete_recursive_dirs ($dirname. ") /". $file);}}} 
  Closedir ($dir _handle); rmdir ($dirname);} 
     
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.