The work needs the FCK Editor's server browsing adds the picture deletion function, we use the Ajax PHP realization the need friend to be possible to refer to under.
Locate the frmresourceslist.html file in the Fckeditoreditorfilemanagerbrowserdefault folder and modify the code as follows
Olistmanager.getfilerowhtml found here, the following code replaces the original code
Copy Code code as follows:
olistmanager.getfilerowhtml = function (FileName, FILEURL, fileSize) {
Build the link to view the folder.
var slink = ' <a href= ' # "mce_href=" # "onclick=" OpenFile (' + protectpath (FILEURL) + '); return false; " > Selection </a> ';
Get the file icon.
var Sicon = Oicons.geticon (fileName);
Return ' <div class= "piclist" ><p> ' + slink + ' <a href= ' # "mce_href=" # "onclick=" DeleteFile (' + protectpath (FILEURL) + '); "St yle= "COLOR: #FF9933;" mce_style= "color: #FF9933;" > Delete </a></p></div> '
}
In the Add a
<script type= "Text/javascript" src= "/js/ajaxdel.js" ></script>
Ajaxdel.js file
Copy Code code as follows:
Picture deletion feature ******************************************
var req; Defines variables that are used to create XMLHttpRequest objects
Produces a random number that is not repeated
var rn = Math.ceil (Math.random () * 1000000);
var rnch = RN;
function Rndnum () {
while (rn = = rnch) rn = Math.ceil (Math.random () * 1000000);
Rnch = RN;
return RN;
}
Delete file, Ajax start
function DeleteFile (file) {
var url = "/ajaxpic.php?filepath=" + escape (file) + "&ud=" + rndnum (); Service-side address to request
if (window. XMLHttpRequest)//non IE browser and IE7 (version 7.0 and above), created with XMLHttpRequest object
{
req = new XMLHttpRequest ();
}
else if (window. ActiveXObject)//ie (version 6.0 and below) browsers are created with ActiveXObject objects and may fail if the user's browser disables ActiveX.
{
req = new ActiveXObject ("Microsoft.XMLHTTP");
}
if (req)///successfully created XMLHttpRequest
{
Req.open ("Get", url, True); Establish a connection to the server (Request mode post or get, address, true to indicate asynchronous)
Req.onreadystatechange = callback; Specifying callback Functions
Req.send (NULL); Send Request
}
}
function callback () {
if (Req.responsetext ==1)
{
Alert (' Delete successful! ');
Refresh ();
}
Else
{
Alert (' Delete failed! ');
}//, refresh yourself.
}
ajaxpic.php file saved as ajaxpic.php
Copy Code code as follows:
?
$root = DirName (__file__);
$filePath = isset ($_get[' FilePath '])? $_get[' FilePath ']: ';
if (unlink ($root. $filePath))
{
echo ' 1 ';
}
Else
{
echo ' 0 ';
}
?>