New editor tools module for Phorum 5.1+

Posted by Maurice Makaay 
Re: New editor tools module for Phorum 5.1+
July 01, 2008 04:50AM
tried from different computers and the same tried yesterday... everything running fine.
I think problem is that I had installed and enabled the YahooUI JS Compressor (but not Java installed), so I was getting those errors. Disabled it and everything running fine again, probably had templates cached as everything now works as expected.

Thanks and sorry for the inconvenience!
Re: New editor tools module for Phorum 5.1+
July 01, 2008 05:01AM
No problem and thanks for your update. The compressor should fallback gracefully if java cannot be found, but maybe there was some error message output in your page or so. Glad to hear that it's solved by disabling the compressor.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: New editor tools module for Phorum 5.1+
September 30, 2008 05:57PM
Hi all,

I tried to add another button to the editor menu using a module as described in the readme file.

However, I get a "Warning: Cannot modify header information - headers already sent by (output started at /.../mods/offtopic/offtopic.php:7)".

Here is the content of file offtopic.php:

[code="php" number]
<?php
if(!defined("PHORUM")) return;

function phorum_mod_offtopic_editor_tool_plugin()
{
?>
<script type="text/javascript">
function editor_tools_handle_offtopic() {
editor_tools_add_tags('[ot]', '[/ot]');
editor_tools_focus_textarea();
}
</script>
<?php

editor_tools_register_tool(
'offtopic', // Tool id
'markiert Text als nicht zum Thema gehörend', // Tool description
'./mods/offtopic/icon.gif', // Tool button icon
'editor_tools_handle_offtopic()', // Javascript action on click
22, // Tool icon width
20 // Tool icon height
);
}
?>
[/code]

I followed the readme file very closely. The mod works (as does my additional bbcode for turning [ot]-[/ot]-formatted strings into greyish text) but I'd like to get rid of the warnings.

Thanks a lot in advance,
Marian
Re: New editor tools module for Phorum 5.1+
September 30, 2008 06:03PM
You'll need to wrap that javascript code a bit. Here's an example of how you can do this:
[code="php"]
function phorum_mod_offtopic_editor_tool_plugin()
{
ob_start(); ?>
<script type="text/javascript">
function editor_tools_handle_offtopic() {
editor_tools_add_tags('[ot]', '[/ot]');
editor_tools_focus_textarea();
}
</script>
<?php
$PHORUM['DATA']['HEAD_TAGS'] .= ob_get_contents();
ob_end_clean();

editor_tools_register_tool(..etc...
[/code]

This will push the javascript code to the {HEAD_TAGS} template variable, which is loaded in the <head> section of the page by default.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: New editor tools module for Phorum 5.1+
September 30, 2008 06:22PM
Hmm, this was partly successful. It solved the warnings issue, but now a click on the button does nothing.
Once I click on the button Firebug reports an error saying "editor_tools_handle_offtopic is not defined".

Before that, I had a warning and a working button ... :-)

Any ideas?

Cheers,
Marian
Re: New editor tools module for Phorum 5.1+
October 01, 2008 01:23AM
Oh sorry, I forgot something there.
$PHORUM is not global there. Start out your function by globalizing that variable:
function phorum_mod_offtopic_editor_tool_plugin()
{
    global $PHORUM;

    ob_start(); ?>
    ....etc....


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: New editor tools module for Phorum 5.1+
October 01, 2008 06:19AM
Excellent, it works perfectly now.

Now I'll just have to transform my quick&dirty hack/module into a proper publishable module ... :-)

Thanks a lot again,
Marian
Re: New editor tools module for Phorum 5.1+
November 20, 2008 02:44AM
Hi
Unfortunately I didn't find it anywhere: where ae default buttons registered. I want to remove IMG button from editor buttons. Please help!
Re: New editor tools module for Phorum 5.1+
November 20, 2008 02:47AM
are you really using phorum-5.1.x?
in phorum 5.2.x you can set that in the bbcode module settings.


Thomas Seifert
Re: New editor tools module for Phorum 5.1+
November 20, 2008 03:15AM
5.2.9 - I found it - in bbcode module. I thought it should be in editor...stupid ;p thanks
Sorry, only registered users may post in this forum.

Click here to login