Terms Infusion (Dictionary/Glossary) v3.00
PHP-Fusion: v7.00
original author: muscapaul
email: muscapaul@gmail.com)
web: www.muscapaul.com
date: 11 July 2008
--------------------------------------------------
This program is released as free software under the
Affero GPL license. You can redistribute it and/or
modify it under the terms of this license which you
can read by viewing the included agpl.txt or online
at www.gnu.org/licenses/agpl.html. Removal of this
copyright header is strictly prohibited without
written permission from the original author(s).
--------------------------------------------------


INTRODUCTION
------------

This document describes the procedure on how to add the use of [glos] [/glos] tags to your site. Using the tags will enable you to make clickable links of terms (single words or specific phrases) that will lead to a page where the term is explained and to show popup layers with the same content when the mouse is hover over the Infusion's ?-image. This applies to forum, news, articles and custom pages.

Please note that there are are two circumstances when the popup layer will have a problem:
1. The first letter of the Term is uppercase (for example because it is used at the start of a sentence) whereas the Term is described with the first letter in lowercase. The resulting popup layer will show that the Term cannot be found while the term itself is in fact listed. So one is advised to label Terms only mid-sentence or (if that cannot be prevented) to add the Term with the uppercase initial as a fixed synonym of the Term with the lowercase initial.
2. Term descriptions using simple square brackets ( [ and ] ) are not show in the popup layer. The script to display the description in the popup layer cannot dal with these brackets as they are also used in the script code. One should not use the simple square brackets in descriptions but use the [ ]-buttom that is given with the other BB code buttons.

AUTOMATIC INSTALLATION
----------------------

Automatic installation is possible by uploading the contents of the changed_files folder to your server. You should only do this AFTER you made a backup of the following files and ascertained that no modifications were made to them already:
../articles.php
../maincore.php
../news.php
../viewpage.php
../administration/articles.php
../administration/custom_pages.php
../administration/news.php
../themes/templates/header.php
../themes/templates/admin_header.php
../themes/templates/admin_header_mce.php

The following files are added:
../includes/boxover.js
../includes/bbcodes/glos_bbcode_include.php
../includes/bbcodes/glos_bbcode_include_var.php
../locale/English/bbcodes/glos.php


ENABLING THE GLOS BB CODE TAGS
------------------------------
1. Go to Admin Panel -> System Admin -> BB Codes.

2. In the list Disabled BB Codes find 'Glos' and click 'Enable'.

3. Ready.


MODIFYING ../articles.php TO PARSE GLOS TAGS
--------------------------------------------

1. Make a backup of the following file:
../articles.php

2. Open the file ../articles.php in a text editor of your choice and find on approx. line 38:

		$article = stripslashes($data['article_article']);

REPLACE this by the following code:

		$article = parseglos(stripslashes($data['article_article'])); //edited for parsing glos tags

3. In the same file, find on approx. line: 106

					echo "<a href='".FUSION_SELF."?article_id=".$data['article_id']."'>".$data['article_subject']."</a>$new<br />\n".stripslashes($data['article_snippet']);

REPLACE this by the following code:

					echo "<a href='".FUSION_SELF."?article_id=".$data['article_id']."'>".$data['article_subject']."</a>$new<br />\n".stripslashes(parseglos($data['article_snippet'])); //edited for parsing glos tags

4. Save the file and close it.


MODIFYING ../maincore.php TO PARSE GLOS TAGS
--------------------------------------------

1. Make a backup of the following file:
../maincore.php

2. Open the file ../maincore.php in a text editor of your choice and find on approx. line 428:

// Cache bbcode mysql

Immediately BEFORE add the following code:

//included line for correct parsing of code for Glossary
if (file_exists(INFUSIONS."terms/include/functions.php")) { include INFUSIONS."terms/include/functions.php"; }
if (file_exists(INFUSIONS."terms/include/functions.php")) { include INFUSIONS."terms/include/parse_functions.php"; }

3. Save the file and close it.


MODIFYING ../news.php TO PARSE GLOS TAGS
----------------------------------------

1. Make a backup of the following file:
../news.php

2. Open the file ../news.php in a text editor of your choice and find on approx. line 47:

			$news_news = $data['news_breaks'] == "y" ? nl2br(stripslashes($data['news_news'])) : stripslashes($data['news_news']);


REPLACE this by the following code:

			$news_news = $data['news_breaks'] == "y" ? nl2br(parseglos(stripslashes($data['news_news']))) : parseglos(stripslashes($data['news_news'])); //edited for parsing glos tags

3. In the same file, find on approx. line 147:

			$news_news = stripslashes($data['news_extended'] ? $data['news_extended'] : $data['news_news']);

REPLACE this by the following code:

					echo "<a 			$news_news = parseglos(stripslashes($data['news_extended'] ? $data['news_extended'] : $data['news_news'])); //edited for parsing glos tags

4. Save the file and close it.


MODIFYING ../viewpage.php TO PARSE GLOS TAGS
--------------------------------------------

1. Make a backup of the following file:
../viewpage.php

2. Open the file ../viewpage.php in a text editor of your choice and find on approx. line 34:

		eval("?>".stripslashes($data['page_content'])."<?php ");

REPLACE this by the following code:

		eval("?>".parseglos(stripslashes($data['page_content']))."<?php "); // edited for parsing glos tags

3. Save the file and close it.


