Hi all
I want to
arrange my folders and images files in FCKeditor MCPuck in alphabetical order.
[ I mean when I tried to insert images to WYSIWYG editor, I click on ’Insert/Edit images’ button , then ’Insert/Edit images’ window appeared. I click on browse to select my image. Then the fckeditor window appeared. It displays all my folders and images in its create/modify order.]
I want to get these folders in ascending (alphabetical) order.Because my images folder contains a lot of folders and images.
I posted this issue in forum and as per the suggestions got, I add "sort($files);" at approx. line 91 in Getfolderandfiles.php located in Manager/media/browser/mcpuk/connectors/php/Commands/ and got the image files sorted.
For sorting folders they suggest add "sort($folders);" at approx. line 60 in Getfolders.php But it doesnot work for me.
Below is my Getfolders.php code for your Ref:
<?php
class GetFolders {
var $fckphp_config;
var $type;
var $cwd;
var $actual_cwd;
function GetFolders($fckphp_config,$type,$cwd) {
$this->fckphp_config=$fckphp_config;
$this->type=$type;
$this->raw_cwd=$cwd;
$this->actual_cwd=str_replace("//","/",($fckphp_config['UserFilesPath']."/$type/".$this->raw_cwd));
$this->real_cwd=str_replace("//","/",($this->fckphp_config['basedir']."/".$this->actual_cwd));
}
function run() {
header ("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
?>
<Connector command="GetFolders" resourceType="<?php echo $this->type; ?>">
<CurrentFolder path="<?php echo $this->raw_cwd; ?>" url="<?php echo $this->actual_cwd; ?>" />
<Folders>
<?php
if ($dh=opendir($this->real_cwd)) {
while (($filename=readdir($dh))!==false) {
if (($filename!=".")&&($filename!="..")) {
if (is_dir($this->real_cwd."/$filename")) {
//check if$fckphp_configured not to show this folder
$hide=false;
for($i=0;$i<sizeof($this->fckphp_config['ResourceAreas'][$this->type]['HideFolders']);$i++)
$hide=(ereg($this->fckphp_config['ResourceAreas'][$this->type]['HideFolders'][$i],$filename)?true:$hide);
if (!$hide) echo "<Folder name=\"$filename\" />\n";
}
}
}
closedir($dh);
}
-----------------------------------------------as per forum people suggested here I add
sort($folders);
foreach($folders as $k=>$v) {
echo "<Folder name=\"$v\" />\n";
}
-----------------------------------------------
?>
</Folders>
</Connector>
<?php
}
}
?>
How can I solve this problem ? Please help me.
Admin note: This is actually a problem with MCPuck file browser, not FCK Editor and also is present with Tiny MCE. Clarification noted above.
thanks & regards
Jurdy