[Original] How can I deal with FCKeditor's Filemanager support "delete" (php )?

Source: Internet
Author: User
[Original] let FCKeditor's Filemanager support "delete" (php) FCKeditor is a very useful WYSIWYG editor. the built-in Filemanager also implements basic file management functions, the only pity is that deletion is not supported... It doesn't matter. In fact, you can delete files and folders in the following steps: 1. fcked [original] allows FCKeditor's File manager to support "delete" (php)
FCKeditor is a good WYSIWYG editor. the built-in File manager also implements the basic File management function. The only pity is that it does not support deletion...

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

1. fckeditor \ editor \ filemanager \ browser \ default \ frmresourceslist.html. edit:
PHP code
  oListManager.GetFolderRowHtml = function( folderName, folderPath, folderUrl ){// Build the link to view the folder.var sLink = '' ;return '' +'' +sLink +'<\/a>' +'<\/td> ' +sLink +folderName +'<\/a>' +'<\/td>- Delete<\/tr>' ;}

2. fckeditor \ editor \ filemanager \ browser \ default \ frmresourceslist.html. edit:
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. Add: fckeditor \ editor \ filemanager \ browser \ default \ frmresourceslist.html:
PHP code
  function DeleteFile( fileName, fileUrl ){if (confirm('Are you sure you wish to delete ' + fileName + '?')) {oConnector.SendCommand( 'DeleteFile', "FileUrl=" + escape( fileUrl ), Refresh ) ;}}function DeleteFolder( folderName, folderPath ){if (confirm('Are you sure you wish to delete \'' + folderName + '\' and all files in it?')) {oConnector.SendCommand( 'DeleteFolder', "FolderName=" + escape( folderPath + folderName ), Refresh ) ;}}

4. fckeditor \ editor \ filemanager \ browser \ default \ frmresourceslist.html. edit:
PHP code
  oHtml.Append( oListManager.GetFolderRowHtml( sFolderName, sCurrentFolderPath + sFolderName + "/", sCurrentFolderUrl ) ) ;



5. add fckeditor \ editor \ filemanager \ connectors \ php \ commands. php:
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($dirname))$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.