Firefox PHP

New editor tools module for Phorum 5.1+

Posted by Maurice Makaay 
Re: New editor tools module for Phorum 5.1+
July 18, 2006 09:21PM
I added a couple of fixes to the code to make editor work within an embedded environment. I didn't see the problems myself, because I use a base href in my page that points at the Phorum installation. Therefore, the relative paths are resolved correctly on my system but not on yours. The code in 1.1.7 will use full HTTP paths to the icons to work around this problem.

I also added some fixes to make the bbcode and smileys help pages work. Those had problems too within an embedded environment.

The new package for Editor Tools 1.1.7 can be found in the first message of this thread.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: New editor tools module for Phorum 5.1+
July 19, 2006 02:07PM
Maurice,

Well done!

It works!

Thanks

[opensourceCMS.com]
[ongetc.com]
Chanh Ong
Re: New editor tools module for Phorum 5.1+
July 19, 2006 02:21PM
v1.1.7 didn't work for me (as embedded) !
The toolbar did not appear in the textarea at first. Then I still fixed the paths manually and it worked. An other point, always in embedded environnement: I think that the help url must remain relative, so the popup comes on only with the small/light help file (as in v1.1.2). If you propagate the http path, this results to capture the extra-phorum header and footer which are not necessary to the help window, especialy if they are formated for a pleine page view.
Re: New editor tools module for Phorum 5.1+
July 19, 2006 03:00PM
I just notice something odd the smiley does not show the smileys it only show a blank rectangle box.

What is missing?

PS: It is working on my Window box but not on my share host account. What's the different?

Thanks

[opensourceCMS.com]
[ongetc.com]
Chanh Ong



Edited 1 time(s). Last edit at 07/19/2006 03:11PM by chanh.
Re: New editor tools module for Phorum 5.1+
July 19, 2006 04:50PM
Here's Finnish files for editor tools.

I added the languages files to the distribution and unlinked your files from this message. Thank you for the contribution! (Maurice)

Note that since adding smileyhelp the image url in BBCode help is not working...

---
-=[ Panu ]=-



Edited 1 time(s). Last edit at 07/20/2006 10:52AM by mmakaay.
Re: New editor tools module for Phorum 5.1+
July 19, 2006 06:24PM
@chanh: when is the smiley not showing? Are you talking about the popup box or about the smileys that are put in a page?

@milos: I don't know how in 1.1.7 you would get Phorum header/footer in the help pages. I changed things there to specifically not use relative URL's, because that breaks embedding in almost all cases. Instead, I created a bit in the common hook of the module, where the helpfile is shown. If editor_tools_help is set in the URL (which I create through phorum_get_url() to make it work in embedding mode), then this code will kick in. It will either include a helpfile or die on the fact that it can't find one. No header or footer is included ever in that code.

What paths did you still have to change? I thought I changed all paths to an absolute path with $PHORUM["http_path"] as the base of it. That should be sufficient, because the http_path should point to the Phorum installation's URL. I cannot work with relative paths, because I do not know the relative position from the portable code to the Phorum dir. That can all change from installation to installation.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: New editor tools module for Phorum 5.1+
July 19, 2006 07:27PM
Instead of getting the square popup box with all the smiley in it I only got a little rectangle box with no smiley at all. Just blank!

[opensourceCMS.com]
[ongetc.com]
Chanh Ong
Re: New editor tools module for Phorum 5.1+
July 19, 2006 07:32PM
Hmm... that probably means that the smiley URL's are not constructed right. Do you have this somewhere public so I can take a look at it? Or if you are familiar with the DOM inspector that is in FireFox: could you check out the DOM tree and see if you can find the smiley images popup and check out if there are images in there and what their src URL's are?

Edit: On my system they worked, but that was again because I added a base URL, pointing to the Phorum installation. The smiley URL's are put in the box using relative URL's (./mods/smileys/...etc...). I'll write a fix for this, with the base url stripped on my own site to catch all problems that are like this one. But I really need some sleep first now, to tomorrow will be the day ;-)


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce



Edited 1 time(s). Last edit at 07/19/2006 07:36PM by mmakaay.
Re: New editor tools module for Phorum 5.1+
July 20, 2006 02:41AM
Hi Maurice,
I hope you are sleeping nicely at this time, while here in Paris, France, a heat wave doesn't let us sleep before 2am and more than 6am. Yesterday afternoon, Celsius said 39°, I don't know how to convert it in Farenheit and Google no more - it only understands money conversion that is the most useful for them :)

Well, lets see the header issue in embedded case. When I write "header" I mean an extra forum header, not the one in phorum templates. When you have phorum as embedded that is because you have to integrate it in some other site so phorum can share some graphics, p.e. icluded in a site's general header, and/or same code with other pages. In my case, here is the structure of portal:

- mysite.com/forum.php
- portable code is in ./phorum_portable
- phorum is in ./phorum

forum.php is like this:

ob_start("callback");
include ('myheader.php');
include_once ("phorum_portable/phorum.php");
include ('myfooter.php');
ob_end_flush();

the callback function makes some preg_replace in the buffer to strip/fit html titles and other metadata between phorum template header and extra forum myheader. Perhaps I could realise this via a hook function which should include myheader in forum template header but this is an other problem.

So a forum url comes like this:
http:/_/www.mysite.com/forum.php?{read|list|posting|etc.},{number}, etc.


If you construct the help url by calling phorum_get_url() this will result to something like
http:/_/www.mysite.com/forum.php?index,editor_tools_help=smileys

In this way, myheader and myfooter will be added beacuse there is a call to forum.php
What I mean with "relative urls" is that there should be a direct call to $helpfile
./phorum/mods/editor_tools/help/$lang/{$helpid}.php, i.e. help files should not be embedded even in embedded mode.

The path issue
I had to add the dirname of the phorum location ("phorum" in the case described above) before almost any path where you can find "mods/editor_tools" string in editor_tools.php and js_color_picker_v2.js excepted these lines:
38 require_once("./mods/editor_tools/defaults.php");
53 $helpfile = "./mods/editor_tools/help/$lang/{$helpid}.php";

All other file were not touched

The most important to change are lines 64,65,66 in editor_tools.php
$GLOBALS["PHORUM"]["DATA"]["HEAD_TAGS"] .=
      '<script type="text/javascript" src="phorum/mods/editor_tools/editor_tools.js"></script>' .
      '<link rel="stylesheet" type="text/css" href="phorum/mods/editor_tools/editor_tools.css"></link>' .
      '<link rel="stylesheet" href="phroum/mods/editor_tools/colorpicker/js_color_picker_v2.css"/>';

When they are correctly set, your editor's toolbar loads and works like a dream !

Remarque: having two files default.php and settings.php is a little bit confusing from the user's side as in many applications both names may be used for setting default values.

Well, now it's 8:30am and time to go work. Outside temp is already 28 °C (oh yes, I found it, that makes 82 °F !)

Postscript: while editing this post to make it readable, this may be a good idea: a function that strips BBcode at least between [code_] and [/code] so an url in a message appears in its integrality and not automaticaly like a link. I had to add an "_" between the two "//" in order to keep urls visible.



Edited 3 time(s). Last edit at 07/20/2006 02:57AM by milos.
Re: New editor tools module for Phorum 5.1+
July 20, 2006 07:01AM
Your portable implementation is what is causing the problem here. The correct way to handle this is to use Phorum's header.tpl and footer.tpl for adding headers and footers to your pages and not to do that from your portable script. You now simply add those to all pages. Don't you have problems with RSS links and file downloads as well? These do not use Phorum's header/footer, because they contain raw output of file contents and RSS XML code.

For embedding, the only correct way to implement things is like I did it now. So call phorum_get_url() to generate a URL that fits in the embedded system, let Phorum initialize within the embedded envionment and work with the data that this environment set up for me. If the help pages were fully static, then direct linking could be possible, but for example the smileys help will need to know what smileys are enabled in the forums. By direct linking to the php-file, I could at most try to retrieve the Phorum installation's smiley settings, but the embedded environment could be running on a totally different database with different smiley settings alltogether. That's why a direct link isn't feasable here.

If you cannot change the portable code for some reason, then I guess you'll have to change the callback code to strip your header and footer for those cases where the header and footer should not be used. Not very pretty, but certainly a possilibity.

Quote

Remarque: having two files default.php and settings.php is a little bit confusing from the user's side as in many applications both names may be used for setting default values.
Users are not supposed to touch these files in the first place. Settings need to be done through the admin interface that Phorum provides. The README is clear on this

The filename "settings.php" is a magic filename that will make Phorum use this file as the settings page for the module. Since I needed a file for settings default values in case they were missing from the environment (especially important for seamless upgrades, because during upgrades new config settings might become available), I thought that "defaults.php" pretty much described its exact contents.

Quote

Postscript: while editing this post to make it readable, this may be a good idea: a function that strips BBcode at least between [code_] and[/code]so an url in a message appears in its integrality and not automaticaly like a link. I had to add an "_" between the two "//" in order to keep urls visible.

Stripping bbcode alltogether would not give the opportunity to display for example colored parts in the code section. So stripping bbcode altogether would not be desirable. But it's an idea. Maybe we can consider adding a configuration switch to the bbcode settings to disable bbcode parsing withing a
 block.


Maurice Makaay Phorum Development Team my blog linkedin profile secret sauce
Sorry, only registered users may post in this forum.

Click here to login