1
astuni
help with koivi
  • 2004/10/24 22:30

  • astuni

  • Just popping in

  • Posts: 22

  • Since: 2004/6/7 4


Hello.
I succesfully integrated koivi editor in news module 1.21 as docs says.

Now i wanted to do a step ahead and integrate also in xfsection.

i currently use spaw as editor in xfsection.

here's how i integrated spaw.
/modules/xfsection/class/wfsarticle.php
//html_editor('maintext');
        
$sw = new SPAW_Wysiwyg'maintext'$this->maintext'en''full''default''98%''550px' );
           
$sw -> show();

So i commented out the first line that was present in original file and i added the code lines for spaw.

Now, in koivi docs it use a different method to create the editor instance, so applying those lines into this file wont work.
Anyone can help me out integrating this?

2
samuels
Re:help with koivi
  • 2004/10/25 19:16

  • samuels

  • Quite a regular

  • Posts: 249

  • Since: 2003/10/30


What version of xfsection are you using?

3
astuni
Re:help with koivi
  • 2004/11/3 22:46

  • astuni

  • Just popping in

  • Posts: 22

  • Since: 2004/6/7 4


1.06, upgrading to 1.07 if i get koivi to work with it in both category header and article editing.
Please help me

4
samuels
Re:help with koivi
  • 2004/11/5 13:12

  • samuels

  • Quite a regular

  • Posts: 249

  • Since: 2003/10/30


I have downloaded XFSection 1.07 and it calls a wysiwyg editor buy not spaw.
I'm doing some tests when I finish it I'll tell you

5
astuni
Re:help with koivi
  • 2004/11/6 13:56

  • astuni

  • Just popping in

  • Posts: 22

  • Since: 2004/6/7 4


Ok, thanks.
Here's what i've done to /modules/xfsection/include/storyform.inc.php to use koivi:
after line 34 i added
//KOIVI WYSIWYG CLASS

include XOOPS_ROOT_PATH "/class/wysiwyg/formwysiwygtextarea.php";

then i replaced line 51 with
//Koivi Add
//$sform->addElement(new XoopsFormDhtmlTextArea(_WFS_MAINTEXT, 'message', $message, 15, 60), true);
$sform->addElement(new XoopsFormWysiwygTextArea_WFS_MAINTEXT'message'$message'100%''400px',''), true);

This whas the old one using spaw:
ob_start();
        
$sw = new SPAW_Wysiwyg'message'$message'en''full''default''99%''600px' );
        
$sw -> show();
        
$sform -> addElement( new XoopsFormLabel_WFS_MAINTEXTob_get_contents() ) );
        
ob_end_clean();



Notice that for spaw it uses the ob_start ob_end_clean method.

I need to include koivi in those two files also, and i wasn't able to do it cos the code is slightly different here...
the files are:
/modules/xfsection/class/wfsarticle.php
and
/public_html/modules/xfsection/admin/category.php

For wfsarticle.php i've done those mods to include spaw:
Line 58
after:
include_once XOOPS_ROOT_PATH.'/class/xoopscomments.php';

i added:
$spaw_root XOOPS_ROOT_PATH '/modules/spaw/';
include_once 
$spaw_root 'spaw_control.class.php';


