Firefox PHP

New editor tools module for Phorum 5.1+

Posted by Maurice Makaay 
New editor tools module for Phorum 5.1+
July 13, 2006 02:03PM
This is the Editor Tools module for easy BBcode and smileys support in the editor. I would really love if people could try out these tools to help me find bugs and improvements. The README file in the package contains all the info you need for installing it.

Beware that 5.1 already ships with an editor_tools module. This module completely replaces that one. So before installing, delete or rename the existing editor_tools directory.

You can take a look at the tools at [phorum-dev.gitaar.net] (login using phorum/phorum). The tools do not depend on the new template, so they work fine with the default 5.1 template as well.

Changelog:
2007-07-08 v1.1.20

    - Fixed a bug that caused extra editor tool buttons to not show up.

2007-05-31 v1.1.19

    - Included a French translation by notre-planete.info. Thanks!

2007-04-11 v1.1.18

    - It's now possible to put the editor tools at a specific spot in the
      editor page, by creating a container element with id="editor-tools".
      The editor tools will automatically use that container for adding
      the buttons to the page.

2007-01-21 v1.1.17

    - Added ALT and TITLE attributes to the images in the smileys popup.

2007-01-15 v1.1.16

    - Corrected a bug which was introduced with version 1.1.15: the
      subject smileys did show all available smileys instead of only
      the ones that were allowed in the subject.

2007-01-13 v1.1.15

    - Fixed a problem with the javascript code which caused MSIE6 to
      show additional broken images in the smileys popup (known as
      the red crosses error).

2006-08-09 v1.1.14

    - Fixed wrong CSS declaration in colorpicker's CSS code
      (-moz-user-select:no instead of -moz-user-select:none).

    - Added updated czech language files (UTF8, WIN1250 and Latin-2 encoded)
      Thanks to CZVilda for the update.

    - Added localization support for the tab panels of the color picker.
      Thanks to CZVilda for the proposed code change.

2006-08-08 v1.1.13

    - Fixed a problem in the function editor_tools_construct_popup.
      The create_id wasn't used for generating the id of the content
      <div> of the popup window. This had no effect on the
      functionality of the editor tools.

    - Added extra languages to the distribution:
      * Swedish (by Per Mattsson)
        Beware: only the basic language file was translated, so there are
                no translated help files available in Swedish.
      * Italian (by Nicola)
      Thanks for the translation!

2006-07-31 v1.1.12

    - Some last fixes in editor_tools.php for using correct absolute URLs
      in an embedded environment. Also changed the way in which the
      colorpicker javascript is loaded. I now load it through the module
      php code, so paths in that javascript can be made absolute
      using $PHORUM["http_path"].
      I think (again ;-) that all embedding/portable issues are fixed now.
      Thanks milos for pointing me at the last couple of problems, to
      get them squeezed out.

    - BBcode help fix: most language file had a tag mismatch in them:
      
