Hello Everyone,
This mod adds spell checking to the ticket screen. It is only for the staff but buttons could be added for other screens.
WARNING
I have not done extensive testing on this with OSTicket.
Server Requirements
You need aspell installed on the server with the correct language. People using OSTicket on a 3rd party host might have a problem getting this installed. Check with your hosting provider first.
I have attached a speller archive that contains the spell checking html and routines. I did not write these routines and just incorporated them into OSTicket. I installed the files into a speller directory under the website root so it can be used by any page in OSTicket. Mine is accessed by http://mydomain/speller(http://mydomain/speller)
There are some files in the speller directory that you might have change if your installation is not off the root of the website. Change the path to the correct logical location from the website.
speller/spellchecker.php
$spellercss = '/speller/spellerstyle.css';
$word_win_src = ‘/speller/wordwindow.js';
speller/spellChecker.js
this.popUpUrl = '/speller/spellchecker.html';
this.addWordsUrl = '/speller/addwords.php';
this.spellCheckScript = '/speller/spellchecker.php';
If you want the add word to work, you need to make aspell.personal in the speller directory writeable.
Source Code Changes
Changes to the header.inc.php file located in /include/staff directory. I put it in here so it is available to all the scripts.
Current Code
<?if($cfg && $cfg->getLockTime()) { //autoLocking enabled.?>
<script type="text/javascript" src="js/autolock.js" charset="utf-8"></script>
<?}?>
Add this code between the code above and below, change the script path if you need to
<script src="/speller/spellChecker.js"></script>
<script>
function openSpellChecker(checkwhat) {
var textarea1 = eval(checkwhat);
var speller = new spellChecker( textarea1 );
speller.openChecker();
}
</script>
Current Code
</head>
<body>
Now you need to add the spell check buttons to the forms by changing the code in viewticket.inc.php
Search for ‘Post Reply’ and add this button to the list of buttons. I put it under the cancel button.
<input class="button" type='button' value='Spell Check' onClick="openSpellChecker('document.reply.response');" />
Search for #notes which should be about 5 lines down. We need to change the name of the form from notes to notes1. The current code uses the same form name for the remaining forms on the page
Down about 20 lines there is another submit block for the Internal Notes tab. Add this button.
<input class="button" type='button' value='Spell Check' onClick="openSpellChecker('document.notes1.note');" />
Search for #transfer. Should just be a few lines down. We need to change the name of the form from notes to notes2. Down a few lines is another submit block for the Department Transfer tab. Add this button.
<input class="button" type='button' value='Spell Check' onClick="openSpellChecker('document.notes2.message');" />
Search for #assign. Should just be a few lines down. Change the name of the form from notes to notes3. Again, a few lines down is another submit block. Add this button.
<input class="button" type='button' value='Spell Check' onClick="openSpellChecker('document.notes3.assign_message');" />
That should be it. The tabs on the ticket response screen will now have the button Spell Check on all the tabs.
Adding this to other screens would be as easy as adding the button and changing the openSpellChecker argument to the textarea control you would like spell checked .
Let me know if you have any issues or comments. Also let me know other locations the spell checker button could go.
-John
[speller.zip](https://forum.osticket.com/assets/files/migrated/2/13487ffef4fd85ff9dd7479a7b0d23f.zip)