1
Watdehek
TinyEditor and WFChannel
  • 2006/9/8 9:43

  • Watdehek

  • Friend of XOOPS

  • Posts: 130

  • Since: 2005/2/21


Can anyone tell me how I can make TinyEditor the default editor for WfChannel?

The examples in the manual for TinyEditor don't compare to the WfChannel files.

2
McDonald
Re: TinyEditor and WFChannel
  • 2006/9/8 11:57

  • McDonald

  • Home away from home

  • Posts: 1072

  • Since: 2005/8/15


Hello Watdehek,

I will check over the weekend how to make tinyeditor working with WF Channel.
Maybe WF Channel can be hacked that way it can use the wysiwyg editor of your choice.
My idea is to replace the setting 'Use Spaw Editor Y/N' in the preferences by a dropdown menu from which you can choose your favorite editor.

Regards, McDonald

3
McDonald
Re: TinyEditor and WFChannel
  • 2006/9/8 18:05

  • McDonald

  • Home away from home

  • Posts: 1072

  • Since: 2005/8/15


Here is the necessary information to make WF-Channel 1.07 wysiwyg compatible.
The following files have to be modified:
1. xoops_version.php
2. languages/english/modinfo.php
3. include/functions.php
4. admin/index.php

For WF-Channel I have tested this for DHTML Editor and TinyEditor only. I use the same hack for my own WF-Links module and from that experience I can tell it works with Koivi also.


1. XOOPS_VERSION.PHP
Find the following lines of code and comment these lines out:
$modversion['config'][10]['name'] = 'usespaw';
$modversion['config'][10]['title'] = '_MI_CHAN_USESPAW';
$modversion['config'][10]['description'] = '';
$modversion['config'][10]['formtype'] = 'yesno';
$modversion['config'][10]['valuetype'] = 'int';
$modversion['config'][10]['default'] = 0;


Under these lines the following code has to be inserted:
$modversion['config'][10]['name'] = 'form_options';
$modversion['config'][10]['title'] = '_MI_CHAN_EDITOR';
$modversion['config'][10]['description'] = '_MI_CHAN_EDITORCHOICE';
$modversion['config'][10]['formtype'] = 'select';
$modversion['config'][10]['valuetype'] = 'text';
$modversion['config'][10]['default'] = 'dhtml';
$modversion['config'][10]['options'] =  array(
                        
_MI_CHAN_FORM_DHTML => 'dhtml',
                        
_MI_CHAN_FORM_COMPACT => 'textarea',
                        
_MI_CHAN_FORM_SPAW => 'spaw',
                        
_MI_CHAN_FORM_HTMLAREA => 'htmlarea',
                        
_MI_CHAN_FORM_KOIVI => 'koivi',
                        
_MI_CHAN_FORM_FCK => 'fck',
                        
_MI_CHAN_FORM_INBETWEEN => 'inbetween',
                        
_MI_CHAN_FORM_TINYEDITOR => 'tinyeditor'
                        
);



2. LANGUAGES/ENGLISH/MODINFO.PHP
Insert the following lines at the end of the file, but before ?> :
define('_MI_CHAN_EDITOR'"Editor to use:");
define('_MI_CHAN_EDITORCHOICE'"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_CHAN_FORM_DHTML","DHTML");
define("_MI_CHAN_FORM_COMPACT","Compact");
define("_MI_CHAN_FORM_SPAW","Spaw Editor");
define("_MI_CHAN_FORM_HTMLAREA","HtmlArea Editor");
define("_MI_CHAN_FORM_FCK","FCK Editor");
define("_MI_CHAN_FORM_KOIVI","Koivi Editor");
define("_MI_CHAN_FORM_INBETWEEN","Inbetween");
define("_MI_CHAN_FORM_TINYEDITOR","TinyEditor");



3. INCLUDE/FUNCTIONS.PHP
Insert the following lines at the end of the file, but before ?> ,
/**
 * Retreive an editor according to the module's option "form_options"
 */
function &wfc_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;
}


Please check all paths in the lines above for matching your XOOPS website!!


4. ADMIN/INDEX.PHP
Find the following lines and comment these out (Create Page):
if (!$xoopsModuleConfig['usespaw'] || !strstr($_SERVER["HTTP_USER_AGENT"], "MSIE"))
    {
        
$sform->addElement(new XoopsFormDhtmlTextArea(_AM_CHANA _AM_WORDCOUNT $total_words'page'$page1560), false);
    }
    else
    {
        
ob_start();
        
$sw = new SPAW_Wysiwyg('page'$page'en''full''default''99%''600px');
        
$sw->show();
        
$sform->addElement(new XoopsFormLabel(_AM_CHANA _AM_WORDCOUNT $total_words ob_get_contents(), 1));
        
ob_end_clean();
    }


Insert the following 2 lines under the lines that you just commented out:
$editor=wfc_getWysiwygForm(_AM_CHANA _AM_WORDCOUNT $total_words'page'$page1560'');
    
$sform->addElement($editor,true);


Find the following lines and comment these out (Link Page Settings:
if (!$xoopsModuleConfig['usespaw'] || !strstr($_SERVER["HTTP_USER_AGENT"], "MSIE"))
        {
            
$sform->addElement(new XoopsFormDhtmlTextArea(_AM_CHANA'linkintro'$linkintro1560), false);
        }
        else
        {
            
ob_start();
            
$sw = new SPAW_Wysiwyg('linkintro'$linkintro'en''full''default''99%''600px');
            
$sw->show();
            
$sform->addElement(new XoopsFormLabel(_AM_CREFERINTRO ob_get_contents(), 1));
            
ob_end_clean();
        }


Insert the following 2 lines under the lines that you just commented out:
$editor=wfc_getWysiwygForm(_AM_CHANA'linkintro'$linkintro1560'');
        
$sform->addElement($editor,true);


Find the following lines and comment these out (Refer Page Settings):
if (!$xoopsModuleConfig['usespaw'] || !strstr($_SERVER["HTTP_USER_AGENT"], "MSIE"))
        {
            
$sform->addElement(new XoopsFormDhtmlTextArea(_AM_CHANA'chanrefheadline'$chanrefheadline1560), false);
        }
        else
        {
            
ob_start();
            
$sw = new SPAW_Wysiwyg('chanrefheadline'$chanrefheadline'en''full''default''99%''600px');
            
$sw->show();
            
$sform->addElement(new XoopsFormLabel(_AM_CREFERINTRO ob_get_contents(), 1));
            
ob_end_clean();
        }


Insert the following 2 lines under the lines that you just commented out:
$editor=wfc_getWysiwygForm(_AM_CREFERINTRO'chanrefheadline'$chanrefheadline1560'');
        
$sform->addElement($editor,true);


At beginning of admin/index.php are some lines for Spaw editor that probably can be comment out also, but I have not checked this.


Good luck!

Login

Who's Online

165 user(s) are online (116 user(s) are browsing Support Forums)


Members: 0


Guests: 165


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