Quote
..
.. [/color]. Thanks to James Hatts for the heads up! - Do not write tags to the textarea if the user presses Cancel on a second input prompt. Currently, the only second prompt is used for the description in creating URL links. 2006-07-27 v1.1.11 - Added basic support for MSIE 5 and Netscape 7 on MacOS 9. Since these browsers are lacking functionality for selections and cursor positioning, the best I could do here is appending the tags to the end of the textarea contents. There was also an issue with the color picker on MSIE 5. Running the javascript code for building the popup window was way too heavy for the system. Somehow it even seemed to get stuck and hung. There were also some JavaScript compatibility problems. Based on all this, I decided to never display the color picker button on this browser. Thanks to CBiLL for contributing in the costs for a second-hand Powerbook G3 that I bought for working out the problems! - Added extra language to the distribution: * Czech (by Michal) Thanks for the translation! - Added Spanish and Finnish language updates. Thanks Diego and Panu! 2006-07-25 v1.1.10 - Settings were added to the control panel to be able to change the size and horizontal placement of the smileys and the subject smileys popup windows. Using this, users can accomodate the the popup windows to the number of smileys that they have. - Added a second prompt for the [URL] tool to ask for a description of the link, in case no text has been selected. - A new language string was added: "enter url description". Updated language files for Finnish and Spanish (and of course additional translations) are welcome. 2006-07-24 v1.1.9 - Added extra language to the distribution: * Spanish (by Diego) Thanks for the translation! 2006-07-20 v1.1.8 - Added extra languages to the distribution: * Finnish (by Panu) * German (by Thomas Seifert) Thank you guys, for the translations! - Some more fixes for running in a portable / embedded setup. * The smileys are now visible in the popup window. * When registering editor tools from another module, their icon and jslib paths are resolved automatically to an absolute URL. - Some small changes to the help files. - Just http:// is no longer accepted for URL and image links. 2006-07-19 v1.1.7 - Improved right justification of the help popup in some browsers. - Various fixes to make the module work correctly in a portable / embedded setup. 2006-07-18 v1.1.6 - Added a z-index CSS property for the popups with a high value, to prevent them from popping up behind other page elements. - Changed all css classnames and javascript ids to not contain any underscores (thanks to Brian for the hint and pointer to [www.htmlite.com]). - Changed ".editor-tools-button" in the css to the more specific "#editor-tools .editor-tools-button", because it wasn't rendered correctly in some cases. - Fixes for color picker CSS in XHTML transitional pages viewed within MSIE. The tabs would not show up correctly without this fix (extra padding and top bar too small). Remark: this makes the tabs a bit off in XHTML strict pages. But since Phorum templates are XHTML transitional by default, I put this fix in the default package. 2006-07-17 v1.1.5 - For MSIE, the active textarea selection is now stored before opening the color or text size popup and restored after a selection has been made. This is done, because MSIE looses the selection range when focus moves to another object. This caused for example the color code to be never around the selected text in MSIE. 2006-07-17 v1.1.4 - Changed vertical aligment for the subject smiley button. - Bounding whitespace is now ignored when applying some bbcode to a selection. Thanks to Milos for the idea. - Improved detection for checking if we are running on a page, containing an editor. The existing detection had a bug that caused a javascript warning about a missing textarea on posting confirmation and error pages. Thanks to Milos for pointing me at this problem. 2006-07-16 v1.1.3 - Some small changes to make it easier to override and extend the editor tools from another module. 2006-07-15 v1.1.2 - Added a popup for subject smileys. This one is disabled by default, so if you want this, enable subject smileys in the module settings. - Added a module settings screen. Here the administrator can configure which tools are enabled (bbcode, smileys, subject smileys and help). In case the bbcode module is enabled, you get extra fields to configure which bbcode tags (bold, italic, etc) are put in the editor tools. - Some small bugfixes. 2006-07-14 v1.1.1 - Tool icon sizes are now explicitly set, for smoother loading. 2006-07-13 v1.1.0 - Initial release.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce



Edited 24 time(s). Last edit at 11/06/2008 05:34PM by Maurice Makaay.
Attachments:
open | download - editor_tools-1.1.20.tar.gz (51.8 KB)
open | download - editor_tools-1.1.20.zip (79.7 KB)
Re: New editor tools module for Phorum 5.1+
July 14, 2006 01:33AM
I'm still running my heavily butchered version but if I get a chance I'll check this out for you and report back, check out my hacked headline version if you wish to integrate any of that into here.
Re: New editor tools module for Phorum 5.1+
July 14, 2006 01:51AM
I'm getting

editor_tools.js library reports: no textpage found on the current page

in Firefox
Re: New editor tools module for Phorum 5.1+
July 14, 2006 02:56AM
M@AATW: The textarea in your editor does not have id="...", where the dots is one of phorum_textarea, body or message. Those are the three javascript object id's that the script looks for. What is the id for the textarea in your templates?

sirgrim: I am thinking about adding a smiley button behind the input text box for the subject, which shows a popup with all smileys that can be used in the subject. I'll check out your code.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: New editor tools module for Phorum 5.1+
July 15, 2006 09:07AM
@sirgrim: I checked out what you have done on your site, but I do not think I want to incorporate that into the editor tools. To me, that kind of functionality could better be arranged by adding an extra option to the editor form in which simply one icon can be selected. At post time, the icon can be put into the subject of the message and checks on multiple smileys in the final subject can be done. Even better might even be to put the selected icon in the message meta data and use that when the subject is rendered. This would all go into a separate module.

