Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Adding Personal Dictionary to FCKeditor and Aspell

New Here ,
May 30, 2009 May 30, 2009

Has anyone successfully added a Personal Dictionary to Aspell and the FCKeditor.

I have a customer with a lot of Jargon and Customer names which bogs down the Spell Check process.

Accordig to the ASpell.net website it should be possible using the "extra-dicts" option.

ie: -H --add-extra-dicts=aspell.en_US.pws

From what I can tell it should be added to the following file at line 16

C:\Inetpub\wwwroot\CFIDE\scripts\ajax\FCKeditor\editor\dialog\fck_spellerpages\spellerpages\server-scripts\spellchecker.cfm

Default:

<cfset aspell_opts  = "-a --lang=#lang# --encoding=utf-8 -H --rem-sgml-check=alt">

I have tried:

<cfset aspell_opts  = "-a --lang=#lang# --encoding=utf-8 -H --add-extra-dicts=aspell.en_US.pws">

<cfset aspell_opts  = "-a --lang=#lang# --encoding=utf-8 -H --rem-sgml-check=alt  -H --add-extra-dicts=aspell.en_US.pws">

Both result in mispelled words not being flagged

1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 01, 2009 Jun 01, 2009

Here is my partial solution to the problem.

Aspell can write a Personal Word file to store customer words.

The default location/File name is: C:\Program Files\Aspell\en.pws

If the file doesn't exist it is a simple text document (the first line is required)

personal_ws-1.1 en 3
yourword1

yourword2

The simple solution to adding custom words is:

1. Duplicate controls.html and rename controls.cfm
2. Change spellchecker.html line 69 to: <frame src="controls.cfm">
3. In the head of controls.cfm add:

<cfif IsDefined("AddWord")>
     <cffile action = "append" file = "C:\Program Files\Aspell\en.pws" output = "#misword#">
</cfif>

4. Add to the table of controls.cfm where the submit button are

<input class="buttonDefault" type="submit" name="AddWord" value="Add Word" />
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 01, 2009 Jun 01, 2009
LATEST

These are some added features I added to solve a largest concerns about the simple solution, namely because the en.pws is accessed by anyone using the Aspell program any bad speller using the program the potential for a massive personal wordlist with all kinds of words that shouldn't be in it.

Verify before adding

1. To mitigate against the inadvertent adding of words in the header add:

<script LANGUAGE="JavaScript">
    function confirmSubmit()
    {
    var agree=confirm("Are you sure you wish to Add this Word?");
    if (agree)
        return true ;
    else
        return false ;
    }
</script>

2. Change the input button to:

<input class="buttonDefault" type="submit" name="AddWord" onClick="return confirmSubmit()" value="Add Word" />


Check for Valid Domain

This isn't my preferred solution to the problem of how to limit who can add words to the dictionary but it does work.

1. Create a database that contains domains that can add words. The names in the db need to match the cgi.SERVER_NAME

2. Create a cfml file called spelldomains.cfm and write something similar to:

    <cfquery name="GetSpellDomains" datasource="sb03">
        SELECT    domain
        FROM    spelldomains
        WHERE    domain = '#cgi.SERVER_NAME#'
    </cfquery>
    <cfset request.showaddword = GetSpellDomains.RecordCount>


3. In the head of the controls.cfm file write:

     <cfparam name="request.showaddword" default="0">
     <cfinclude template="spelldomains.cfm">


4. Change the submit button to:

<cfif Val(request.showaddword)>
   <input class="buttonDefault" type="submit" name="AddWord" onClick="return confirmSubmit()" value="Add Word" />
<cfelse>
     
</cfif>


My Preferred solution to the permission problem (if some CF genius want to provide the answer)

I would rather enter a variable when the FCKeditor is called from the <cftextarea> tag that would toggle the Add Word option.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources