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

  • dejadingo

  • Just popping in

  • Posts: 67

  • 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?



62
dejadingo
Re:Suggestions and pointers please
  • 2004/10/23 3:50

  • dejadingo

  • Just popping in

  • Posts: 67

  • Since: 2004/10/22


Quote:

For information about module development, I recommend hopping over to the XoopsForge (dev.xoops.org) site. There is a strong development community at this site, as well as module development resources.

Thanks.
Looks like the No-Ah stuff might be exactly what I need.



63
dejadingo
Re: Suggestions and pointers please
  • 2004/10/22 14:19

  • dejadingo

  • Just popping in

  • Posts: 67

  • Since: 2004/10/22


Can't seem to edit my own post, but I've answered my own question #4.
[interesting ... I can edit this one (same session?) but not the original]
Thanks.



64
dejadingo
Suggestions and pointers please
  • 2004/10/22 4:25

  • dejadingo

  • Just popping in

  • Posts: 67

  • Since: 2004/10/22


I've been researching XOOPS for several weeks now, and I have to say I haven't been this excited about something since I started using Smalltalk. I think I've learned enough to start asking some questions.

First, my reasons for wanting to use XOOPS are perhaps a little different. I manage the sites for some non-profit orgs I belong to, and I need to allow some absolute non-techies to edit their own content while maintaining strict control over the structure and the graphical presentation of the site.

Now the questions:

1) Can someone please discuss the intersection of templates and blocks?

I totally get the OO stuff, and the difference between templates and themes is clear, but is there some non-trivial usage of templates I can look at to understand when I should build a template and when I should build a block? For example, I have one page that I need to convert, which has some static text at the top and then what should be converted to a table built from database entries. So is that a block or a template and a block, or what?

2) Is there somewhere out there a detailed discussion of how to build a module?

I need a very simple event list: date/time/location/presenter/phone, and I'm thinking I could probably modify TinyEvent to do what I need, but I would feel more comfortable with more detailed instructions. Database and SQL do not bother me, but I don't yet see the big picture and what pieces go where.

3) I want to use TinyContent, and I have the base module working, but I can't figure out how to enable the numbered clones.

4) I'm planning to use MultiMenu (for its TreeView presentation) but I can't seem to get the menu items hooked up to the TinyContent pages.

5) Can someone please jump the gun and tell me how to replace the SPAW editor in TinyContent with the new Koivi editor. Some of my non-techie people have Macs and this thing looks great.

This should be enough to get me going.
And thanks so much for the strong Community. It's been a joy to step into something with the base functionality already pre-constucted.




TopTop
« 1 ... 4 5 6 (7)



Login

Username:
Password:

Lost Password? Register now!

Who's Online

81 user(s) are online (54 user(s) are browsing Support Forums)


Members: 0


Guests: 81


more...

Donat-O-Meter

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

Latest GitHub Commits