What I did do, was add a smiley button to the subject input. The new version of the editor tools is attached to the first message in this thread.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: New editor tools module for Phorum 5.1+
July 15, 2006 09:17AM
Cool i thought about doing it that way and it would probably be better but editor_tools was just begging to be hacked, figured i'd let you take a look just incase, keep up the good work I might install this version this weekend and see how it goes, if only I can remember what I butchered in the old one >:)
Re: New editor tools module for Phorum 5.1+
July 15, 2006 09:32AM
Knowing what you butchered probably won't help much, because this is a full rewrite, using a totally different concept.

In the new version, the javascript that you used could be hacked into editor_tools_handle_subject_smiley_select() in editor_tools.js. That is the very spot in the code where smileys are put in the subject field. The code that does checks at post time (only one smiley per subject and put smiley at start of subject) can go into a separate module.

BTW: the code that you now run has some problems. It seems to be hard coded on smileys that have the format (.....). If I enter the subject "Blah blah (boo boo)" and add a smiley, the (boo boo) part is stripped as well. It would be better to only strip strings that are really smileys.

I might try to write a module that does this, just to check out how well the editor tools are pluggable. I think I can put all of this in a separate module that simply canges the behaviour of the smileys subject button. I'll see if I can find some time tonight to hack up a proof of concept.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: New editor tools module for Phorum 5.1+
July 15, 2006 09:39AM
Yea I had it working the other day to only strip actual smileys, it may still. Also what type of error checking do you have, I modified the checking in the check_integrity to make a few extra checks, one of them checks for single or double smileys.

} else {
foreach($PHORUM["mod_smileys"]["smileys"] as $id => $smiley2) {
$new = split("\\.", $smiley2["smiley"]);$newer = $new[0];
$smiley3 = "(" . $new[0] . ")";
preg_match_all("/\($newer/", $message["subject"], $out);
if($message["subject"] == $smiley3) {
$error = "Please don't use a lone subject smiley.";
}elseif(count($out[0]) > 1){
$error = "Please use only one subject smiley.";
}
}
}

Not perfect, but there she be. Of course if you went the checkbox route where only one could be selected that would be useless :p. Mostly I enjoy breaking and analyzing the phorum code just so I understand it better, I'm getting there but still far from knowing it all yet.



Edited 1 time(s). Last edit at 07/15/2006 09:54AM by sirgrim.
Re: New editor tools module for Phorum 5.1+
July 15, 2006 01:38PM
Tried out the new version, everything worked alright. The headline definately needs some work, can chain them together forever it should overwrite or change the current one, if you want the javascript from mine for that it should be easily modified in your add_tags, but the clickable single would sure be nice.

All the others worked fine, the smileys isn't quite as nice since I use a lot of smileys and big pictures, but the other ones were pretty cool. I can throw it back up if you want to test it somewhere else but I'm gonna stick with my current setup for now.
Re: New editor tools module for Phorum 5.1+
July 15, 2006 02:25PM
It chains the smileys forever, because that is what it's supposed to do. There's no rule saying that the default behaviour of smileys in subjects is that only one smiley can be used and that it always is at the start of the line. Like I said, the thing you call headline smiley is not what the editor tools are about. So what my smiley button does is insert a smiley at the current cursor position. But no worries, I'll hack up an addon module for these editor tools to accomplish headline smiley-like behaviour.

I can see how your smileys would give problems, since you don't have smileys, but a complete photo-album in there instead ;-) To support something like that, a popup window isn't enough anymore. But the good news is that the editor tools are pretty flexible. A module could change the behaviour of the smiley button to show a custom method for selecting smileys.

If I come up with some addon modules that address the kind of things you run into, I'll post them in this thread.

BTW: if you rename the editor_tools module that you have now (rename the directory and editor_tools.php) you could even run things together. The new editor_tools module has a module settings screen, where you can disable the smileys support completely. Then you can still enjoy the BBcode tools if you like them.


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

Click here to login