Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsFCKeditorFCKeditorSpell Checker (speller pages) - Spell Checker (speller pages) -
Previous
 
Next
New Post
5/2/2007 10:10 AM
 

I find myself in need of a browser independent spell checker and have looked all over the net - while a few like aspspellchecker and jsspellchecker look good they cost and i had problems integrating them into the editor.

I finally settled on aspell - now I am trying to rebuild the php page it uses in a .net page

My offer is this if there are any php guys or gals around can you maybe give me a hand with some of the harder parts

TIA


Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
New Post
5/2/2007 12:05 PM
 

okay first hurdle getting asp.net to run the aspell cmd line stuff

i have this

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Dim myP As System.Diagnostics.Process = New System.Diagnostics.Process
            myP.StartInfo.RedirectStandardOutput = True
            myP = System.Diagnostics.Process.Start("C:\Program Files\Aspell\bin\aspell.exe", "-c ""c:\program files\aspell\readme""")
            Try
                Response.Write(myP.StandardOutput.ReadToEnd())
            Catch ex As Exception
                Response.Write(ex)
            End Try

End Sub

As my inital code - this is just testing that i can run the aspell and have it appear in my browser

I keep getting  (line 11 is the response.write line) - anybody know why I cant start or redirect the output?

System.InvalidOperationException: StandardOut has not been redirected or the process hasn't started yet. at System.Diagnostics.Process.get_StandardOutput() at Providers.FCKeditor.spellchecker.Page_Load(Object sender, EventArgs e) in D:\Webs\RCI_DNN\Providers\HtmlEditorProviders\FckHtmlEditorProvider\FCKeditor\editor\dialog\fck_spellerpages\spellerpages\server-scripts\spellchecker.aspx.vb:line 11   

 


Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
New Post
5/2/2007 2:01 PM
 

