1

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

?

2

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

Preview posts has been added to PunBB 1.2

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

Spell check will have to be a mod.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

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

i saw a mod for spellcheck on phpbb that was cool cos it used another website to check the spelling (no need for a massive dictionary file dunno where i put it though)... i'll have a look i was thinking about editing it for punbb for my forum (since i can't spel wink)

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

There are add-on browser extensions available for both Internet Explorer and Firefox to add spell checking capability for text boxes and input boxes.

For IE:  http://www.iespell.com/

for Firefox:  http://spellbound.sourceforge.net/

I have used both, and they work equally well.  For ieSpell, it is possible to include a spellcheck button in a web form to invoke the spell checking.

Example:  http://richardk.digitalrice.com/punbb12/post.php?tid=1

You must be using IE for the above example to work, for all other browsers, the spellcheck button is not shown.  If you are using IE and you don't have ieSpell installed, the button will be labeled "Get ieSpell" and when clicked, it will open a window where you can download ieSpell.   If you do have ieSpell, the button will be labeled "Check Spelling" and will spell check the text box when you click on it.

I don't think the same is possible for spellbound yet, at least I haven't been able to find anything about it yet.

6 (edited by jsteggy 2005-01-18 07:50)

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

Paul wrote:

Preview posts has been added to PunBB 1.2

Really?  I upgraded from 1.1.5 to 1.2 - The preview post button does not appear with the submit button. Is there something I need to do?

Nevermind, I must be blind. I see it now. neutral 

Thanks
Joseph

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

For spell checking I think phpSpell would do the trick. It comes with install instructions for most of the common php message boards, though none for punbb. It shouldn't be too hard for someone to figure it out.

http://www.master-technology.com/demos/ … wnload.php

I hope someone figures out how to implement it, as ot woll bo a loaf sayver!

8 (edited by Smartys 2005-04-30 21:35)

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

Ooh, something to do! big_smile

Oh, and w00t: 501 posts without me realizing it big_smile

Edit:

OK, instructions (modified from the MySQL ones they give):

Edit2: I forgot a bit, sorry wink

9 (edited by Smartys 2005-05-01 00:14)

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

New post it is

Note that you do this at your own risk. I have tested this and found it to work. If you encounter problems, tell me about them so that I can correct them for other people

1. Open common/spell_config.php
2. Comment the line that says 
$Spell_Config['DB_Type'] = 'PHPBB'; 
and add a line that says 
$Spell_Config['DB_Type'] = 'PunBB';
3. Find
  if (isset($Spell_Config['DB_Type']) && $Spell_Config['DB_Type'] == 'MySQL') {
    include 'spell_MySQL.php';
  }

Add after
  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';
  }
4. Change any other settings and save.
5. Upload all the files in the common & native_mysql directory to the forum/spelling directory
6. Go to http://www.yourwebsite.com/forum/spelling/spell_admin.php
7. Install any dictionaries you want.
8. Delete any file ending with .dic on the server (to free up disk space)
9. Delete the spell_admin.php file off the server.
10. Open up include/template/main.tpl (PunBB) and find
<pun_head>
Add after
<script language='javascript' src='spelling/spellmessage.js'></script>
11. Open up post.php and 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 it 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>
12. Follow the final steps outlined in this post: http://punbb.org/forums/viewtopic.php?pid=42055#p42055

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

You are a hero - I will test it today.

11

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

i tested it, and cant get the spell check button to work

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

Meh, time for me to test it I guess

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

IESpell is great! http://www.iespell.com/

Rob Ludlow 
www.Nifty-Stuff.com - Repository of all Stuff Nifty!
www.reviewum.com - Professor Ratings + Teacher Reviews

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

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

OK, found the issue. I'll edit the fix into my original post as well.

Open post.php
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)">';

Open spelling/spellmessage.js
The code should be as follows:

// --------------------------------------------------------------------
// 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);
        }

Hopefully I didn't miss anything this time

15 (edited by snoogly 2005-05-01 01:30)

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

Nearly there...

I get the spell check window to open, but nothing happens. I seem to remember this happening when I ran it in phpBB, but I can't recall how I fixed it. :-(

Also, when trying to go to spell_admin.php I get the following error message:

Parse error: parse error in /home/..../public_html/spelling/spell_config.php on line 187

This is referring to: 

include 'spell_MySQL.php';

which was part of what was added in the mod.

16 (edited by Gizzmo 2005-05-01 01:32)

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

i beleave you need to change line:385 than do the same in the edit.php

and i tested it in explore and works great, but dont work in opera.

EDIT: its working now in opera, dono what happend but it seems to be working now.

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

That's line:385 in which file?

18 (edited by Gizzmo 2005-05-01 01:44)

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

post.php, my file is moded, so look around that line#

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

Anyone have any ideas why I am getting a parse error on spell_config.php?

I pasted in exactly as specified by Smartys.

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

Ah, that was a problem with the original thing I posted I think
If line 185 is

$table_prefix = $db_prefix

Just add a ; after it smile

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

Smartys wrote:

OK, found the issue. I'll edit the fix into my original post as well.

.........

Open spelling/spellmessage.js

I don't have a folder named spelling when I downloaded phpspell

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

This is in your forum. You have a spelling folder there (or you should)

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

Ok I followed all the posts and have it installed and the dictionary added. When I do a spell check I get an error in IE saying

'self.spelling_mod.req_message' is null or not an object

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

I looked with firefox javaconsole and it says

parent.document.spelling_mod has no properties

Then it shows a link to this line in spelling/spellmessage.js

            LinkToField = parent.document.spelling_mod.req_message;

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

Did you edit post.php? The form must be named spelling_mod.