Line 1190-1193
Replace
if (!strstr($HTTP_SERVER_VARS["HTTP_USER_AGENT"], "MSIE")) $wfsConfig['wysiwygeditor'] = '0';

        if (
$wfsConfig['wysiwygeditor'] == '1') {  
        
html_editor('maintext');

with:
// checks browser compatibility with the control
  
function checkBrowser() {
    global 
$HTTP_SERVER_VARS;
    
$browser $HTTP_SERVER_VARS['HTTP_USER_AGENT'];
    
// check if msie
    
if (eregi("MSIE[^;]*",$browser,$msie)) {
      
// get version 
      
if (eregi("[0-9]+.[0-9]+",$msie[0],$version)) {
        
// check version
        
if ((float)$version[0]>=5.5) {
          
// finally check if it's not opera impersonating ie
          
if (!eregi("opera",$browser)) {
            return 
true;
          }
        }
      }
    }
    return 
false;
  }
        if (
checkBrowser()) 
    {
        
$wfsConfig['wysiwygeditor'] = '1';
                        } 
    else
    {
            
$wfsConfig['wysiwygeditor'] = '0';
    }

        if (
$wfsConfig['wysiwygeditor'] == '1') {  
        
//html_editor('maintext');
        
$sw = new SPAW_Wysiwyg'maintext'$this->maintext'en''full''default''98%''550px' );
           
$sw -> show();


Then for category.php
After line 19 i added:
$spaw_root XOOPS_ROOT_PATH '/modules/spaw/';
include_once 
$spaw_root 'spaw_control.class.php';

then i replaced lines 92 with
// checks browser compatibility with the control
  
function checkBrowser() {
    global 
$HTTP_SERVER_VARS;
    
$browser $HTTP_SERVER_VARS['HTTP_USER_AGENT'];
    
// check if msie
    
if (eregi("MSIE[^;]*",$browser,$msie)) {
      
// get version 
      
if (eregi("[0-9]+.[0-9]+",$msie[0],$version)) {
        
// check version
        
if ((float)$version[0]>=5.5) {
          
// finally check if it's not opera impersonating ie
          
if (!eregi("opera",$browser)) {
            return 
true;
          }
        }
      }
    }
    return 
false;
  }
  
  if (
checkBrowser()) {
// use spaw
        
ob_start();
        
$sw = new SPAW_Wysiwyg'catdescription'$xt->catdescription("E"), 'en''full''default''99%''600px' );
        
$sw -> show();
        
$sform -> addElement( new XoopsFormLabel_WFS_CATEGORYHEADob_get_contents() ) );
        
ob_end_clean();
} else {
// do anything else
$sform->addElement(new XoopsFormDhtmlTextArea(_WFS_CATEGORYHEAD'catdescription'$xt->catdescription("E"), 1060), false);

}


so basically im done with storyform.inc.php because was easy (similar code to news module)
but i dont know how to integrate them in the other two files.
Remember that this is xf-section 1.06
dont know if 1.07 files are different, by the way if you make it for 1.07 i will update it

6
dejadingo
Re:help with koivi
  • 2004/11/7 6:59

  • dejadingo

  • Just popping in

  • Posts: 71

  • Since: 2004/10/22


I've been trying to do the same thing with the xt-content module, following the doc instructions and getting a blank form (not a blank page) when the editor is included.

Win2K SP4
Apache 1.3.29
MySQL 4.0.18
PHP 4.3.4

Sorry for the length of this post, but it's the result of some serious debugging. I started putting in echo statements in the code because even with PHP debugging turned on there are no debugging traces, and isolated it to the location in formwysiwygtextarea.php in the render() function where it includes functions.inc.php. I got it to render the editor form by accident and after much experimentation I do not understand what is going on here.

Here's my conversion of xt-content from SPAW to KOIVI -

1) in admin_header.php, after
include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';

I added
// -------------------------------------------------------------------------
// KOIVI WYSIWYG Class
include_once XOOPS_ROOT_PATH.'/class/wysiwyg/formwysiwygtextarea.php';
// -------------------------------------------------------------------------


2) in index.php
for the "submit" case I have
if ($xoopsModuleConfig['xt_wysiwyg'] == '1') {
        echo 
'<br>case[submit] :: xoopsModuleConfig>>xt_wysiwyg [1]';
    
/*
        // SPAW Config
        $spaw_root = XOOPS_ROOT_PATH.'/modules/xt_conteudo/admin/spaw/';
        include $spaw_root.'spaw_control.class.php';
        if (checkBrowser()) {
            ob_start();
            $sw = new SPAW_Wysiwyg('message',$message);
            $sw->show();
            $form->addElement(new XoopsFormLabel(_TC2_CONTENT, ob_get_contents()));
            ob_end_clean();
        } else {
            $t_area = new XoopsFormDhtmlTextArea(_TC2_CONTENT, 'message', '', 37, 35);
            $form->addElement($t_area);
        }
    */
    // ------------------------------------------------------------------------
    // Replace with KOIVI Editor
        
$t_area = new XoopsFormWysiwygTextArea_TC2_CONTENT'message''' '100%''400px''');
        
$t_area->setUrl("/class/wysiwyg");
        
$form->addElement$t_area );
    
// ------------------------------------------------------------------------
    
} else {
        
$t_area = new XoopsFormDhtmlTextArea(_TC2_CONTENT'message'''3735);
        
$form->addElement($t_area);
    }