did you notice, that FCKEditor has integration for SpellerPages built in (see http://wiki.fckeditor.net/Developer%27s_Guide/Configuration/Spell_Checker)?


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
5/2/2007 2:13 PM
 

yes but two things stop that from working for me - 1 i cant run PHP on the server (boss wont let me) and two he wont let me install the aspell programe or whatever it is

Also this has been something i have seen people wanting a lot is something beside iespell that is easier than aspell to install i was thinking if i can get this netspell to work i would donate it to the fck provider -


Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
New Post
5/2/2007 4:57 PM
 

okay its kind of funky but I have an open example here

http://bq9000.rci-safety.com/EditorExamplewithSpellCheck/tabid/94/Default.aspx

so far i can get the speller.aspx to appear in the dialog and it seems to run but i am having a bit of trouble wring it to the text from the editor itself

code so far for the aspx page

'---------------------------------------------------------------------------------

<%@ Page Language="C#" ClassName="PopUpSpell" ValidateRequest="False" %>
<%@ import Namespace="System.IO" %>
<%@ import Namespace="NetSpell.SpellChecker" %>
<%@ import Namespace="NetSpell.SpellChecker.Dictionary" %>
<script runat="server">

    NetSpell.SpellChecker.Spelling SpellChecker;
    NetSpell.SpellChecker.Dictionary.WordDictionary WordDictionary;

    void Page_Load(object sender, EventArgs e)
    {
         // if modal frame, quit
         if (this.ModalFrame.Visible)
             return;

         // add client side events
         this.Suggestions.Attributes.Add("onChange", " changeWord(this);");
         this.SpellingBody.Attributes.Add("onLoad", " initialize();checkElementSpelling(oElement);");

         // load spell checker settings
         this.LoadValues();
         switch (this.SpellMode.Value)
         {
             case "start" :
                 this.EnableButtons();
                 this.SpellChecker.SpellCheck();
                 break;

             case "suggest" :
                 this.EnableButtons();
                 break;

             case "load" :
             case "end" :
             default :
                 this.DisableButtons();
                 break;
         }
    }

    void Page_Init(object sender, EventArgs e)
    {
         // show iframe for modal support
         if (Request.Params["Modal"] != null)
         {
             this.ModalFrame.Visible = true;
             this.SuggestionForm.Visible = false;
             return;
         }

         // get dictionary from cache
         this.WordDictionary = (WordDictionary)HttpContext.Current.Cache["WordDictionary"];
         if (this.WordDictionary == null)
         {
             // if not in cache, create new
             this.WordDictionary = new NetSpell.SpellChecker.Dictionary.WordDictionary();
             this.WordDictionary.EnableUserFile = false;

             //getting folder for dictionaries
             string folderName = ConfigurationSettings.AppSettings["DictionaryFolder"];

             folderName = this.MapPath(Path.Combine(Request.ApplicationPath, folderName));
             this.WordDictionary.DictionaryFolder = folderName;

             //load and initialize the dictionary
             this.WordDictionary.Initialize();

             // Store the Dictionary in cache
             HttpContext.Current.Cache.Insert("WordDictionary", this.WordDictionary, new CacheDependency(Path.Combine(folderName, this.WordDictionary.DictionaryFile)));
         }

         // create spell checker
         this.SpellChecker = new NetSpell.SpellChecker.Spelling();
         this.SpellChecker.ShowDialog = false;
         this.SpellChecker.Dictionary = this.WordDictionary;

         // adding events
         this.SpellChecker.MisspelledWord += new NetSpell.SpellChecker.Spelling.MisspelledWordEventHandler(this.SpellChecker_MisspelledWord);
         this.SpellChecker.EndOfText += new NetSpell.SpellChecker.Spelling.EndOfTextEventHandler(this.SpellChecker_EndOfText);
         this.SpellChecker.DoubledWord += new NetSpell.SpellChecker.Spelling.DoubledWordEventHandler(this.SpellChecker_DoubledWord);
    }

    void SpellChecker_DoubledWord(object sender, NetSpell.SpellChecker.SpellingEventArgs e)
    {
         this.SaveValues();
         this.CurrentWord.Text = this.SpellChecker.CurrentWord;
         this.Suggestions.Items.Clear();
         this.ReplacementWord.Text = string.Empty;
         this.SpellMode.Value = "suggest";
         this.StatusText.Text = string.Format("Word: {0} of {1}", this.SpellChecker.WordIndex + 1, this.SpellChecker.WordCount);
    }

    void SpellChecker_EndOfText(object sender, System.EventArgs e)
    {
         this.SaveValues();
         this.SpellMode.Value = "end";
         this.DisableButtons();
         this.StatusText.Text = string.Format("Word: {0} of {1}", this.SpellChecker.WordIndex + 1, this.SpellChecker.WordCount);
    }

    void SpellChecker_MisspelledWord(object sender, NetSpell.SpellChecker.SpellingEventArgs e)
    {
         this.SaveValues();
         this.CurrentWord.Text = this.SpellChecker.CurrentWord;
         this.SpellChecker.Suggest();
         this.Suggestions.DataSource = this.SpellChecker.Suggestions;
         this.Suggestions.DataBind();
         this.ReplacementWord.Text = string.Empty;
         this.SpellMode.Value = "suggest";
         this.StatusText.Text = string.Format("Word: {0} of {1}", this.SpellChecker.WordIndex + 1, this.SpellChecker.WordCount);
    }

    void EnableButtons()
    {
         this.IgnoreButton.Enabled = true;
         this.IgnoreAllButton.Enabled = true;
         this.AddButton.Enabled = true;
         this.ReplaceButton.Enabled = true;
         this.ReplaceAllButton.Enabled = true;
         this.ReplacementWord.Enabled = true;
         this.Suggestions.Enabled = true;
    }

    void DisableButtons()
    {
         this.IgnoreButton.Enabled = false;
         this.IgnoreAllButton.Enabled = false;
         this.AddButton.Enabled = false;
         this.ReplaceButton.Enabled = false;
         this.ReplaceAllButton.Enabled = false;
         this.ReplacementWord.Enabled = false;
         this.Suggestions.Enabled = false;
    }

    void SaveValues()
    {
         this.CurrentText.Value = this.SpellChecker.Text;
         this.WordIndex.Value = this.SpellChecker.WordIndex.ToString();

         // save ignore words
         string[] ignore = (string[])this.SpellChecker.IgnoreList.ToArray(typeof(string));

         this.IgnoreList.Value = String.Join("|", ignore);

         // save replace words
         ArrayList tempArray = new ArrayList(this.SpellChecker.ReplaceList.Keys);
         string[] replaceKey = (string[])tempArray.ToArray(typeof(string));

         this.ReplaceKeyList.Value = String.Join("|", replaceKey);
         tempArray = new ArrayList(this.SpellChecker.ReplaceList.Values);

         string[] replaceValue = (string[])tempArray.ToArray(typeof(string));

         this.ReplaceValueList.Value = String.Join("|", replaceValue);

         // saving user words
         tempArray = new ArrayList(this.SpellChecker.Dictionary.UserWords.Keys);

         string[] userWords = (string[])tempArray.ToArray(typeof(string));

         Response.Cookies["UserWords"].Value = String.Join("|", userWords);;
         Response.Cookies["UserWords"].Path = "/";
         Response.Cookies["UserWords"].Expires = DateTime.Now.AddMonths(1);
    }

    void LoadValues()
    {
         if (this.CurrentText.Value.Length > 0)
             this.SpellChecker.Text = this.CurrentText.Value;

         if (this.WordIndex.Value.Length > 0)
             this.SpellChecker.WordIndex = int.Parse(this.WordIndex.Value);

         // restore ignore list
         if (this.IgnoreList.Value.Length > 0)
         {
             this.SpellChecker.IgnoreList.Clear();
             this.SpellChecker.IgnoreList.AddRange(this.IgnoreList.Value.Split('|'));
         }

         // restore replace list
         if (this.ReplaceKeyList.Value.Length > 0 && this.ReplaceValueList.Value.Length > 0)
         {
             string[] replaceKeys = this.ReplaceKeyList.Value.Split('|');
             string[] replaceValues = this.ReplaceValueList.Value.Split('|');

             this.SpellChecker.ReplaceList.Clear();
             if (replaceKeys.Length == replaceValues.Length)
             {
                 for (int i = 0; i < replaceKeys.Length; i++)
                 {
                     if (replaceKeys[i].Length > 0)
                         this.SpellChecker.ReplaceList.Add(replaceKeys[i], replaceValues[i]);
                 }
             }
         }

         // restore user words
         this.SpellChecker.Dictionary.UserWords.Clear();
         if (Request.Cookies["UserWords"] != null)
         {
             string[] userWords = Request.Cookies["UserWords"].Value.Split('|');

             for (int i = 0; i < userWords.Length; i++)
             {
                 if (userWords[i].Length > 0)
                     this.SpellChecker.Dictionary.UserWords.Add(userWords[i], userWords[i]);
             }
         }
    }

    void IgnoreButton_Click(object sender, EventArgs e)
    {
         this.SpellChecker.IgnoreWord();
         this.SpellChecker.SpellCheck();
    }

    void IgnoreAllButton_Click(object sender, EventArgs e)
    {
         this.SpellChecker.IgnoreAllWord();
         this.SpellChecker.SpellCheck();
    }

    void AddButton_Click(object sender, EventArgs e)
    {
         this.SpellChecker.Dictionary.Add(this.SpellChecker.CurrentWord);
         this.SpellChecker.SpellCheck();
    }

    void ReplaceButton_Click(object sender, EventArgs e)
    {
         this.SpellChecker.ReplaceWord(this.ReplacementWord.Text);
         this.CurrentText.Value = this.SpellChecker.Text;
         this.SpellChecker.SpellCheck();
    }

    void ReplaceAllButton_Click(object sender, EventArgs e)
    {
         this.SpellChecker.ReplaceAllWord(this.ReplacementWord.Text);
         this.CurrentText.Value = this.SpellChecker.Text;
         this.SpellChecker.SpellCheck();
    }

</script>
<html>
<head>
    <title>Spell Check</title>
    <link href="spell.css" type="text/css" rel="stylesheet" />
    <script language="JavaScript" src="spell.js" type="text/javascript"></script>
<script type="text/javascript">

var oEditor = window.parent.InnerDialogLoaded() ;
var FCKLang = oEditor.FCKLang ;
var TextToCheck = oEditor.FCK.EditorDocument.body.innerHTML;
var oElement = oEditor.FCK.EditorDocument.body;
               
//window.onload = function()
//{

     //checkSpelling(oEditor.FCK.EditorDocument.body.innerHTML);
//}
</script>
</head>
<body id="SpellingBody" style="MARGIN: 0px" runat="server">
    <form id="SpellingForm" name="SpellingForm" method="post" runat="server">
        <input id="WordIndex" type="hidden" value="0" name="WordIndex" runat="server" />
        <input id="CurrentText" type="hidden" name="CurrentText" runat="server" />
        <input id="IgnoreList" type="hidden" name="IgnoreList" runat="server" />
        <input id="ReplaceKeyList" type="hidden" name="ReplaceKeyList" runat="server" />
        <input id="ReplaceValueList" type="hidden" name="ReplaceValueList" runat="server" />
        <input id="ElementIndex" type="hidden" value="-1" name="ElementIndex" runat="server" />
        <input id="SpellMode" type="hidden" value="load" name="SpellMode" runat="server" />
        <asp:panel id="ModalFrame" runat="server" visible="False" enableviewstate="False">
            <iframe id="SpellCheckFrame" hidefocus="hidefocus" name="SpellCheckFrame" src="SpellCheck.aspx" frameborder="0" width="100%" scrolling="no" height="100%" runat="server"></iframe>
        </asp:panel>
        <asp:panel id="SuggestionForm" runat="server" visible="true" enableviewstate="False">
            <table cellspacing="0" cellpadding="5" width="100%">
                <tbody>
                    <tr>
                        <td valign="center" align="middle">
                            <table cellspacing="0" cellpadding="2">
                                <tbody>
                                    <tr>
                                        <td style="WIDTH: 250px">
                                            <em>Word Not in Dictionary:</em>
                                        </td>
                                        <td>
                                            <asp:button id="IgnoreButton" onclick="IgnoreButton_Click" runat="server" enableviewstate="False" enabled="False" cssclass="button" text="Ignore"></asp:button>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:Label id="CurrentWord" runat="server" font-bold="True" forecolor="Red"></asp:Label></td>
                                        <td>
                                            <asp:button id="IgnoreAllButton" onclick="IgnoreAllButton_Click" runat="server" enableviewstate="False" enabled="False" cssclass="button" text="Ignore All"></asp:button>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <em>Change To:</em>
                                        </td>
                                        <td>
                                            <p>&nbsp;</p>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:textbox id="ReplacementWord" runat="server" enableviewstate="False" enabled="False" cssclass="suggestion" columns="30" width="230px"></asp:textbox>
                                        </td>
                                        <td>
                                            <asp:button id="AddButton" onclick="AddButton_Click" runat="server" enableviewstate="False" enabled="False" cssclass="button" text="Add"></asp:button>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <em>Suggestions:</em>
                                        </td>
                                        <td>
                                            <p>&nbsp;</p>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td rowspan="5">
                                            <asp:listbox id="Suggestions" runat="server" enableviewstate="False" enabled="False" cssclass="suggestion" width="230px" rows="8"></asp:listbox>
                                        </td>
                                        <td>
                                            <asp:button id="ReplaceButton" onclick="ReplaceButton_Click" runat="server" enableviewstate="False" enabled="False" cssclass="button" text="Replace"></asp:button>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:button id="ReplaceAllButton" onclick="ReplaceAllButton_Click" runat="server" enableviewstate="False" enabled="False" cssclass="button" text="Replace All"></asp:button>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <p>&nbsp;</p>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <p>&nbsp;</p>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            <asp:Label id="StatusText" runat="Server" forecolor="DimGray" font-size="8pt">Loading...</asp:Label>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </td>
                    </tr>
                </tbody>
            </table>
        </asp:panel>
    </form>
</body>
</html>

'--------------------------------------------------------------------------------------

heres the js so far

'--------------------------------------------------------------------------------------

/****************************************************
* Spell Checker Client JavaScript Code
****************************************************/
// spell checker constants
var spellURL = "SpellCheck.aspx";
var showComplete );
//else
//var newWindow = window.open(spellURL, "newWindow", "height=300,width=400,scrollbars=no,resizable=no,toolbars=no,status=no,menubar=no,location=no");
}


/****************************************************
* Spell Checker Suggestion Window JavaScript Code
****************************************************/
var iElementIndex = -1;
var parentWindow;

function initialize()
{
iElementIndex = parseInt(document.getElementById("ElementIndex").value);

if (parent.window.dialogArguments)
parentWindow = parent.window.dialogArguments;
else if (top.opener)
parentWindow = top.opener;

var spellMode = document.getElementById("SpellMode").value;

switch (spellMode)
{
case "start" :
//do nothing client side
break;
case "suggest" :
//update text from parent document
updateText();
//wait for input
break;
case "end" :
//update text from parent document
updateText();
//fall through to default
default :
//get text block from parent document
if(loadText())
document.SpellingForm.submit();
else
endCheck()

break;
}
}

function loadText()
{
if (!parentWindow.document)
return false;

// check if there is any text to spell check
for (++iElementIndex; iElementIndex < parentWindow.checkElements.length; iElementIndex++)
{
var newText = parentWindow.getText(iElementIndex);
if (newText.length > 0)
{
updateSettings(newText, 0, iElementIndex, "start");
document.getElementById("StatusText").innerText = "Spell Checking Text ...";
return true;
}
}

return false;
}

function updateSettings(currentText, wordIndex, elementIndex, mode)
{
document.getElementById("CurrentText").value = currentText;
document.getElementById("WordIndex").value = wordIndex;
document.getElementById("ElementIndex").value = elementIndex;
document.getElementById("SpellMode").value = mode;
}

function updateText()
{
if (!parentWindow.document)
return false;

var newText = document.getElementById("CurrentText").value;
parentWindow.setText(iElementIndex, newText);
}

function endCheck()
{
if (showCompleteAlert)
alert("Spell Check Complete");
// closeWindow();
}

function closeWindow()
{
if (top.opener || parent.window.dialogArguments)
self.close();
}

function changeWord(oElement)
{
var k = oElement.selectedIndex;
oElement.form.ReplacementWord.value = oElement.options[k].value;
}


Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsFCKeditorFCKeditorSpell Checker (speller pages) - Spell Checker (speller pages) -


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out