PDA

View Full Version : Solved Error in editor



moman
13-04-10, 22:19
For users who have a foreign language enabled, the PM and visitor message editors vanish when the editor_toolbar_end hook to add the language radio options is enabled. This was not the case previously in 3.3.0- can you please look into this?

For regular posts, the radio buttons don't appear at all.

I've temporarily disabled this hook so that people can post.

vBET
14-04-10, 01:21
I just checked booth PM and visitor messages (fast and advanced) on our forum and it works. Maybe I checked in wrong place. Can you please tell do you see same issue on this forum?

If yes then please give exact URL to page with error and tell what are your User settings.

If not then please:
1. Tell which vB version you are using
2. Check do you have changed templates for those editors. If yes - please check does issue exist after reversing changes (please make backup of actual template content, so you will be able to put it back).
3. Please send us exact content of your templates for those editors which disappears.

moman
14-04-10, 06:02
3.8.5. Reverting the template did nothing (though you'd think it would). Perhaps another plugin is causing this, although it shouldn't and worst case we can hard-code a workaround.

The problematic function is vbet_editor_toolbar_end, FYI.

My template code for editor_toolbar_on is:


$vBeditTemplate[clientscript]
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td id="$editorid" class="vBulletin_editor" width="100%">
<div id="{$editorid}_controls" class="controlbar">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td><div class="imagebutton" id="{$editorid}_cmd_removeformat"><img src="$stylevar[imgdir_editor]/removeformat.gif" width="21" height="20" alt="$vbphrase[remove_text_formatting]" /></div></td>
<if condition="$show['font_bbcode'] OR $show['size_bbcode']">
<td><img src="$stylevar[imgdir_editor]/separator.gif" width="6" height="20" alt="" /></td>
</if>
<if condition="$show['font_bbcode']">
<td><div class="imagebutton" id="{$editorid}_popup_fontname" title="$vbphrase[fonts]">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="popup_feedback"><div id="{$editorid}_font_out" style="width:91px">&nbsp;</div></td>
<td class="popup_pickbutton"><img src="$stylevar[imgdir_editor]/menupop.gif" width="11" height="16" alt="" /></td>
</tr>
</table>
</div></td>
</if>
<if condition="$show['size_bbcode']">
<td><div class="imagebutton" id="{$editorid}_popup_fontsize" title="$vbphrase[sizes]">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="popup_feedback"><div id="{$editorid}_size_out" style="width:25px">&nbsp;</div></td>
<td class="popup_pickbutton"><img src="$stylevar[imgdir_editor]/menupop.gif" width="11" height="16" alt="" /></td>
</tr>
</table>
</div></td>
</if>
<if condition="$show['color_bbcode']">
<td><img src="$stylevar[imgdir_editor]/separator.gif" width="6" height="20" alt="" /></td>
<td><div class="imagebutton" id="{$editorid}_popup_forecolor" title="$vbphrase[colors]">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td id="{$editorid}_color_out"><img src="$stylevar[imgdir_editor]/color.gif" width="21" height="16" alt="" /><br /><img src="$vboptions[cleargifurl]" id="{$editorid}_color_bar" alt="" style="background-color:black" width="21" height="4" /></td>
<td class="alt_pickbutton"><img src="$stylevar[imgdir_editor]/menupop.gif" width="11" height="16" alt="" /></td>
</tr>
</table>
</div></td>
</if>
<if condition="$show['wysiwygsmilies']">
<td><img src="$stylevar[imgdir_editor]/separator.gif" width="6" height="20" alt="" /></td>
<td><div class="imagebutton" id="{$editorid}_popup_smilie" title="$vbphrase[smilies]">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td><img src="$stylevar[imgdir_editor]/smilie.gif" alt="" width="21" height="20" /></td>
<td class="alt_pickbutton"><img src="$stylevar[imgdir_editor]/menupop.gif" width="11" height="16" alt="" /></td>
</tr>
</table>
</div></td>
</if>
<if condition="$show['attach']">
<td><div class="imagebutton" id="{$editorid}_popup_attach" title="$vbphrase[attachments]">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td><img src="$stylevar[imgdir_editor]/attach.gif" alt="" width="21" height="20" /></td>
<td class="alt_pickbutton"><img src="$stylevar[imgdir_editor]/menupop.gif" width="11" height="16" alt="" /></td>
</tr>
</table>
</div></td>
</if>
<!--
<td><img src="$stylevar[imgdir_editor]/separator.gif" width="6" height="20" alt="" /></td>
<td><div class="imagebutton" id="{$editorid}_cmd_cut"><img src="$stylevar[imgdir_editor]/cut.gif" width="21" height="20" alt="$vbphrase[cut]" /></div></td>
<td><div class="imagebutton" id="{$editorid}_cmd_copy"><img src="$stylevar[imgdir_editor]/copy.gif" width="21" height="20" alt="$vbphrase[copy]" /></div></td>
<td><div class="imagebutton" id="{$editorid}_cmd_paste"><img src="$stylevar[imgdir_editor]/paste.gif" width="21" height="20" alt="$vbphrase[paste]" /></div></td>
-->

<td><img src="$stylevar[imgdir_editor]/separator.gif" width="6" height="20" alt="" /></td>
<td><div class="imagebutton" id="{$editorid}_cmd_undo"><img src="$stylevar[imgdir_editor]/undo.gif" width="21" height="20" alt="$vbphrase[undo]" /></div></td>
<td><div class="imagebutton" id="{$editorid}_cmd_redo"><img src="$stylevar[imgdir_editor]/redo.gif" width="21" height="20" alt="$vbphrase[redo]" /></div></td>

<td width="100%">&nbsp;</td>
<if condition="is_browser('ie') AND !is_browser('mac')">
<td><div class="imagebutton" id="{$editorid}_cmd_spelling"><img src="$stylevar[imgdir_editor]/spelling.gif" width="21" height="20" alt="$vbphrase[check_spelling]" /></div></td>
</if>
<td>
<div class="imagebutton" id="{$editorid}_cmd_resize_0_100"><img src="$stylevar[imgdir_editor]/resize_0.gif" width="21" height="9" alt="$vbphrase[decrease_size]" /></div>
<div class="imagebutton" id="{$editorid}_cmd_resize_1_100"><img src="$stylevar[imgdir_editor]/resize_1.gif" width="21" height="9" alt="$vbphrase[increase_size]" /></div>
</td>
<if condition="$show['wysiwyg_compatible']">
<td><div class="imagebutton" id="{$editorid}_cmd_switchmode"><img src="$stylevar[imgdir_editor]/switchmode.gif" width="21" height="20" alt="$vbphrase[switch_editor_mode]" /></div></td>
</if>
</tr>
</table>

<if condition="!$show['basicbbcodeonly']">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<if condition="$show['basic_bbcode']">
<td><div class="imagebutton" id="{$editorid}_cmd_bold"><img src="$stylevar[imgdir_editor]/bold.gif" width="21" height="20" alt="$vbphrase[bold]" /></div></td>
<td><div class="imagebutton" id="{$editorid}_cmd_italic"><img src="$stylevar[imgdir_editor]/italic.gif" width="21" height="20" alt="$vbphrase[italic]" /></div></td>
<td><div class="imagebutton" id="{$editorid}_cmd_underline"><img src="$stylevar[imgdir_editor]/underline.gif" width="21" height="20" alt="$vbphrase[underline]" /></div></td>
</if>
<if condition="$show['align_bbcode']">
<td><img src="$stylevar[imgdir_editor]/separator.gif" width="6" height="20" alt="" /></td>
<if condition="$stylevar['textdirection'] == 'ltr'">
<td><div class="imagebutton" id="{$editorid}_cmd_justifyleft"><img src="$stylevar[imgdir_editor]/justifyleft.gif" width="21" height="20" alt="$vbphrase[align_left]" /></div></td>
<td><div class="imagebutton" id="{$editorid}_cmd_justifycenter"><img src="$stylevar[imgdir_editor]/justifycenter.gif" width="21" height="20" alt="$vbphrase[align_center]" /></div></td>
<td><div class="imagebutton" id="{$editorid}_cmd_justifyright"><img src="$stylevar[imgdir_editor]/justifyright.gif" width="21" height="20" alt="$vbphrase[align_right]" /></div></td>
<else />
<td><div class="imagebutton" id="{$editorid}_cmd_justifyright"><img src="$stylevar[imgdir_editor]/justifyright.gif" width="21" height="20" alt="$vbphrase[align_right]" /></div></td>
<td><div class="imagebutton" id="{$editorid}_cmd_justifycenter"><img src="$stylevar[imgdir_editor]/justifycenter.gif" width="21" height="20" alt="$vbphrase[align_center]" /></div></td>
<td><div class="imagebutton" id="{$editorid}_cmd_justifyleft"><img src="$stylevar[imgdir_editor]/justifyleft.gif" width="21" height="20" alt="$vbphrase[align_left]" /></div></td>
</if>
</if>
<if condition="$show['align_bbcode'] OR $show['list_bbcode']">
<td><img src="$stylevar[imgdir_editor]/separator.gif" width="6" height="20" alt="" /></td>
</if>
<if condition="$show['list_bbcode']">
<td><div class="imagebutton" id="{$editorid}_cmd_insertorderedlist"><img src="$stylevar[imgdir_editor]/insertorderedlist.gif" width="21" height="20" alt="$vbphrase[ordered_list]" /></div></td>
<td><div class="imagebutton" id="{$editorid}_cmd_insertunorderedlist"><img src="$stylevar[imgdir_editor]/insertunorderedlist.gif" width="21" height="20" alt="$vbphrase[unordered_list]" /></div></td>
</if>
<if condition="$show['align_bbcode'] OR $show['list_bbcode']">
<if condition="$stylevar['textdirection'] == 'ltr'">
<td><div class="imagebutton" id="{$editorid}_cmd_outdent"><img src="$stylevar[imgdir_editor]/outdent.gif" width="21" height="20" alt="$vbphrase[decrease_indent]" /></div></td>
<td><div class="imagebutton" id="{$editorid}_cmd_indent"><img src="$stylevar[imgdir_editor]/indent.gif" width="21" height="20" alt="$vbphrase[increase_indent]" /></div></td>
<else />
<td><div class="imagebutton" id="{$editorid}_cmd_outdent"><img src="$stylevar[imgdir_editor]/indent.gif" width="21" height="20" alt="$vbphrase[decrease_indent]" /></div></td>
<td><div class="imagebutton" id="{$editorid}_cmd_indent"><img src="$stylevar[imgdir_editor]/outdent.gif" width="21" height="20" alt="$vbphrase[increase_indent]" /></div></td>
</if>
</if>

....truncated

vBET
14-04-10, 23:20
I found nothing wrong in template which you gave.

Please PM access details to Admin CP and FTP - we will check and correct it on place.

EDIT:
Also I just updated this forum to vB3.8.5 - still cannot find the issue here. Please give us exact links to pages on our forum here on yours the issue exists. We will check which templates exactly are used to generate those editors and maybe it help fixing issue without access to your forum.

moman
15-04-10, 02:16
OK-

Please login as testuser, password is test. Default language for that user is Danish.

Then, go to this page: PentaxForums.com - Se Profil: testuser (http://www.pentaxforums.com/forums/da/members/testuser.html)
or: PentaxForums.com (http://www.pentaxforums.com/forums/private.php?do=newpm)

Note that it is impossible to send a PM or post VM :)

vBET
15-04-10, 02:45
OK. On member page is used template: showthread_quickreply for editor; on new PM: editor_toolbar_on.

You already shown editor_toolbar_on and I found no issue there...

As I understand you cannot send VM or PM because editors are not generated. You already confirmed that reversing your editor_toolbar_on to original one gives you no results. Please made same check for showthread_quickreply and PM me access details anyway - I will have to go there and find why it broke and how to fix it.
If you suspect conflict with some other mod - please disable this mod temporarily and check does it help. If you have no clue then just disable other plugins for editor_toolbar_end hook. If it will help - determine which plugin exactly causes the conflict and let me know.

If you will not handle it - let me in there.

moman
15-04-10, 04:34
Hi Michal,

This seemed very strange, so I ruled out plugin conflicts and went straight to the PHP file.

I worked the code a little bit and found the following solution. Perhaps this is something only affecting my site, but it seems that as soon as single quotes were introduced (\') in the html, the editor broke. Thus, I changed all the single quotes to double quotes, and everything worked. In addition, I had to remove $vbphrase['vbenterprisetranslator_postin_noselection'] and replace it with the string 'English'. See code change below in vbenterprisetranslator_functions_hooks.php:

FIND:


function vbet_editor_toolbar_end(&$editor_template_name) {
if (!$vbulletin->templatecache["$editor_template_name"]) {
fetch_template("$editor_template_name");
}
$toReplace = '<div id=\"$editorid';
if (false === strpos($vbulletin->templatecache["$editor_template_name"], $toReplace)) {
$toReplace = '<div id=\"{$editorid';
}
require_once(DIR. '/includes/vbenterprisetranslator_functions_utils.php');
global $vbphrase, $vbulletin, $stylevar;
$additionalScript = '<div class=\'smallfont\' style=\'text-align:left;\'>'
.$vbphrase['vbenterprisetranslator_postin']
.'&nbsp;<label for=\'vbet_addbbcodes\'><input id=\'vbet_addbbcodes\' type=\'radio\' name=\'vbet_postInLanguage\' value=\''
.$vbulletin->userinfo['vbet_def_lang'].'\' checked>'
.'<img src=\'images/vbet/flags/'
.$vbulletin->userinfo['vbet_def_lang'].'.gif\' alt=\'$name\' border=\'0\'/>'
.$vbphrase['vbenterprisetranslator_flag_'.strtr($vbulletin->userinfo['vbet_def_lang'], '-', '_')]
.'</label>&nbsp;&nbsp;&nbsp;<label for=\'vbet_nobbcodes\'><input id=\'vbet_nobbcodes\' type=\'radio\' name=\'vbet_postInLanguage\' value=\'0\'>'
.$vbphrase['vbenterprisetranslator_postin_noselection']
.'</label></div>'.$toReplace;
$vbulletin->templatecache[$editor_template_name] =& vbet_replaceFirst($toReplace, $additionalScript, $vbulletin->templatecache["$editor_template_name"]);
}

REPLACE:


function vbet_editor_toolbar_end(&$editor_template_name) {
if (!$vbulletin->templatecache["$editor_template_name"]) {
fetch_template("$editor_template_name");
}
$toReplace = '<div id=\"{$editorid';
require_once(DIR. '/includes/vbenterprisetranslator_functions_utils.php');
global $vbphrase, $vbulletin, $stylevar;
$additionalScript = '<div class=\"smallfont\" style=\"text-align:left;\">'
.$vbphrase['vbenterprisetranslator_postin']
.'&nbsp;<label for=\"vbet_addbbcodes\"><input id=\"vbet_addbbcodes\" type=\"radio\" name=\"vbet_postInLanguage\" value=\"'
.$vbulletin->userinfo['vbet_def_lang'].'\" checked>'
.'<img src=\"images/vbet/flags/'
.$vbulletin->userinfo['vbet_def_lang'].'.gif\" alt=\"$name\" border=\"0\"/>'
.$vbphrase['vbenterprisetranslator_flag_'.strtr($vbulletin->userinfo['vbet_def_lang'], '-', '_')]
.'</label>&nbsp;&nbsp;&nbsp;<label for=\"vbet_nobbcodes\"><input id=\"vbet_nobbcodes\" type=\"radio\" name=\"vbet_postInLanguage\" value=\"0\">'
. 'English</label></div>'
. $toReplace;
$vbulletin->templatecache[$editor_template_name] = vbet_replaceFirst($toReplace, $additionalScript, $vbulletin->templatecache[$editor_template_name]);
}

I also got rid of the strpos call to save resources, as the hard-coded version seems to work ;)

vBET
16-04-10, 02:41
Hi. Glad you fond solution. We will test it on our forums and if it will works this will be included in next release. For now you are only one who have this issue (can be some conflict with other mod), but solutions working for all are the best ;)

PLEASE NOTE: this strpos is NECESSARY. Unfortunately in vB3.x different editors templates have different code to mark editor place. Some are using <div id="$editorid' and some are using <div id="{$editorid'. You can easily check it - just make template search. If you remove if clause with strpos then for some editors default language radio buttons will not be shown. Please be aware of that.

Also if you changed ' to ", then most probably you do not need \", and it is enough to have just ". We didn't checked it yet, so make copy if you want to check it before our tests.

moman
16-04-10, 09:19
Thanks for the note! I've now put the strpos back in.

moman
16-04-10, 09:29
On my installation, any occurrence of " instead of \" immediately breaks the editor (though you're right- since the strings are now in single quotes, you wouldn't think the backslashes would be necessary).

vBET
16-04-10, 17:13
On my installation, any occurrence of " instead of \" immediately breaks the editor (though you're right- since the strings are now in single quotes, you wouldn't think the backslashes would be necessary).

Not for PHP but it appears that for template yes :) We have to remember that it is not clean PHP code, but it is injected into template body. As I wrote - it was not tested, only a thing what could be even better, which appears not ;)

Still we will test on our servers \" solution and if working will be included in next official release, so you will not have to worry about it during updates :)

vBET
03-05-10, 22:32
Tested and confirmed working on our side - this will be included in next release :)

AfrikaansAlbanianArabicBelarusianBulgarianCatalanChineseCroatianCzechDanishDutchEnglishEstonianFilipinoFinnishFrenchGalicianGermanGreekHaitian CreoleHebrewHindiHungarianIcelandicIndonesianIrishItalianJapaneseKoreanLatvianLithuanianMacedonianMalayMalteseNorwegianPersianPolishPortugueseRomanianRussianSerbianSlovakSlovenianSpanishSwahiliSwedishTaiwaneseThaiTurkishUkrainianVietnameseWelshYiddish
Languages translations delivered by vBET 4.10.1