1
tempo
WYSIWYG @ catads module
  • 2004/11/26 22:45

  • tempo

  • Just popping in

  • Posts: 96

  • Since: 2003/11/12


Hallo my friends,
i'm trying to setup my new site and i want to use catads module.
i want to ask if it is possible to use a WYSIWYG editor on this module. all i want is the way that the user can submit his/her ad using a WYSIWYG editor and not the XOOPS's editor.

is it possible?

thanks for the support.
greeting from Greece

2
adium
Re: WYSIWYG @ catads module
  • 2009/7/31 15:51

  • adium

  • Just popping in

  • Posts: 99

  • Since: 2005/1/18


Wow..., I have this same issue and this is in the latest 5 search results?

Any chance someone out there has a fix on this yet and I'm just not seeing it?

3
frankblack
Re: WYSIWYG @ catads module
  • 2009/7/31 16:15

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Of course it is possible. You can turn any dhtml-textarea into WYSIWYG. In fact it is not so hard to realize. I post here a few lines of code. Of course you have to adapt it to catads. It's not too complicated.

Step 1: Edit xoops_version.php. Look where $modversion['config'] is located. I don't know if an array for config is used (like my example) or it is numbered.
$modversion['config'][] = array(
        
'name' => 'use_wysiwyg',
        
'title' => '_MI_DEBASER_FORM_OPTIONS',
        
'description' => '',
        
'formtype' => 'select',
        
'valuetype' => 'text',
        
'default' => 'textarea',
        
'options' => array( 'Plain Editor' => 'textarea''XoopsEditor' => 'dhtmltextarea''TinyMCE' => 'tinymce''FCK Editor' => 'FCKeditor''Koivi Editor' => 'koivi''Spaw' => 'spaw''TinyEditor' => 'tinyeditor' ));


Step 2: catads has a functions.php? If not, create it and insert the following code
function &get_wysiwygcatads($caption$name$value ''$width '100%'$height '400px'$supplemental='')
{
    global 
$xoopsModuleConfig$xoopsConfig;
    
$editor false;

    
$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(
$xoopsModuleConfig['use_wysiwyg']) {
        case 
'spaw':
                if (
is_readable(XOOPS_ROOT_PATH '/class/xoopseditor/spaw/formspaw.php'))    {
                    include_once(
XOOPS_ROOT_PATH '/class/xoopseditor/spaw/formspaw.php');
                    
$editor = new XoopsFormSpaw($caption$name$value);
                }
            break;

        case 
'FCKeditor':
                if ( 
is_readable(XOOPS_ROOT_PATH '/class/xoopseditor/fckeditor/formfckeditor.php'))    {
                    include_once(
XOOPS_ROOT_PATH '/class/xoopseditor/fckeditor/formfckeditor.php');
                    
$editor = new XoopsFormFckeditor($caption$name$value);
                }
            break;

        case 
'htmlarea':
                if ( 
is_readable(XOOPS_ROOT_PATH '/class/xoopseditor/htmlarea/formhtmlarea.php'))    {
                    include_once(
XOOPS_ROOT_PATH '/class/xoopseditor/htmlarea/formhtmlarea.php');
                    
$editor = new XoopsFormHtmlarea($caption$name$value);
                }
            break;

        case 
'dhtmltextarea':
                
$editor = new XoopsFormDhtmlTextArea($caption$name$value1050$supplemental);
            break;

        case 
'textarea':
            
$editor = new XoopsFormTextArea($caption$name$value);
            break;

        case 
'tinyeditor':
            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'=> $caption'name'=>$name'value'=>$value'width'=>'100%''height'=>'400px'));
            }
            break;

        case 
'tinymce':
            if ( 
is_readable(XOOPS_ROOT_PATH.'/class/xoopseditor/tinymce/formtinymce.php')) {
                include_once 
XOOPS_ROOT_PATH.'/class/xoopseditor/tinymce/formtinymce.php';
                
$editor = new XoopsFormTinymce(array('caption'=> $caption'name'=>$name'value'=>$value'width'=>'100%''height'=>'400px'));
            }
            break;

        case 
'koivi':
                if ( 
is_readable(XOOPS_ROOT_PATH '/class/xoopseditor/koivi/formkoivi.php')) {
                    include_once(
XOOPS_ROOT_PATH '/class/xoopseditor/koivi/formkoivi.php');
                    
$editor = new XoopsFormKoivi($caption$name$value'100%''450px''');
                }
            break;
        }
        return 
$editor;
}


Step 3: locate any place in catads where XoopsFormDhtmlTextArea occurs. Could look like this:
$pmform->addElement(new XoopsFormDhtmlTextArea('''message'$message837), true);

and replace it with:
$pmform->addElement(get_wysiwygcatads('''message'$message1560), true);


Make sure, that the functions.php is included and adapt the variables and formelement names.

Step 4: Update the module, go to preferences and pick up the editor of your choice.

good luck

oops: forgot something. You also have to locate the places where the output is rendered, normally this done with displayTarea. Have a look at this function and change the code according in catads.

I added some extra code to the header.php for my module to make it easier to change the settings for displayTarea automatically depending on the selected editor:
$wysiwyg_editor = array('tinymce''tinyeditor''koivi''FCKeditor''spaw');

    if (!
in_array($xoopsModuleConfig['use_wysiwyg'], $wysiwyg_editor)) {
        
$html 0;
        
$dobr 1;
    } else {
        
$html 1;
        
$dobr 0;
    }

4
adium
Re: WYSIWYG @ catads module
  • 2009/8/1 3:16

  • adium

  • Just popping in

  • Posts: 99

  • Since: 2005/1/18


Awesome! Thanks!!!!

Login

Who's Online

130 user(s) are online (86 user(s) are browsing Support Forums)


Members: 0


Guests: 130


more...

Donat-O-Meter

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

Latest GitHub Commits