Re: Can you make a Preview post button and a spell check button?

Yes changed to

    $form = '<form name="spelling_mod" id="post" method="post" action="post.php?action=post&tid='.$tid.'" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">';

Re: Can you make a Preview post button and a spell check button?

Mmm, what's the URL to your site?

28 (edited by almost_there 2005-05-01 14:03)

Re: Can you make a Preview post button and a spell check button?

smile

29 (edited by Smartys 2005-05-01 13:46)

Re: Can you make a Preview post button and a spell check button?

This is what I see:

<form id="post" method="post" action="post.php?action=post&fid=1" onsubmit="return process_form(this)">

Did you save/upload the edited file?

Re: Can you make a Preview post button and a spell check button?

LOL...it works perfect for replies but not for posts.

31 (edited by Smartys 2005-05-01 13:57)

Re: Can you make a Preview post button and a spell check button?

Ah, there we go
Here's the fix
Find $form again and add the name in

Updated my second instructions post smile

Re: Can you make a Preview post button and a spell check button?

Thanks....it works great now smile

Re: Can you make a Preview post button and a spell check button?

Cool smile
Note of course that edit.php and viewtopic.php would have to be changed also if you want to add spell check to quick post and editing smile

Re: Can you make a Preview post button and a spell check button?

I am glad I got the ball rolling by suggesting phpSpell! And eternal thanks to Smartys for working out how to implement it.

Could someone put all this together and formally make it a mod? At the moment one has to read through all the posts in this thred to find all the stages.

35 (edited by Smartys 2005-05-01 20:45)

Re: Can you make a Preview post button and a spell check button?

OK, repost it is!

1. Download and unzip phpSpell.
2. Open common/spell_config.php

Comment the line that says 
$Spell_Config['DB_Type'] = 'PHPBB'; 
and add a line that says 
$Spell_Config['DB_Type'] = 'PunBB';

FIND

  if (isset($Spell_Config['DB_Type']) && $Spell_Config['DB_Type'] == 'MySQL') {
    include 'spell_MySQL.php';
  }

AFTER, ADD

  if (isset($Spell_Config['DB_Type']) && $Spell_Config['DB_Type'] == 'PunBB') {

    require '../config.php';
    $Spell_Config["DB_Username"] = $db_username;
    $Spell_Config["DB_Password"] = $db_password;
    $Spell_Config["DB_Database"] = $db_name;
    $Spell_Config["DB_Host"] = $db_host;
    // This is used in some others, but it looks like this is unset in the file: odd
    $table_prefix = $db_prefix;

    include 'spell_MySQL.php';
  }

3. Change any other settings and save.
4. Create a directory within your forum directory called spelling and upload all the files in the common & native_mysql directories to there
5. Go to http://www.yourwebsite.com/forum_direct … _admin.php
6. Install any dictionaries you want (you have to download them from the site in Step 1 and put them in the spelling folder first).
7. Delete any file ending with .dic on the server (to free up disk space)
8. Delete the spell_admin.php file off the server.
9. Open up include/template/main.tpl (PunBB)

FIND
<pun_head>
AFTER, ADD
<script language='javascript' src='spelling/spellmessage.js'></script>

10. Open up post.php

FIND
<p><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="s" /><input type="submit" name="preview" value="<?php echo $lang_post['Preview'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="p" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
REPLACE WITH
<p><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="s" /><input type="submit" name="preview" value="<?php echo $lang_post['Preview'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="p" /><input type="button" value="Spell Check" onclick="openspell();" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>

FIND
$form = '<form id="post" method="post" action="post.php?action=post&tid='.$tid.'" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">';
REPLACE WITH
$form = '<form name="spelling_mod" id="post" method="post" action="post.php?action=post&tid='.$tid.'" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">';

FIND
$form = '<form id="post" method="post" action="post.php?action=post&fid='.$fid.'" onsubmit="return process_form(this)">';
REPLACE WITH
$form = '<form name="spelling_mod" id="post" method="post" action="post.php?action=post&fid='.$fid.'" onsubmit="return process_form(this)">';

11. Replace spelling/spellmessage.js with the following code

