1
gooloomoo
How to use different editor in a module?
  • 2006/7/13 18:44

  • gooloomoo

  • Not too shy to talk

  • Posts: 110

  • Since: 2006/6/27


For example, I wanna use WYSIWYG editor within the module catads. Becuase the bbcode in that module doesn't work.

Thanks for your help.

2
McDonald
Re: How to use different editor in a module?
  • 2006/7/13 19:52

  • McDonald

  • Home away from home

  • Posts: 1072

  • Since: 2005/8/15


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.php
Find 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.php
Add 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.php
Add 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$value1050$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.php
Find 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_annoncetrue);


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_getWysiwygFormMD_CATADS_TEXTE_S'ads_desc'$ads_desc1560'');
        
$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...

3
panigrc
Re: How to use different editor in a module?
  • 2006/7/13 20:18

  • panigrc

  • Not too shy to talk

  • Posts: 133

  • Since: 2005/4/14


There is an alternative. Its a little off topic but I thought that I can help with my reply.

There is an firefox extention called Xinha and is an wysiwyg editor but loads on the client machine and not from server. So its much quicker to load and has many functions

Try It !! You 'll not regret it
[size=xx-small]X-Park Greek Pc Modding Community
Official Greek Support at XoopsGreece.gr[/size]

4
McDonald
Re: How to use different editor in a module?
  • 2006/7/13 20:48

  • McDonald

  • Home away from home

  • Posts: 1072

  • Since: 2005/8/15


Maybe Xinha is an easy solution, but not everyone likes FireFox (I prefer Maxthon).

If you're using tinyeditor 1.0 beta you will have the advantage of having the possibility to setup toolbars per user-group. It also has the option to add plugins.
I don't know when tinyeditor 1.0 final will be available, but the beta (with some patches) works pretty well. I use it on my production site already.

5
gooloomoo
Re: How to use different editor in a module?
  • 2006/7/14 16:10

  • gooloomoo

  • Not too shy to talk

  • Posts: 110

  • Since: 2006/6/27


I really appreciate your help.

McDonald, I think you missed the case 'inbetween' in functions.php ?

btw, which editor you think is easier to use, faster and more stable than others? I don't need too many functions right now. I just want a easy and fast one.

Thanks

6
Gr1ff1N
Re: How to use different editor in a module?
  • 2006/8/2 2:15

  • Gr1ff1N

  • Just popping in

  • Posts: 2

  • Since: 2006/6/18


i have XOOPS 2.0.14 up and running on a xamp 1.5.3a. I want to make fckeditor default in all modules.
how do i do this?

by the way
i searched for xoopsversion.php and the closest thing i had was xoops_version.php
then i searched for xoopseditor.php
and found nothing like
Quote:

// Photo max width
$modversion['config'][] = array(
'name' =>'photo_maxwidth',
'title' =>'_MI_CATADS_MAXWIDTHIMG',
'description' => '',
'formtype' => 'textbox',
'valuetype' => 'int',
'default' => '240',
'options' => array()
) ;

so i could not edit anything.
Any hints?

Login

Who's Online

256 user(s) are online (93 user(s) are browsing Support Forums)


Members: 0


Guests: 256


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits