If you want to have WYSIWYG editors in CATADS 1.4 you need to modify the following files:
- xoopsversion.php
- ../language/english/modinfo.php
- ../include/functions.php
- ../include/form1_ads.inc.php
xoopseditor.phpFind the following code and add the blue code:
// Photo max width
$modversion['config'][] = array(
'name' =>'photo_maxwidth',
'title' =>'_MI_CATADS_MAXWIDTHIMG',
'description' => '',
'formtype' => 'textbox',
'valuetype' => 'int',
'default' => '240',
'options' => array()
) ;
[color=0000CC]// Form editor selection
$modversion['config'][] = array(
'name' => 'form_options',
'title' => '_MI_CATADS_EDITOR',
'description' => '_MI_CATADS_EDITORDESCR',
'formtype' => 'select',
'valuetype' => 'text',
'default' => 'dhtml',
'options' => array( _MI_CATADS_FORM_DHTML => 'dhtml',
_MI_CATADS_FORM_COMPACT => 'textarea',
_MI_CATADS_FORM_SPAW => 'spaw',
_MI_CATADS_FORM_HTMLAREA => 'htmlarea',
_MI_CATADS_FORM_KOIVI => 'koivi',
_MI_CATADS_FORM_FCK => 'fck',
_MI_CATADS_FORM_INBETWEEN => 'inbetween',
_MI_CATADS_FORM_TINYEDITOR => 'tinyeditor'
)
);[/color]
// Comments
The above will add an extra option to the preferences of CATADS where you can select your prefered editor (default=DHTML).
../include/modinfo.phpAdd the blue code at the end of the script before ?>
[color=0000CC]// Form editor selection
define('_MI_CATADS_EDITOR', "Select form editor:");
define('_MI_CATADS_EDITORDESCR', "Select the editor to use. If you have a 'simple' install (e.g you use only XOOPS core editor class, provided in the standard XOOPS core package), then you can just select DHTML and Compact");
define("_MI_CATADS_FORM_DHTML","DHTML");
define("_MI_CATADS_FORM_COMPACT","Compact");
define("_MI_CATADS_FORM_SPAW","Spaw Editor");
define("_MI_CATADS_FORM_HTMLAREA","HtmlArea Editor");
define("_MI_CATADS_FORM_FCK","FCK Editor");
define("_MI_CATADS_FORM_KOIVI","Koivi Editor");
define("_MI_CATADS_FORM_INBETWEEN","Inbetween Editor");
define("_MI_CATADS_FORM_TINYEDITOR","TinyEditor");[/color]
?>
../include/functions.phpAdd the following blue code at the end of the script before ?>
[color=0000CC]function &catads_getWysiwygForm($caption, $name, $value = "", $width = '100%', $height = '400px', $supplemental='')
{
global $xoopsModuleConfig;
$editor = false;
$x22=false;
$xv=str_replace('XOOPS ','',XOOPS_VERSION);
if(substr($xv,2,1)=='2') {
$x22=true;
}
$editor_configs=array();
$editor_configs["name"] =$name;
$editor_configs["value"] = $value;
$editor_configs["rows"] = 35;
$editor_configs["cols"] = 60;
$editor_configs["width"] = "100%";
$editor_configs["height"] = "400px";
switch(strtolower($xoopsModuleConfig['form_options'])){
case "spaw":
if(!$x22) {
if (is_readable(XOOPS_ROOT_PATH . "/class/spaw/formspaw.php")) {
include_once(XOOPS_ROOT_PATH . "/class/spaw/formspaw.php");
$editor = new XoopsFormSpaw($caption, $name, $value);
}
} else {
$editor = new XoopsFormEditor($caption, "spaw", $editor_configs);
}
break;
case "fck":
if(!$x22) {
if ( is_readable(XOOPS_ROOT_PATH . "/class/fckeditor/formfckeditor.php")) {
include_once(XOOPS_ROOT_PATH . "/class/fckeditor/formfckeditor.php");
$editor = new XoopsFormFckeditor($caption, $name, $value);
}
} else {
$editor = new XoopsFormEditor($caption, "fckeditor", $editor_configs);
}
break;
case "htmlarea":
if(!$x22) {
if ( is_readable(XOOPS_ROOT_PATH . "/class/htmlarea/formhtmlarea.php")) {
include_once(XOOPS_ROOT_PATH . "/class/htmlarea/formhtmlarea.php");
$editor = new XoopsFormHtmlarea($caption, $name, $value);
}
} else {
$editor = new XoopsFormEditor($caption, "htmlarea", $editor_configs);
}
break;
case "dhtml":
if(!$x22) {
$editor = new XoopsFormDhtmlTextArea($caption, $name, $value, 10, 50, $supplemental);
} else {
$editor = new XoopsFormEditor($caption, "dhtmltextarea", $editor_configs);
}
break;
case "textarea":
$editor = new XoopsFormTextArea($caption, $name, $value);
break;
case "koivi":
if(!$x22) {
if ( is_readable(XOOPS_ROOT_PATH . "/class/xoopseditor/wysiwyg/formwysiwygtextarea.php")) {
include_once(XOOPS_ROOT_PATH . "/class/xoopseditor/wysiwyg/formwysiwygtextarea.php");
$editor = new XoopsFormWysiwygTextArea($caption, $name, $value, '100%', '400px', '');
}
} else {
$editor = new XoopsFormEditor($caption, "koivi", $editor_configs);
}
break;
case "tinyeditor":
if(!$x22) {
if ( is_readable(XOOPS_ROOT_PATH . "/class/xoopseditor/tinyeditor/formtinyeditortextarea.php")) {
include_once(XOOPS_ROOT_PATH . "/class/xoopseditor/tinyeditor/formtinyeditortextarea.php");
$editor = new XoopsFormTinyeditorTextArea(array($caption, $name, $value, '100%', '400px'));
}
} else {
$editor = new XoopsFormEditor($caption, "tinyeditor", $editor_configs);
}
break;
}
return $editor;
}[/color]
?>
../include/form1_ads.inc.phpFind the following piece of code:
if ($xoopsModuleConfig['bbcode'] == 1) {
$text_annonce = new XoopsFormDhtmlTextArea(_MD_CATADS_TEXTE_S.'*', "ads_desc", $ads_desc);
} else {
$text_annonce = new XoopsFormTextArea(_MD_CATADS_TEXTE_S.'*', "ads_desc", $ads_desc);
}
$adsform->addElement($text_annonce, true);
This code has to be commented out with slashes or it has to be deleted.
Then add the following piece of blue script before or after the above:
[color=0000CC] $editor=catads_getWysiwygForm( MD_CATADS_TEXTE_S, 'ads_desc', $ads_desc, 15, 60, '');
$adsform->addElement($editor,false);[/color]
You have to repeat the last step also for the files:
- form2_ads.inc.php
- form3_ads.inc.php
Sorry for having my blue moment...