and for the "edit" case I have
if ($xoopsModuleConfig['xt_wysiwyg'] == '1') {
        echo 
'<br>case[edit] :: xoopsModuleConfig>>xt_wysiwyg [1]';
    
/*
        // SPAW Config
        $spaw_root = XOOPS_ROOT_PATH.'/modules/xt_conteudo/admin/spaw/';
        include $spaw_root.'spaw_control.class.php';
        if (checkBrowser()) {
            ob_start();
            $sw = new SPAW_Wysiwyg('message',$message);
            $sw->show();
            $form->addElement(new XoopsFormLabel(_TC2_CONTENT, ob_get_contents()));
            ob_end_clean();
        } else {
            $t_area = new XoopsFormDhtmlTextArea(_TC2_CONTENT, 'message', $message, 37, 35);
            $form->addElement($t_area);
        }
    */
    // ------------------------------------------------------------------------
    // Replace with KOIVI Editor
        
$t_area = new XoopsFormWysiwygTextArea_TC2_CONTENT'message'$message '100%''400px''');
        
$t_area->setUrl("/class/wysiwyg");
        
$form->addElement$t_area );
    
// ------------------------------------------------------------------------
    
} else {
        
$t_area = new XoopsFormDhtmlTextArea(_TC2_CONTENT'message'$message3735);
        
$form->addElement($t_area);
    }


My debugging version of KOIVI WYSIWYG code contains the following -

