Firefox PHP

New editor tools module for Phorum 5.1+

Posted by Maurice Makaay 
Re: New editor tools module for Phorum 5.1+
July 31, 2006 11:57AM
In the English BBcode help, there are some mismatched tags:

Quoted text: 
Quote

...
or
Quote
...
...[/color]

should be

Quoted text: 
Quote

...
or
Quote
...
...
Re: New editor tools module for Phorum 5.1+
July 31, 2006 03:19PM
Oops... I'll fix it for the next release and check if the other languages have this correct. Thanks for the notice!


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: New editor tools module for Phorum 5.1+
July 31, 2006 04:17PM
Find a new release 1.1.12 of the editor tools in the first message of this thread. The Changelog is in there too.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: New editor tools module for Phorum 5.1+
August 02, 2006 05:34PM
Hmmm... the Popup color picker doesn't load now. Also in line 22 of js_color_picker_v2.html
<script type="text/javascript" src="js_color_picker_v2.js"></script>
referes to a "js_color_picker_v2.js" file which is no more present in the distribution as it was renamed "js_color_picker_v2.js.php".
Everything else is working perfectly at first.
Re: New editor tools module for Phorum 5.1+
August 02, 2006 07:00PM
That js_color_picker_v2.html is absolutely of no interest, because that's just a test file that was included in the color picker distribution. So forget about that one. It's correct that it doesn't load.

The js library is now produced by a PHP script to make it loadable from Phorum and use the http_path setting. That's the only way in which I can create the correct absolute URL's to the images for the color picker. The URL that is used for loading the library looks like this for my site:

http://dev.gitaar.net/forum/index.php?index,editor_tools_cpjs=1

This is loaded perfectly in my embedded setup. My guess is that you're (again) running into the problem that you are printing a header and footer at all time in your portable setup, so the javascript will be wrecked by non-javascript code at the start of the file. Find the above URL in your editor page source and try to open it to see what happens.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: New editor tools module for Phorum 5.1+
August 03, 2006 08:27AM
Quote
Maurice
My guess is that you're (again) running into the problem that you are printing a header and footer at all time in your portable setup

I wrote at least three times (see here) that I'm no more using headers/footers in the main calling page of my embedded phorum, all this is now done through the template header, as you recommanded.

Well, what do you think about this:
239        $cpjs= phorum_get_url(PHORUM_INDEX_URL, 'editor_tools_cpjs=1');
240        $jslibs[] = './mods/editor_tools/colorpicker/color_functions.js';
changed to 
240        $jslibs[] = $GLOBALS["PHORUM"]["http_path"] . '/mods/editor_tools/colorpicker/color_functions.js';
241        $jslibs[] = $cpjs;


    foreach ($jslibs as $jslib)
    {
        // Turn relative URL jslib paths into a full URL, to make this
        // module work correctly in an embedded environment.
311         if (! preg_match('|^\w+://|', $jslib) && substr($jslib, 0, 1) != '/') {
312           $jslib = $GLOBALS["PHORUM"]["http_path"] . "/$jslib";
changed to
312           $jslib = "$jslib";

As phorum_get_url() is supposed to construct a correct url even in embedded environnement, there is no need to use $GLOBALS["PHORUM"]["http_path"] for all $jslibs in line 312

This way, everything works fine in my installation. There is something I need to look more closely as the smiley icons have this strange path http:_//www.mysite.com/phorumfolder/../phorumfolder/mods/smileys/images
It works as phorumfolder is just one level under the siteroot. I don't know if it comes from your script or if I forgot something while working around the colorpicker path problem. By the way, what about having a message "choose your smiley" and a close (x) mark in the uper right coin of the smiley popup so it will look the same like the color popup ?
Re: New editor tools module for Phorum 5.1+
August 03, 2006 08:45AM
Maurice, don't worry about my smiley path problem it was due to the pathe I gave in the "Smiley replacement mod" settings. It was corrected now.
Re: New editor tools module for Phorum 5.1+
August 03, 2006 09:02AM
I always want to add http_path in front of libraries that do not specify a full URL or absolute server path, so I can allow other modules that want to plugin into the editor tools to use relative paths when using the editor tools API call editor_tools_register_jslib() (which is used for registering a javascript library).

You removed that functionality from the loop and hardcoded the http_path prefix in the color_functions.js definition. Therefore the main change that you made, is breaking the desired behaviour of path resolving for the jslibs.

AFAICS, the end result for your situation is the same within both code versions. But maybe I'm missing the point why you exactly would want to change these lines of code. Is it actually fixing a problem and if yes, could you provide a break down of the problem and this specific solution?


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: New editor tools module for Phorum 5.1+
August 03, 2006 09:51AM
The fix I've given above may create problems to others as the test to detect an absolute url is not executed to all $jslib values. And there is, I think, the origin of my problem : in my installation phorum_get_url() constructs the url like this:
"./myphorum.php?index, etc", while in my phorum general settings $GLOBALS["PHORUM"]["http_path"] is set to "http://www.mysite.com/phorumfolder" (is that correct ?)
But this url (./myphorum.php?index, etc), started by a point (./) is not detected by the preg_match pattern. So line 312 will result in
$GLOBALS["PHORUM"]["http_path"] . "/$jslib";
http://www.mysite.com/phorumfolder/ ./myphorum.php?index, etc." which of course can not work. The correct path should be:
http://www.mysite.com/myphorum.php?index, etc, that's why I don't need to append the $GLOBALS["PHORUM"]["http_path"] to the urls resulting from a phorum_get_url() construction. I only nedd to do it to all others "editor_tools mod" specific urls.

Added Postscript: sorry, I was writing this message while you were posting your answer to my previous post, so I've only read it now. I think this message explains better my problem.



Edited 1 time(s). Last edit at 08/03/2006 09:55AM by milos.
Re: New editor tools module for Phorum 5.1+
August 03, 2006 09:56AM
Okay, then the problem is clear. get_phorum_url() is supposed to return a URL (hence the function's name ;-). Your implementation is returning a relative path. Change your implementation to return a full URL and you should be set.


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

Click here to login