Monday, February 11, 2008

Installing the TinyMCE spellchecker in SugarCRM

I had to go through the exercise of installing and configuring the TinyMCE spellchecker in a SugarCRM 5.0 installation today, so I'm blogging it here for future reference and google karma.

Here's my exact scenario:

- OS: CentOS 4.4 32-bit
- SugarCRM version: SugarCE-Full-5.0.0a (under /var/www/html/SugarCRM)

I first downloaded the TinyMCE spellchecker plugin v. 1.0.5 by following the link from the TinyMCE download page.

I unzipped tinymce_spellchecker_php_1_0_5.zip and copied the resulting spellchecker directory under my SugarCRM installation (in my case under /var/www/html/SugarCRM/include/javascript/tiny_mce/plugins).

I edited spellchecker/config.php and specified:


require_once("classes/TinyPspellShell.class.php"); // Command line pspell
$spellCheckerConfig['enabled'] = true;


The command-line pspell uses the binary /usr/bin/aspell, which in my case was already installed, but YMMV. If you want the embedded PHP spellchecker, you need to recompile PHP with the pspell module.

The main configuration of the layout of TinyMCE happens in /var/www/html/SugarCRM/include/SugarTinyMCE.php. I chose to add the spellchecker button in the line containing the definition of buttonConfig3:

var $buttonConfig3 = "tablecontrols,spellchecker,separator,advhr,hr,removeformat,separator,insertdate,inserttime,separator,preview";

I also added the spellchecker plugin in the same file, in the line containing the plugins definitions inside the defaultConfig definition:

'plugins' => 'advhr,insertdatetime,table,preview,paste,searchreplace,directionality,spellchecker',

I restarted Apache, just to make sure all the include files are re-read (not sure if it was necessary, but better safe than sorry), and lo and behold, the spellcheck button was there when I went to the Compose Email form. After entering some misspelled text, I clicked the spellcheck button. I was then able to right click the misspelled words and was offered a list of words to choose from.

If it sounds painless, rest assured, it wasn't. The documentation helped a bit, but it was sufficiently different from what I was seeing that I had to do some serious forensics-type searches within the SugarCRM file hierarchy. But all is well that ends well.

4 comments:

maarten said...

Hey Grig,

thanks for that great post. Unfortunately it didn't work for me.

For some reason adding 'spellchecker' to a buttonconfig messes things up.
php is not compiled with aspell, so I have the plugin set to use the aspell binary as well, with the en language pack installed. This should just about mirror your setup. (though I'm using debian lenny)
I'm thinking it's because I'm using a newer version of sugar (Version 5.2.0 (Build 5380) ) but who knows.
Have you upgraded sugar, and if so is your tinymce spellchecker still functioning?

maarten said...

Actually, I just got it working. So there is confirmation the tinyMCE spellchecker version 1.0.5 works on sugar 5.2.0, on debian lenny with apache 2.2.9 and php 5.2.6.

My problem was silly oversight; forgot to change the permissions on the spellchecker folder, apache2 was simply unable to read it.

maarten said...

Actually, I just got it working. So there is confirmation the tinyMCE spellchecker version 1.0.5 works on sugar 5.2.0, on debian lenny with apache 2.2.9 and php 5.2.6.

My problem was silly oversight; forgot to change the permissions on the spellchecker folder, apache2 was simply unable to read it.

Anonymous said...

I tried to make this work on SugarCRM 6.2.2 but I can't. I followed all the directions to the letter but that spell check button just isn't showing up when composing new e-mail.