In formwysiwygtextarea.php, the beginning of the render() function looks like this:
function render()
    {
        echo 
'<br>XoopsFormWysiwygTextArea>>render()';
        
//include files
        
include_once 'include/functions.inc.php';
        include_once 
getLanguage($this->getUrl());
        global 
$koivi_editor_instances;

        echo 
'<br>koivi_instances:='.$koivi_editor_instances;

       
$width=$this->getWidth();
        
$height=$this->getHeight();


In functions.inc.php, the three functions begin like this:
// URL: http://www.myweb.ne.jp/, https://xoops.org/, http://www.xoopscube.jp/ //
// Project: The XOOPS Project                                                //
// ------------------------------------------------------------------------- //

echo '<br>trace :: 1';

function 
getMainfile($url)
{
    echo 
"<br>getMainfile() :: $url";
    
$mpath='';
    for (
$i=0;$i<strlen($url);$i++)
    {
        if (
$url[$i]=='/')$mpath.='../';
    }
    return 
$mpath.'mainfile.php';
}

echo 
'<br>trace :: 2';

function 
getLanguage($url)
{
    echo 
"<br>getLanguage() :: $url";
    global 
$xoopsConfig;
    if(
file_exists(XOOPS_ROOT_PATH.''.$url.'/language/'.$xoopsConfig['language'].'/lang.php'))
    return 
''.XOOPS_ROOT_PATH.''.$url.'/language/'.$xoopsConfig['language'].'/lang.php';
    else return 
''.XOOPS_ROOT_PATH.''.$url.'/language/english/lang.php';
}

echo 
'<br>trace :: 3';
echo 
'<br>$_SERVER['HTTP_USER_AGENT']';

function 
CheckBrowser($get_isie=true)
{
    echo 
"<br>CheckBrowser() :: $get_isie";
    global 
$_SERVER;

        
$comp=false;
        
$isie=false;


Note particularly the echo traces both inside and between the functions.
Now for the confusing part...

When I change the echo for the User Agent to use double-quotes

echo "<br>$_SERVER[\'HTTP_USER_AGENT\']";

(with or without the escape on the single-quotes) it changes the behavior of the system.

Using a single-quoted string, the output is
--------
case[submit] :: xoopsModuleConfig>>xt_wysiwyg [1]
XoopsFormWysiwygTextArea>>render()
trace :: 1
trace :: 2
trace :: 3
$_SERVER['HTTP_USER_AGENT']
--------
Tracing occurs in the include file, but the editor form does not render.

Using the double-quoted string, the output is
--------
case[submit] :: xoopsModuleConfig>>xt_wysiwyg [1]
XoopsFormWysiwygTextArea>>render()
getLanguage() :: /class/wysiwyg
koivi_instances:=1
--------
No tracing in the include file, but the editor form renders and is functional.

What seems to force the rendering of the editor almost looks like a PHP bug, or perhaps it's actually in the render() function itself, because these statements work

echo '<br>'.$_SERVER[\'HTTP_USER_AGENT\'];
echo "<br>$_SERVER[\'HTTP_USER_AGENT\']";
echo "<br>$_SERVER['HTTP_USER_AGENT']";

but these do not

echo '<br>'.$_SERVER['HTTP_USER_AGENT'];
echo '<br>'.$_SERVER;

So, I can force rendering by putting in a certain kind of server variable evaluation statement after the getLanguage() function, and outside the function boundaries in open PHP code. Putting it any place before that in the file does not work. But this is a serious hack. Does anyone see what is really going on here, and how it should be fixed?

7
samuels
Re:help with koivi
  • 2004/11/7 16:17

  • samuels

  • Quite a regular

  • Posts: 249

  • Since: 2003/10/30


@astuni
I used xf-sections v1.07
I've made the same modifications on storyform.inc.php

File admin/category.php:

On line 40 add koiviswysiwyg class:
include_once XOOPS_ROOT_PATH "/class/wysiwyg/formwysiwygtextarea.php";


On line 99 replace xoopsdhtmlarea
//$sform->addElement(new XoopsFormDhtmlTextArea(_WFS_CATEGORYHEAD, 'catdescription', $xt->catdescription("E"), 10, 60), false);
$sform->addElement(new XoopsFormWysiwygTextArea_WFS_CATEGORYHEAD'catdescription'$xt->catdescription("E"), '100%''400px',''), false);



File class/wfsarticle.php

Comment line 52:
//include_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->dirname().'/include/wysiwygeditor.php';


Comment line 1190:
//if (!strstr($HTTP_SERVER_VARS["HTTP_USER_AGENT"], "MSIE")) $wfsConfig['wysiwygeditor'] = '0';



After line 1192 add the koivi wysiwyg area:
if ($wfsConfig['wysiwygeditor'] == '1') { 
        
        include 
XOOPS_ROOT_PATH "/class/xoopsformloader.php";
        include 
XOOPS_ROOT_PATH "/class/wysiwyg/formwysiwygtextarea.php";
        
        
$wysiwyg_text_area= new XoopsFormWysiwygTextArea''"maintext"$GLOBALS['maintext'], '100%''400px','');
        echo 
$wysiwyg_text_area->render();


Comment the following lines since you arrive to the "}else{" clause.


I have uploaded the modified module here:
http://www.forjandoleyendas.com/public/fl/uploads/descargas/xfsection_koivi.zip

@dejadingo
Whare can I download xt-content? I want to test it.

8
dejadingo
Re:help with koivi
  • 2004/11/8 1:31

  • dejadingo

  • Just popping in

  • Posts: 71

  • Since: 2004/10/22


The xt-conteudo module can be found
here. Sorry, I forgot the module is spelled in Spanish.

It's based on TinyContent, and I'll probably end up cloning it so I can use it in the same way as TinyD.

My requirements are a bit non-standard since my sites are not really information portals. I need to maintain strict control over the site structure and presentation, but allow my site owners (who are very much non-technical) access to their content. There won't be registered users in the normal sense, but site owners will have customized restricted administrative access to the site. Several have MAC computers, and I'm very pleased to be able to use your KOIVI editor. Now if we can only convince Gecko and Safari to implement the missing functionality on their end, my people won't always need to use IE ...

9
astuni
Re:help with koivi
  • 2004/11/8 13:26

  • astuni

  • Just popping in

  • Posts: 22

  • Since: 2004/6/7 4


@ samuels

Great!
This is wonderful, i don't know how to thank you.
Testing it now

10
astuni
Re:help with koivi
  • 2004/11/8 22:55

  • astuni

  • Just popping in

  • Posts: 22

  • Since: 2004/6/7 4


ok everything works.
Except for the image manager. i select an image and i push one of the three alignment buttons but nothing happens it just closes and it wont show any image...

also, i noticed that the title of the box now is not showing. i noticed this also in news 1.21, so i dont see anymore The Scoop, The News and Category Header strings on the left of the editor... there is any solution?

Login

Who's Online

206 user(s) are online (121 user(s) are browsing Support Forums)


Members: 0


Guests: 206


more...

Donat-O-Meter

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

Latest GitHub Commits