MODIFYING ../administration/articles.php TO ADD GLOS TAG BUTTONS
----------------------------------------------------------------

1. Make a backup of the following file:
../administration/articles.php

2. Open the file ../administration/articles.php in a text editor of your choice and find on approx. line 157:

			echo "<tr>\n<td class='tbl'></td>\n<td class='tbl'>\n";

Immediately AFTER add the following code:

			echo "<input type='button' value='glos' class='button' style='width:35px;' onClick=\"addText('body', '[glos]', '[/glos]');\"> "; // new line to add glos tags

3. In the same file, find on approx. line: 166

			echo "<input type='button' value='".$locale['432']."' class='button' style='width:80px;' onclick=\"insertText('body2', '<--PAGEBREAK-->');\" />\n";

Immediately AFTER add the following code:

			echo "<input type='button' value='glos' class='button' style='width:35px;' onClick=\"addText('body2', '[glos]', '[/glos]');\"> "; // new line to add glos tags

4. Save the file and close it.


MODIFYING ../administration/custom_pages.php TO ADD GLOS TAG BUTTONS
--------------------------------------------------------------------

1. Make a backup of the following file:
../administration/custom_pages.php

2. Open the file ../administration/custom_pages.php in a text editor of your choice and find on approx. line 164:

   	echo "<input type='button' value='&lt;br /&gt;' class='button' style='width:40px;' onclick=\"insertText('page_content', '&lt;br /&gt;');\" />\n";

Immediately AFTER add the following code:

	echo "<input type='button' value='glos' class='button' style='width:35px;' onClick=\"addText('page_content', '[glos]', '[/glos]');\">\n";

3. Save the file and close it.


MODIFYING ../administration/news.php TO ADD GLOS TAG BUTTONS
------------------------------------------------------------

1. Make a backup of the following file:
../administration/news.php

2. Open the file ../administration/news.php in a text editor of your choice and find on approx. line 207:

		echo "<tr>\n<td class='tbl'></td>\n<td class='tbl'>\n";

Immediately AFTER add the following code:

		echo "<input type='button' value='glos' class='button' style='width:35px;' onClick=\"addText('body', '[glos]', '[/glos]');\">\n"; // new line to add glos tags

3. In the same file, find on approx. line: 166

		echo "<tr>\n<td class='tbl'></td>\n<td class='tbl'>\n";

Immediately AFTER add the following code:

		echo "<input type='button' value='glos' class='button' style='width:35px;' onClick=\"addText('body2', '[glos]', '[/glos]');\">\n"; // new line to add glos tags

4. Save the file and close it.


MODIFYING ../themes/templates/header.php TO PARSE GLOS TAGS
-----------------------------------------------------------

1. Make a backup of the following file:
../themes/templates/header.php

2. Open the file ../themes/templates/header.php in a text editor of your choice and find on approx. line 36:

echo "<script type='text/javascript' src='".INCLUDES."jquery.js'></script>\n";

Immediately AFTER add the following code:

echo "<script type='text/javascript' language='JavaScript' src='".INCLUDES."boxover.js'></script>

<script type='text/javascript' language='JavaScript'>
function showhide(id){
	if (document.getElementById){
		obj = document.getElementById(id);
		if (obj.style.display == 'none'){
			obj.style.display = '';
		} else {
			obj.style.display = 'none';
		}
	}
}
</script>";

3. Save the file and close it.


MODIFYING ../themes/templates/header_admin.php TO PARSE GLOS TAGS
-----------------------------------------------------------------

1. Make a backup of the following file:
../themes/templates/header_admin.php

2. Open the file ../themes/templates/header_admin.php in a text editor of your choice and find on approx. line 37:

echo "<script type='text/javascript' src='".INCLUDES."jquery.js'></script>\n";

Immediately AFTER add the following code:

echo "<script type='text/javascript' language='JavaScript' src='".INCLUDES."boxover.js'></script>

<script type='text/javascript' language='JavaScript'>
function showhide(id){
	if (document.getElementById){
		obj = document.getElementById(id);
		if (obj.style.display == 'none'){
			obj.style.display = '';
		} else {
			obj.style.display = 'none';
		}
	}
}
</script>";

Save the file and close it.


MODIFYING ../themes/templates/header_admin_mce.php TO PARSE GLOS TAGS
---------------------------------------------------------------------

1. Make a backup of the following file:
../themes/templates/header_admin_mce.php

2. Open the file ../themes/templates/header_admin.php in a text editor of your choice and find on approx. line 37:

echo "<script type='text/javascript' src='".INCLUDES."jquery.js'></script>\n";

Immediately AFTER add the following code:

echo "<script type='text/javascript' language='JavaScript' src='".INCLUDES."boxover.js'></script>

<script type='text/javascript' language='JavaScript'>
function showhide(id){
	if (document.getElementById){
		obj = document.getElementById(id);
		if (obj.style.display == 'none'){
			obj.style.display = '';
		} else {
			obj.style.display = 'none';
		}
	}
}
</script>";

Save the file and close it.

REMARKS
-------
The [glos] [/glos] BB-codes are a custom addition which is made possible by the changes in the core of PHP-Fusion. However, while adding these BB codes, a locale file is needed, too. By default, only ../locale/English/bbcodes/glos.php is added. If the locale file for your site language is not present, the system should be default select the English locale file.
You may decide to translate this files for your own locale and send it to me. In that case I can include it in the download package.