// --------------------------------------------------------------------
// phpSpell Javascript (For the PHPBB Message Document)
//
// This is (c)Copyright 2003, Team phpSpell.
// --------------------------------------------------------------------
        var ie4 = (document.all) ? 1:0;
        var gecko=(navigator.userAgent.indexOf('Gecko') > -1) ? 1:0;
        var op6=(navigator.userAgent.indexOf('Opera/6') > -1) ? 1:0;
        var op7=(navigator.userAgent.indexOf('Opera/7') > -1) ? 1 : (navigator.userAgent.indexOf('Opera 7') > -1) ? 1:0;
        var ns4=(navigator.userAgent.indexOf('Mozilla/4.7') > -1) ? 1:0;
        var sf=(navigator.userAgent.indexOf('Safari') > -1) ? 1:0;
        if (op7) ie4 = 0;
        if (sf) {
          ie4 = 0;
          gecko = 1;
        }


        var LinkToField = "";

        function openspell()
        {
          height = 391;
          width = 555;
          if (ie4) LinkToField = self.spelling_mod.req_message;
          if (gecko) {
            LinkToField = parent.document.spelling_mod.req_message;
            height = height + 6;
          }
          if (op6) {
             LinkToField = document.forms[0].req_message;
             height = height + 10;
             width = width + 10;
          }
          if (op7) LinkToField = document.forms[0].req_message;

          if (!(op6 || gecko || ie4 || op7)) {
            alert("phpSpell only supports one of the following browsers:\nOpera 6+, Netscape 6+, Mozilla 1+, Internet Explorer 4+, Safari");
          } else {
            if (LinkToField.value.length == 0) return;
            directory = "spelling/";
            k = openspell.arguments.length;
            if (k == 1) directory = "";
            win1=window.open(directory+"phpSpell.html","spellcheckwin",'resizable=no,width='+width+',height='+height);
            if (win1.opener == null) win1.opener = self;
          }
          return (false);
        }

        function Opera_Get_Link() {
          return (LinkToField);
        }

12. You're done! If you want to add spell check functionality to the quick reply form or the edit post form, take a look at step 12 and make similar edits in the correct files (viewtopic.php and edit.php)

Re: Can you make a Preview post button and a spell check button?

http://punres.org/doku.php?id=tutorials … spellcheck smile

Re: Can you make a Preview post button and a spell check button?

Thanks connor smile

Re: Can you make a Preview post button and a spell check button?

If I had only waited a couple more hours life would've been much easier tongue

Re: Can you make a Preview post button and a spell check button?

No, because without your input I wouldn't have caught the errors tongue

Re: Can you make a Preview post button and a spell check button?

Cool...I made a worthwhile contribution to a much needed mod.

Re: Can you make a Preview post button and a spell check button?

I just want to check to be sure but when changing edit.php I just change

<p><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="s" /><input type="submit" name="preview" value="<?php echo $lang_post['Preview'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="p" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>

to this

<p><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="s" /><input type="submit" name="preview" value="<?php echo $lang_post['Preview'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="p" /><input type="button" value="Spell Check" onclick="openspell();" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>

and change

<form id="edit" method="post" action="edit.php?id=<?php echo $id ?>&action=edit" onsubmit="return process_form(this)">

to this

<form name="spelling_mod" id="edit" method="post" action="edit.php?id=<?php echo $id ?>&action=edit" onsubmit="return process_form(this)">

Re: Can you make a Preview post button and a spell check button?

Looks right to me

Re: Can you make a Preview post button and a spell check button?

Smartys wrote:

Thanks connor smile

np this is excatly the type of thing the wiki is great for, cos it doesn't get lost in the forum, yeh it still looks nice smile

Re: Can you make a Preview post button and a spell check button?

I am fine apart from:

Step 12.
You?re done! If you want to add spell check functionality to the quick reply form or the edit post form, take a look at step 12 and make similar edits in the correct files (viewtopic.php and edit.php)

I can't find all 3 of the lines that need to be replaced in these files.

Re: Can you make a Preview post button and a spell check button?

viewtopic.php

<form method="post" action="post.php?tid=<?php echo $id ?>" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">
<p><input type="submit" name="submit" tabindex="2" value="<?php echo $lang_common['Submit'] ?>" accesskey="s" /></p>

Those are the two lines you have to change