While I was surfing in the help section I see a request for richtext and with link, so I try to make it compatible with the CNR
I think the editor of cnr is really good for me but not for users ..
Here is » the example
I just remember it's the old editor that cutenews using it ..
Anyway, to use this you'll need some configuring in the files. I couldn't make it a plugin it's a little hard to me
Edited Files and additional files:
RTE
- skins/rte
--- skins/rte/images
--- blank.htm
--- insert_table.htm
--- multi.htm
--- palette.htm
--- richtext.js
--- rte.css
I edited in richtext.js file and added a nice expaning and contracting tool
and removed some unused buttons
Improved skin for admin panel compatible with rte
- skins/default_2.skin.php
- skins/default_2.css
Installing:
1. upload (rte & default_2.css & default_2.skin.php) to skins folder.
2. change style to default_2 from System settings » Skin.
3. Make a cope of your files (addnews.mdu and editnews.mdu) from directory inc/mod for more safer.
4. Move and Replace (addnews.mdu and editnews.mdu) to directory inc/mod folder.
5. Edit functions.inc.php and add in last of the file before (?>) this code:
////////////////////////////////////////////////////////
// Function: rteSafe
// Description: safe data for the RTE
function rteSafe($strText) {
//returns safe code for preloading in the RTE
$tmpString = $strText;
//convert all types of single quotes
$tmpString = str_replace(chr(145), chr(39), $tmpString);
$tmpString = str_replace(chr(146), chr(39), $tmpString);
$tmpString = str_replace("'", "'", $tmpString);
//convert all types of double quotes
$tmpString = str_replace(chr(147), chr(34), $tmpString);
$tmpString = str_replace(chr(148), chr(34), $tmpString);
// $tmpString = str_replace("\"", """, $tmpString); // we are pasting the content within '' quotes so " are valid
//replace carriage returns & line feeds
$tmpString = str_replace(chr(10), " ", $tmpString);
$tmpString = str_replace(chr(13), " ", $tmpString);
return $tmpString;
}
6. if you want to use and insert smilies ..
Edit functions.inc.php and search for:
- Code: Select all
$output .= '<a href="javascript:insertext(\':'.trim($smile).':\', \'\', \''.$insert_location.'\')"><img style="border: none;" alt="'.trim($smile).'" src="'.$config_http_script_dir.'/data/emoticons/'.trim($smile).'.gif" /></a>';
replace it with:
- Code: Select all
$output .= '<a href="#" onclick="document.getElementById(\''.$insert_location.'_story\').contentWindow.document.execCommand(\'InsertImage\', false, \''.$config_http_script_dir.'/data/emoticons/'.trim($smile).'.gif\'); return false;"><img style="border: none;" alt="'.trim($smile).'" src="'.$config_http_script_dir.'/data/emoticons/'.trim($smile).'.gif" /></a>';
7. You can browse your image and insert it, but you need to edit in images.mdu file
search for:
- Code: Select all
function insertimage(text){
text = ' ' + text + ' ';
opener.document.forms['addnews'].<?=$area; ?>_story.focus();
opener.document.forms['addnews'].<?=$area; ?>_story.value += text;
opener.document.forms['addnews'].<?=$area; ?>_story.focus();
}
replace it with:
- Code: Select all
function insertimage(selectedImage) {
var html = selectedImage;
window.opener.insertHTML(html);
window.close();
}
and search for every:
- Code: Select all
{imagepath}/'.($user ? $user.'/' : '')
replace all with:
- Code: Select all
'.$config_path_image_upload.'/'
8. Enjoy !
** Big note: These modifications are for changing the default editor to this one **
Best Regards,
AlEloo

