Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 11:13 am EDT

Geeklog Forums

GL 1.3.11 with htmlarea 3.0 RC3 install instructions

Page navigation


Status: offline

holla

Forum User
Newbie
Registered: 03/06/05
Posts: 9
Location:Ouray Colorado
Folks,
I'm posting my instructions here for the next poor soul to undertake htmlarea.

htmlarea install
cd /tmp
cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/itools-htmlarea login
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/itools-htmlarea co -P htmlarea
cd htmlarea
mkdir builds
./make-release.pl
mv builds/HTMLArea-3.0-RC3 to /path/to/geeklog/htmlarea
cd /path/to/geeklog
find htmlarea/ -type f -exec chmod 644 {} ;
find htmlarea/ -type d -exec chmod 755 {} ;
find htmlarea/ -name "*.cgi" -exec chmod 755 {} ;

check your install by browsing to
http://yoursite/lhtmlarea the online demos should work, try core.html

modifications to /path/to/geeklog/layout/yourlayout/admin/story/storyeditor.thtml

add this at the top

<script type="text/javascript">
_editor_url = "/htmlarea/";
_editor_lang = "en";
</script>

<script type="text/javascript" src="/htmlarea/htmlarea.js"></script>

<script type="text/javascript">
HTMLArea.onload = function() {
var editor1 = new HTMLArea("editor1&quotWink;
editor1.config.toolbar = [ [ "bold", "italic", "separator", "orderedlist", "unorderedlist", "separator", "inserthorizontalrule", "createlink", "insertimage", "inserttable", "htmlmode", "separator", "copy", "cut", "paste", "space", "undo", "redo", "space", "removeformat", "killword" ]
];
editor1.generate();

var editor2 = new HTMLArea("editor2&quotWink;
editor2.config.toolbar = [ [ "bold", "italic", "separator", "orderedlist", "unorderedlist", "separator", "inserthorizontalrule", "createlink", "insertimage", "inserttable", "htmlmode", "separator", "copy", "cut", "paste", "space", "undo", "redo", "space", "removeformat", "killword" ]
];
editor2.generate();
};
HTMLArea.init();
/*
this is from htmlarea.js, we are eliminating some buttons because geeklog will remove tags
this.toolbar = [ [ "fontname", "space", "fontsize", "space", "formatblock", "space", "bold", "italic", "underline", "strikethrough", "separator", "subscript", "superscript", "separator", "copy", "cut", "paste", "space", "undo", "redo", "space", "removeformat", "killword" ],

[ "justifyleft", "justifycenter", "justifyright", "justifyfull", "separator", "lefttoright", "righttoleft", "separator", "orderedlist", "unorderedlist", "outdent", "indent", "separator", "forecolor", "hilitecolor", "separator", "inserthorizontalrule", "createlink", "insertimage", "inserttable", "htmlmode", "separator", "popupeditor", "separator", "showhelp", "about" ]
];

*/
</script>


Still in /path/to/geeklog/layout/yourlayout/admin/story/storyeditor.thtml
add id="editor1" and id="editor2" to textfields , like this
<td><textarea name="introtext" id="editor1" cols="98" rows="12" wrap="virtual">{story_introtext}</textarea></td>

replace "Post Mode" table tr with this, don't let user select between 'Plain old text' and 'html'
<tr><td></td><td>{lang_allowed_html}<input type="hidden" name="postmode" value="html"></td></tr>



htmlarea kicks out an extra carriage return/linefeed when blank textareas are returned.
This blank whitespace gets stored in db as bodytext, then geeklog thinks there's "more" to the story.

Now in /path/to/geeklog/admin/story.php
in the clean up section, look for 'html', then add a rtrim to get rid of the last trailing cr/lf
$bodytext = COM_checkHTML (COM_checkWords (rtrim($bodytext," \\r\\n&quotWink));


When stories are submitted, firefox shows a blank screen
Edit lib-common.php, replace COM_refresh with this

function COM_refresh( $url )
{
return "<html><head><SCRIPT LANGUAGE=\\"JavaScript\\">redirTime = \\"100\\"; redirURL = \\"$ur\\l"; function redirTimer() { self.setTimeout(\\"self.location.href = redirURL;\\",redirTime); } </script></head><body onLoad=\\"redirTimer()\\"></body></html>";
}


Hope this helps. Thanks to everyone who's contributed on this subject already.
Craig

 Quote

danMc

Anonymous
Did you see this in the download section:
Professional Theme With Built-in WYSIWYG
http://www.geeklog.net/filemgmt/singlefile.php?lid=464
And check my comment about what to change in the config.php file so that tags are not stipped out.
 Quote

Status: offline

holla

Forum User
Newbie
Registered: 03/06/05
Posts: 9
Location:Ouray Colorado
Thanks, I'll take a look. Was you approach similar to mine?
 Quote

Status: offline

geKow

Forum User
Full Member
Registered: 01/12/03
Posts: 445
....and was it for HTMLarea 3? or is there no difference?
 Quote

Status: offline

geKow

Forum User
Full Member
Registered: 01/12/03
Posts: 445
oh and... I would suggest to make a copy of storyeditor.thtml and rename ist to advanced_storyeditor.thtml. Than open config.php and set $_CONF['advanced_editor'] = true;
this way you keep your old settings and can switch between HTMLarea and not.
(tip from Blaine)

geKow
 Quote

dan Mc

Anonymous
Quote by holla: Thanks, I'll take a look. Was you approach similar to mine?


No - I am not that smart... I'm not even sure what your instructions are saying. I only have ftp acces to my server. Your instructions look like you have command line access.

I used the pre made theme files provided in the modified professional theme, then, tackled the changes to the config.php in the allowed html area. I only added to the admin area as I don't know what problems I might be opening up if I let everyone have ability to do this. I have no idea what array this or that is, I just tinkered and trial and error with different tags to get it to work.
 Quote

Status: offline

holla

Forum User
Newbie
Registered: 03/06/05
Posts: 9
Location:Ouray Colorado
Folks,

After spending a couple hours figuring out how the 'story admin' functionality works, I see that its quite a bit of work to give the normal users the ability to insert images like the admins. The whole preview thing is also a pain. I'm abandoning that effect and have moved to FCKeditor, which includes an integrated file uploader. I got the user submit story running with fckeditor in about 10 minutes. Now I'm tweaking things. I'll report back on my setup when complete.

Thanks,
Craig
 Quote

phpsocialclub

Anonymous
I must say that so far FCKeditor is alot easier than HTML area,

I have installed HTMLarea 2.0 and 3.0 in GL sites and I just did FCKeditor in about 5 minutes, once I decided to read the docs.

I have not tried the image upload yet, but I assume that will work as advertised.

 Quote

Status: offline

holla

Forum User
Newbie
Registered: 03/06/05
Posts: 9
Location:Ouray Colorado
No doubt, I've also switched to FCKeditor. It works great in IE6 and Firefox. Not in Safari though, but I have a friend working on that. When I get FCKeditor running for another site, I'll document my instructions to this forum much like my instructions for HTMLArea.
 Quote

Status: offline

jnordquist

Forum User
Full Member
Registered: 03/14/03
Posts: 129
Location:Kenosha
I have FCKEditor running on kenoshaonline.net but the image insert function does not seem to work. Even with an absolute url, when I save the story of comment, the image is deleted in the source and all that is left is
Text Formatted Code
<img alt="" />
 
. Did you have better luck?


John Nordquist,
Applications Specialist, medical Technologies
 Quote

Status: offline

jnordquist

Forum User
Full Member
Registered: 03/14/03
Posts: 129
Location:Kenosha
Also, when saving a new story or comment, the result works, you get a blank page. If you go you view the page you were creating, it's there, but unlike the standard GL editor save, which takes you to the list of stories when you click save, this takes you to an empty page.
John Nordquist,
Applications Specialist, medical Technologies
 Quote

Status: offline

jnordquist

Forum User
Full Member
Registered: 03/14/03
Posts: 129
Location:Kenosha
Okay, the image thing was simply an oversight (isn't it usually?). I forgot to add the allowable html in config.php to enable images in stories.

The blank page is still a mystery.
John Nordquist,
Applications Specialist, medical Technologies
 Quote

Status: offline

mevans

Forum User
Full Member
Registered: 02/08/04
Posts: 393
Location:Texas
The blank page is still a mystery.


For some reason, whenever you integrate any of the WYSIWYG editors, it breaks the COM_refresh() function. This is what is causing the blank page after a save, the refresh to reload the URL is not working.

A quick hack to fix it for me was to replace the following line in lib-common.php (COM_refresh() function):

old code
Text Formatted Code
return "<html><head><meta http-equiv="refresh" content="0; URL=$url"></head></html>n";
 


new code
Text Formatted Code
    header("Location: " . $url);
 


I'm not sure why the meta refresh was chosen instead of using the php header() function, but this did fix the problem for me, your milage may vary...

As a side note, I'm actually using SPAW editor with GeekLog and it works very well, including the image upload. No new javascript necessary, just took a couple of small hacks to story.php, created the storyeditor_advanced.thml file and updated config.php to not filter the HTML and all is well. But, keep in mind, I don't run sites that allow user editing, either I do it or one of my trusted admins do it, so the security concerns are not that great for my situation. I haven't really looked at the implications of turning it on for public use or in comments.

If you are interested, I will post the actual modifications to story.php and put a little more effort in documenting how it was done.
 Quote

Status: offline

jnordquist

Forum User
Full Member
Registered: 03/14/03
Posts: 129
Location:Kenosha
Thanks for the refresh fix! It was driving me nuts!

I would be very interested in the SPAW editor. I do have public input, but we monitor pretty closely.

Many thanks!
John Nordquist,
Applications Specialist, medical Technologies
 Quote

Status: offline

mevans

Forum User
Full Member
Registered: 02/08/04
Posts: 393
Location:Texas
How to install the SPAW Wysiwyg editor in GeekLog 1.3.11

1. Download SPAW - http://www.solmetra.com/en/disp.php/en_products/en_spaw/en_spaw_intro

2. Install in the /spaw/ directory under public_html

3. Configure SPAW to work in your environment, test using the

http://your_url.com/spaw/scripts/demo.php

NOTE: You must do this test BEFORE you perform the hack below, because it will
break the demo.

3. SPAW Hack

You must change SPAW to not actually execute the editor, but instead return the HTML.

edit spaw_control.class.php

At the bottom of the file, change function show() to:

change echo $this->getHtml(); to return $this->getHtml()

4. Geeklog Hacks

Edit admin/story.php

Add the following lines after 'require_once('auth.inc.php');

$spaw_root = $_CONF['path_html'] . '/spaw/';
require($spaw_root . 'spaw_control.class.php');

Around line 493 add the following 3 lines after: $newintro = str_replace('}','}',$newintro);

$sw = new SPAW_Wysiwyg('introtext',$newintro,'en','full');
$spaw_introtext = $sw->show();
$story_templates->set_var('spaw_introtext',$spaw_introtext);

A few lines down, add the following 3 lines after: $newbody = str_replace('}','}',$newbody);

$sw_body = new SPAW_Wysiwyg('bodytext',$newbody,'en','full');
$spaw_bodytext = $sw_body->show();
$story_templates->set_var('spaw_bodytext',$spaw_bodytext);

That's it for the story.php hacks.

5. Create storyeditor_advanced.thtml in layout/YOURTHEMEHERE/admin/story/

- Copy storyeditor.thtml to storyeditor_advanced.thtml

Edit storyeditor_advanced.thtml

Find the line that looks like this (may vary depending on theme)

Text Formatted Code
<textarea name="introtext" cols="50" rows="12">{story_introtext}</textarea>

 


Replace this with

{spaw_introtext}
So you will end up with something like: <td>{spaw_introtext}</td>
Next find the line that looks like

Text Formatted Code
<textarea name="bodytext" cols="50" rows="15">{story_bodytext}</textarea>

 


Replace with:

{spaw_bodytext}

So you will end up with something like: <td>{spaw_bodytext}</td>
That's it for the edits

6. Update your config.php to enable advanced editing

$_CONF['advanced_editor'] = true;

7. Update your config.php to NOT filter some additional HTML

NOTE: I am not sure what the security implications are for this, I personally
am the only one who edits stories on my sites, so it is not a big issue for me.
Proceed with caution...

Here is what I have in my config.php for $_CONF['admin_html'] and it seems to handle
most of the SPAW commands.
Text Formatted Code
       
        $_CONF['admin_html'] = array (
        'p'     => array('class' => 1, 'id' => 1, 'align' => 1),
        'div'   => array('class' => 1, 'id' => 1, 'style' => 1),
        'span'  => array('class' => 1, 'id' => 1, 'style' => 1, 'color' => 1, 'rgb' => 1),
        'table' => array('class' => 1, 'id' => 1, 'width' => 1, 'border' => 1,
                             'cellspacing' => 1, 'cellpadding' => 1, 'style' => 1,
                        'bgcolor' => 1),
        'tr'    => array('class' => 1, 'id' => 1, 'align' => 1, 'valign' => 1, 'style' => 1, 'bgcolor' => 1),
        'th'    => array('class' => 1, 'id' => 1, 'align' => 1, 'valign' => 1,
                        'colspan' => 1, 'rowspan' => 1),
        'td'    => array('class' => 1, 'id' => 1, 'align' => 1, 'valign' => 1,
                        'colspan' => 1, 'rowspan' => 1, 'style' => 1, 'bgcolor' => 1),
        'tbody' => array('style' => 1),
        'img'   => array('src' => 1, 'style' => 1, 'align' => 1, 'width' => 1,
                        'height' => 1),
        'onclick' => array('window.open' => 1),
        'sup'   => array(),
        'sub'   => array()
        );


 

8. If you receive a blank page after saving a story, apply the following hack.
For some reason, each Wysiwyg editor I have tried has broken COM_refresh()
in lib-common.php. Here is what I did to fix it:

Find COM_refresh() function in lib-common.php and change it to:

header("Location: " . $url);

9. You are done!

NOTES: This does not enable the Wysiwyg editor for comments or static pages. I haven't actually done
it for comments, but I would imagine it isn't much different from the above, just find the right
files to edit and the approach should work fine.

For staticpages, I have done it and it seems to work fine.

Add the following lines near the top of admin/plugins/staticpages/index.php (right after the 2 require_once..)

$spaw_root = $_CONF['path_html'] . '/spaw/';
require($spaw_root . 'spaw_control.class.php');


Look in admin/plugins/staticpages/index.php around line 285 for:

$sp_template->set_var('sp_content', htmlspecialchars (stripslashes($A['sp_content'])));

Add the following lines ABOVE this line:

$sw = new SPAW_Wysiwyg('sp_content',stripslashes($A['sp_content']),'en','full');
$sp_content = $sw->show();
$sp_template->set_var('spaw_sp_content',$sp_content);

You will need to create the editor_advanced.thtml in the /plugins/staticpages/templates/admin/
directory and change the following code:

Text Formatted Code
<textarea name="sp_content" cols="75" rows="24" wrap="virtual">{sp_content}</textarea>

 


To

{spaw_sp_content}
Staticpages should not be handled using the Wysiwyg editor too.

Good Luck

That is it! Hopefully it will work for you, if not please feel free to email me.
 Quote

duvide

Anonymous
What a great instruction! It's the first time that I actually got an html editor to work with geeklog, especially with the stories. Thank you!

When I tried to make it work with staticpages I get this error though:

Fatal error: Cannot instantiate non-existent class: spaw_wysiwyg in /home/xxx/domains/xxx.com/public_html/admin/plugins/staticpages/index.php on line 285

Do you have any suggetions here?

Thank you/Frank
 Quote

Status: offline

mevans

Forum User
Full Member
Registered: 02/08/04
Posts: 393
Location:Texas
Sorry, I forgot one step in the static page installation:

Add the following lines somewhere near the top of index.php in public_html/admin/plugins/staticpages/index.php

I put them right after the two require_once lines near the top.

$spaw_root = $_CONF['path_html'] . '/spaw/';
require($spaw_root . 'spaw_control.class.php');

This should get you going with static pages too.

Thanks!

 Quote

Status: offline

jnordquist

Forum User
Full Member
Registered: 03/14/03
Posts: 129
Location:Kenosha
I am almost there with spaw...

The editor boxes come up, but no buttons work and the text box won't allow for a cursor to appear when clicking in it...
John Nordquist,
Applications Specialist, medical Technologies
 Quote

Status: offline

mevans

Forum User
Full Member
Registered: 02/08/04
Posts: 393
Location:Texas
I am almost there with spaw...

The editor boxes come up, but no buttons work and the text box won't allow for a cursor to appear when clicking in it...



Did the demo work? Remember, that one of the changes I noted above will actually break the demo, but if you start from scratch, make sure the demo.php is working first that will remove SPAW configuration issues out of the trouble shooting.

If the demo is working, but not in Geeklog, I'm not sure what the problem might be. Just off the top of my head, if you tried any of the other Wysiwyg editors, is there any old javascript hanging around in your headers? Have you checked it in a different browser (I use firefox 1.04 without issues)?

Good Luck!
 Quote

duvide

Anonymous
You know your stuff, mevan!
With the 2 lines put in, it is even working in staticpages.
Great job, thanks/Frank
 Quote

Page navigation

All times are EDT. The time is now 11:13 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content