[原创]让FCKeditor的File manager支持”删除” (php)
FCKeditor是一款很好用的所见即所得编辑器, 内置的File manager也实现了基本的文件管理功能, 唯一遗憾的是, 不支持删除…
没关系, 其实只需以下几步就可以实现删除文件和文件夹:
1, fckeditor\editor\filemanager\browser\default\frmresourceslist.html, 编辑:
PHP code1 2 3 4 5 6 7 8 | <!--Code highlighting produced by Actipro CodeHighlighter (freeware)http:
<td nowrap colspan= "2" > ' +sLink +folderName +' ' +' </td>
<td align= "right" width= "45" >- <a href= "#" onclick= "DeleteFolder(\''+folderName+'\',\''+ folderUrl.replace( /'/g, '\\\'') + '\');return false;" > Delete </a>
</td> ' ;}<br>2, fckeditor\editor\filemanager\browser\default\frmresourceslist.html, 编辑:<br><dl class="code">PHP code<pre class="brush:php;toolbar:false"><!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize ){// Build the link to view the folder.var sLink = ' <a href= "#" onclick= "OpenFile(\'' + ProtectPath( fileUrl ) + '\');return false;" >' ;// Get the file icon. var sIcon = oIcons.GetIcon( fileName ) ; return '<tr>' + '<td width="16">' +sLink + '<img alt="" src="images/icons/' %20+%20sIcon%20+%20 '.gif" style="max-width:90%" style="max-width:90%" border="0">' +'</td>
<td> ' +sLink +fileName +' ' +' </td>
<td align= "right" nowrap> ' +fileSize +' KB ' +' </td>
<td align= "right" width= "45" >- <a href= "#" onclick= "DeleteFile(\''+fileName+'\',\'' + fileUrl.replace( /'/g, '\\\'') + '\');return false;" > Delete </a>
</td> ' ;}<br>3, fckeditor\editor\filemanager\browser\default\frmresourceslist.html, 增加:<br><dl class="code">PHP code<pre class="brush:php;toolbar:false"><!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->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, 编辑:
PHP code1 | <!--Code highlighting produced by Actipro CodeHighlighter (freeware)http:
|
ログイン後にコピー
5, fckeditor\editor\filemanager\connectors\php\commands.php, 添加:
PHP code1 2 3 4 5 6 | <!--Code highlighting produced by Actipro CodeHighlighter (freeware)http:
</div></error></error>
|
ログイン後にコピー