TinyMCE and UIEForum
LasseP - May 28, 2007 - 11:57
| Project: | UIE Forum |
| Version: | 5.x-1.x-dev |
| Component: | User interface |
| Category: | support request |
| Priority: | normal |
| Assigned: | zoro |
| Status: | postponed |
Jump to:
Description
Hi,
maybe I'm just blind. But is it possible to use the TinyMCE Module (5.x-1.x-dev) with UIEForum (5.x-1.x-dev)?

#1
You're not blind - nope, you can't use anything other than the default entry fields that come with UIEForum :)
In order to use TinyMCE the module will have to be ported over to use the node system for data storage, whereas at the moment its completely separate
#2
Ah, ok.
But it can be activated, when the visibilty of the TinyMCE Modul is adjusted.
I see it for the PostText textarea. But the HTML Code isn't displayed correctly.
Are you stripping HTML Text or something like that?
#3
The UIEForum module uses its own input text handler - it parses its own text its own way :)
It's completely separate at the moment I'm afraid :(
#4
The problem seems to be the filter_xss().
TinyMCE works for the field. The data is saved correctly in the database.
If you disable all filters in uieforum_filter it works. But that can't be a solution.
I then added a field to the administrative form for UIEForum, that sets a variable uieforum_use_tinymce and tried to exclude the check_plain filter. That didn't work so i tried to disable filter_xss() and that worked. But that can't be a solution either.
The question is, why does this filter remove every tag. Even if it's an allowed tag.
But that's another story and not a UIEForum problem. Or did i miss something?
#5
Yeah I'm aware of what's causing the problems, and they all filter down to the fact that I'm not using the node system.
I'll have to find a way around this particular problem though :)
#6
Ok, I found a solution that fits my needs (just for testing purpose ;) )
I did the following:
uieforum.module
I added 2 form elements
$output["Performance Options"]['uieforum_use_tinymce'] = array('#type' => 'checkbox',
'#title' => 'Enable TinyMCE',
'#return_value' => 1,
'#default_value' => variable_get('uieforum_use_smilies', 1),
);
$output["Performance Options"]['uieforum_allowHTML'] = array(
'#type' => 'textfield',
'#title' => t('Allowed HTML tags'),
'#size' => 50,
'#maxsize' => 150,
'#default_value' => variable_get('uieforum_allowHTML', 'a, em, strong, cite, code, ul, ol, li, dl, dt, dd, u, i' ),
'#description' => t('Allowed HTML as comma seperated (i.e. "a, em, strong, cite, code, ul, ol, li, dl, dt, dd, u, i")'),
);
And changed this line:
$text = filter_xss($text);to
$text = filter_xss($text, explode(", ", variable_get('uieforum_allowHTML', 'a, em, strong, cite, code, ul, ol, li, dl, dt, dd, u, i')));Now i can edit the allowed HTML tags in the forum configuration so that all of the possible tinyMCE tags that are allowed are displayed in the forum.
It works for me. Maybe for a few other too.
#7
Oh, sorry. Forgot a line.
Also comment out:
$text = check_plain($text);or check if tinyMCE is enabled like I do
if(!variable_get('uieforum_use_tinymce'))$text = check_plain($text);
#8
Nice fix - but its completely specific to TinyMCE - what about any of the other editors out there? ;)
#9
No it isn't.
Just change the name of the variable (This variable is only to switch of check_plain() ) or leave it away and comment out check_plain().
Install the Editor Module you want for drupal, make it available for the forum, and set the allowed HTML Tags in the new Text field.
It doesn't depend on tinyMCE. In fact, another editor isn't needed at all.
The textfield for allowed HTML stands for itself. It just tells filter_xss() wich HTML tags are allowed, and wich are not. No matter how they've been entered in the textfield.
The Editor only adds the possibility, to add the tags automaticly and in a nice WYISWYIG-Style.
#10
First - thanks for writing such an excellent forum module
Second - thanks for posting this modification to allow TinyMCE to be used
I did uncover one issue with this solution - on the modification
if(!variable_get('uieforum_use_tinymce'))$text = check_plain($text);
the variable_get function was throwing errors for me since it requires a second argument, $default. I edited mine to say:
if(!variable_get('uieforum_use_tinymce', 0))$text = check_plain($text);
to default the TinyMCE support to off if no value for that variable is set. Hope this helps someone.
#11
any updates on this issue? We've just installed UIEForum in the hopes that it will provide some better access control, but one of the things people are used to is the TinyMCE editor, so it's kind of a dealbreaker.
Are there any plans to submit a formal patch using the combined code above or is the author planning on a different approach?
Thanks!
brian
#12
double post, sorry.
#13
I tried it and it kind of works.... For some reason the "Enable TinyMCE" checkbox doesn't want to remain checked. When I go in and check it and then leave it TinyMCE works; however, when I go back to check the option it is unchecked and TinyMCE doesn't work anymore (and all my text is converted in plain_text).
Also, I am only able to use the BBCode that was originally installed with this forum (i.e., bold, italic, link, left, right, center). I can't use other TinyMCE options because it won't let me (just shows as plaintext).
Could someone offer some help, please? Perhaps the above code is flawed? I don't know enough to say if that is the case.
#14
Well, this sort of fell by the wayside ....
LasseP - thanks for your code suggestion. I don't know what the hell was going through my mind before, but its actually not a bad solution at all at all. Sorry about that!
I'll have a gander at the code when I get home and look into adding this solution to the real code-base
Cronin - so long as you applied the original suggested code, along with the updated bug-fix it looks like it should work!
#15
I think the textarea is ok without TinyMCE but the javascript popup doesn't looks friendly.
Banana Tools
#16
Hi, in the latest version TinyMCE does work. Perhaps, this is because you've switched to using drupal theme() function and drupal form mecahnis.
UUUPS... I forgot that I have hacked the code so as it uses the standard Drupal filter functions.
#17
What did you "hack"? It may be useful for others to know!
#18
I have done the following. Please, note, that this disables BB code. A couple of nuances:
1) it enables the default format
2) however, you should manually check all filters on the settings page that are used in the default format. this could be hacked better, but I am lazy to fix it properly (good enough for me now)
--- functions.inc.php 2008-02-25 06:05:02.000000000 +0300
+++ /home/leo/DrupalMisc/uieforum/functions.inc.php 2008-01-10 03:49:56.000000000 +0300
@@ -1131,8 +1131,8 @@
$fname = "{$module}_filter";
- $text = $fname('prepare', $delta, variable_get('filter_default_format', 1), $text); // LB: to default
- $text = $fname('process', $delta, variable_get('filter_default_format', 1), $text); // LB: to default
+ $text = $fname('prepare', $delta, -1, $text);
+ $text = $fname('process', $delta, -1, $text);
}
}
return $text;
@@ -1167,7 +1167,7 @@
$post_header [0]['colspan'] = '2';
$post_header [0]['data'] = uieforum_filter('process', null, null, $PostTitle, true);
// $post_content[0]['data'] .= uieforum_filter('process', null, null, $PostText, true);
- $post_content[0]['data'] .= uieforum_apply_filters( uieforum_filter('process', null, null, $PostText, false) ); // LB:
+ $post_content[0]['data'] .= uieforum_apply_filters( uieforum_filter('process', null, null, $PostText, true) );
$post_content[0]['colspan'] = 2;
}
else
@@ -1238,7 +1238,7 @@
if (strlen($PostTitle) > 0)
$post_content[1]['data'] .= "<div class='uieforum_postsubject'>".uieforum_filter('process', null, null, $PostTitle, true)."</div>";
// $post_content[1]['data'] .= "<div class='uieforum_postcontent'>".uieforum_filter('process', null, null, $PostText, true)."</div>";
- $post_content[1]['data'] .= "<div class='uieforum_postcontent'>".uieforum_apply_filters( uieforum_filter('process', null, null, $PostText, false) )."</div>"; // LB:
+ $post_content[1]['data'] .= "<div class='uieforum_postcontent'>".uieforum_apply_filters( uieforum_filter('process', null, null, $PostText, true) )."</div>";
$post_content[1]['data'] .= "<br/><br/>";
if(!$guest_user && ($show_sigs && $sig))
$post_content[1]['data'] .= "<div class=\"signature\">__________________<br/>".uieforum_filter('process', null, null,
$sig)."</div>";
#19
It be helpful to know that I'm rewriting how the module uses the form api, so that it uses it correctly :)
Hopefully this won't be a problem with the next release!
#20
Hi,
And how about using the node system in the next release. The Drupal nodesystem has so much advantages :)
Subscribing..still not knowing which forum system to choose. Working myself on nodeforum, but it needs more functionality then the regular Drupal forum system.
greetings,
Martijn
#21
Yeah I'm tempted to move over to nodes in this release too - believe me.
I've literally only just finished an absolutely massive code overhaul to use drupal's form api to its full extent, but I'm wondering if it would be easier to start from scratch again :)
#22
Hi zoro,
I made a seperate issue on this node-system integration: http://drupal.org/node/236679
I am trying to get nodeforum working, which is as uieforum a seperate forum solution as replacement of the forum module.
The good thing is, it has fully node-system integration.
The bad thing is, it is not on drupal projects yet. I found it on cvs and somebody referred to it, because nodecomment and nodeforum are integrated solutions :)
greetings,
Martijn
#23
Node and comments are two different things.
At first, i thought having everything in nodes would be fine.
But you have to think about if you want a complete different solution or a solution the drupal-way.
zoro: i appreciate your work, but maybe you should take a look at "advanced forum".
There is still a lot of work to do, and maybe you can enhance the development process with your experience from your own development on UIEForum.
#24
Hi Lasse,
Yes node and comments are two different things, but when you use the nodecomment an nodeforum module (and enhance them), then you have best of both!! Comments as nodes and forumtopics as nodes!
greetings,
Martijn
#25
Postponing this, as it has to do with the eventual move over to nodes for this module
Daniel