YaBB Comments addon for Coranto

Written by Vesa Hakku

Description - Preparing for setup - Setup - Version info
Description
This addon enables you to use YaBB forum for news comments. When you submit a newsitem, a thread is automatically created in the selected board. Modifying a news item will modify the corresponding post and include a notice of modification in the last line of the post. Deleting a newsitem will (if you want) also delete the entire thread from YaBB.
NOTE!
If you remove a comment thread directly from YaBB, you will end up having a broken comments-link for the newsitem. You can create a new thread by modifying the newsitem.

Optional feature:
A small perl-script included for showing the number of comments, count is updated independently on page reload, no news build is required.

For configuration, read the documentation included within the addon (right next to the enable link) or setup-section below, before you enable the addon.
Preparing for setup   -   Top
Make backups of your newsdat.txt, crcfg.dat and YaBB's 'Boards' and 'Messages' folders, for easy restore if something goes wrong. This addon works with Coranto build 29 up (as far as I know) and YaBB 1 Gold SP1 and SP 1.1.
This addon does NOT work with YaBB SE.

Please report any problems on the forum at the unofficial Coranto site, where you found this addon.
Setup   -   Top
As you submit/modify news you will notice some new fields in the form. The one called 'YaBB_ID#' you don't normally need to use. The second 'YaBB Board' is there because Coranto's dropdown boxes are not flexible enough and the addon uses Coranto's database to store it's information.
If the newsitem has a thread you will not see the board selection dropdown box, but if you have selected not to create a thread for the newsitem when you created it, you may do so on the modify page by selecting a board for the thread.

YaBB-files are accessed directly, so you will have to provide some settings in 'Change Settings'. When you submit a newsitem, a thread is automatically created in the chosen board. Modifying a news item will modify the corresponding post and include a notice of modification in the last line of the post. Deleting a newsitem will also delete the entire thread, if you so choose.

NOTE!
If you remove comment threads directly from YaBB, you will end up having a broken comments-link for the newsitem. Modifying the newsitem will automatically create a new thread to replace the missing one.

The settings are simple enough in the 'Change Settings' area. The 'YaBB Board' is the default value for the board selection on submit page (leave empty to default to not creating a new thread). If you do not want to have the poster appear as a guest, you can create an account in YaBB with the same username (max 18 characters, no spaces and special characters). You also have to make 2 new userfields manually, if you want to use individual YaBB-accounts for each user. Name them "YaBB_UserName" and "YaBB_UserEmail" (without the quotes). The values in 'Change Settings' will be used if the user does not provide YaBB-account information.

If you want to show the count of comments for any particular newsitem, here's how to do it:
1. Configure and upload the included replies.pl to your Coranto folder.
2. Create a profile which creates an shtml-file (e.g. news.shtml)
    and replace news.txt with it on your news page.
3. Edit your news style to include (replacing path to replies.pl with your path):

<If: Field: CustomField_YaBB_ID>  -  <a href="<PerlCode>$newshtml .= "$CConfig{'YaBB_Path'}/YaBB.pl?board=$CustomField_YaBB_Board\&action=display&num=";</PerlCode><Field: CustomField_YaBB_ID>" target=_blank>Comments <!--#config errmsg="(N/A)" --><!--#include virtual="/cgi-bin/coranto/replies.pl?<Field: CustomField_YaBB_ID>,<Field: CustomField_YaBB_Board>"--></a></If>

If you don't care about the replycount, you can simply edit your news style to include:

<If: Field: CustomField_YaBB_ID><a href="<PerlCode>$newshtml .= "$CConfig{'YaBB_Path'}/YaBB.pl?board=$CustomField_YaBB_Board\&action=display&num=";</PerlCode><Field: CustomField_YaBB_ID>" target=_blank>Comments</a></If>

Version info   -   Top
Changes in 1.0 (released November 30. 2002):
Added the line to let Coranto 1.xx know that the addon is privacy compliant (and has always been).
Since no bugs have been reported since previous build (released 6 months ago), changing status from beta to final.
Combined the readme-file and internal documentation to a single html-file for improved readability.
Changes in beta 8:
Added the possibility to use existing individual YaBB accounts for each Coranto user. Set the default value for this on 'Change Settings' page (will be used if user does not provide YaBB account information).
NOTE!
If you want this feature to work, you will have to make the 2 new userfields manually. Name them "YaBB_UserName" and "YaBB_UserEmail" (without the quotes).
Changes in beta 7:
Added a column on 'Modify News' page to let you choose whether to delete the YaBB thread when you delete the newsitem. Set the default value for this on 'Change Settings' page.
Changes in beta 6:
Added support for use of an existing YaBB account.
Changes in beta 5:
Fixed opening 'board'.poster when the board is empty (and the file does not exist).
Changes in beta 4:
You may now choose the board indivídually for each newsitem. This is done by adding a dropdown box with all your board ids. You can set the default board in 'Change Settings'. When modifying a newsitem, if a thread for it does not exist the dropdown box will be visible.
replies.pl and news style modified to support multiple boards.
NOTE TO UPGRADERS!!!
Due to the changes necessary for these features to work, old comment links will not work unless you select the existing thread's board in the modify news page. The board is now stored, like the thread id, with the newsitem. Also, check your settings page. You will find the YaBB Board field empty. This is because the purpose of the setting has changed and the variable was renamed to reflect the new purpose (and to make you aware of it).
Changes in beta 3:
Converts some tags to YaBBC and removes the rest. When using tags like
<a href="http://www.site.com">Site</a>
don't forget the double quotes (") or the tag will be stripped from the YaBB post.

Tags that get converted are:

<br>
<hr>
<a href="mailto:someone@somewhere.com">
<a href="url">
<img src="url">
<a name="name">
</a>
<b> and </b>
<i> and </i>
<u> and </u>
<ol> and</ol>
<ul> and </ul>
<li>
<table> and </table>
<tr> and </tr>
<th> and </th>
<td>and </td>

All other tags are stripped (anything enclosed in angle brackets <>).
Automatically creates a new thread when modifying a newsitem if existing thread has been removed via YaBB.