This mod requires that you make edits to several files, but you'll find that the edits are very similar to one another and quite straightforward.
1) genlib.php
In the function tng_menu, add the following lines after the first set of doMenuItems calls. This will allow additions to an individual's tabs.
if( !$disallowgedcreate || $allow_ged ) {
$menu .= doMenuItem( 5, "$gedform_url" . "personID=$entityID&tree=$tree", "$cms[tngpath]tng_ged.gif", $text[extractgedcom], $currpage, "gedcom" );
$nexttab = "6";
}
else
$nexttab = "5";
foreach (explode(',', $GLOBALS['addons']) as $addon) {
if (is_file("addons/$addon/genlib.php"))
include("addons/$addon/genlib.php");
}
$editstr = "editperson.php?person";
And in the tng_icons menu, add these lines to allow additions to the 'Find', 'Media' and 'Info' menus. This will allow additions to these menus by addons.
$menu .= "<li><a href=\"$searchform_url\"><img src=\"$cms[tngpath]tng_search2.gif\" width=\"20\" height=\"20\" border=\"0\" hspace=\"4\" style=\"vertical-align:middle\" align=\"left\" alt=\"\" />text[search]</a></li>\n";
foreach (explode(',', $GLOBALS['addons']) as $addon) {
if (is_file("addons/$addon/find_menu.php"))
include("addons/$addon/find_menu.php");
}
$menu .= "<ul>\n";
$menu .= "<li><a href=\"$browsemedia_noargs_url\"><img src=\"$cms[tngpath]tng_media.gif\" width=\"20\" height=\"20\" border=\"0\" hspace=\"4\" style=\"vertical-align:middle\" align=\"left\" alt=\"\" />text[allmedia]</a></li>\n";
foreach (explode(',', $GLOBALS['addons']) as $addon) {
if (is_file("addons/$addon/media_menu.php"))
include("addons/$addon/media_menu.php");
}
$menu .= "<ul>\n";
$menu .= "<li><a href=\"$suggest_url\"><img src=\"$cms[tngpath]tng_contact.gif\" width=\"20\" height=\"20\" border=\"0\" hspace=\"4\" style=\"vertical-align:middle\" align=\"left\" alt=\"\" />text[contactus]</a></li>\n";
foreach (explode(',', $GLOBALS['addons']) as $addon) {
if (is_file("addons/$addon/info_menu.php"))
include("addons/$addon/info_menu.php");
}
$menu .= "<ul>\n";
2) admin/leftbanner.php
We will add similar code into this file to allow an addon to put itself onto the left banner of the Admin page.
<tr><td><span class="normal"><a href="backuprestore.php" target="main" class="lightlink"><?php echo $admtext[backuprestore]; ?></a></span></td></tr>
<?php
}
foreach (explode(',', $GLOBALS['addons']) as $addon) {
if (is_file("addons/$addon/admin/leftbanner.php"))
include("addons/$addon/admin/leftbanner.php");
}
?>
3) admin/main.php
This addition will allow addons to list themselves on the main Admin page. The code is added twice here to "balance" out the list, alternating between the left and right columns.
<tr>
<td class="fieldnameback" nowrap onMouseover="this.className='mouseoverback';" onMouseout="this.className='fieldnameback';">
<a href="timelineevents.php" class="lightlink2"><img src="tlevents_icon.gif" alt="<?php echo $admtext[tlevents]; ?>" width="40" height="40" border="1" align="left" hspace="5" style="border-color: black;">
<span class="whitesubhead"><strong><?php echo $admtext[tlevents]; ?></strong></span><br/>
<span class="smaller"><?php echo $timelinemsg; ?></span></a>
</td>
</tr>
<?php
$i = 1;
foreach (explode(',', $GLOBALS['addons']) as $addon) {
if ($i % 2 == 1) {
if (is_file("../addons/$addon/admin/main.php"))
include("../addons/$addon/admin/main.php");
}
$i++;
}
?>
</table>
<tr>
<tr>
<td class="fieldnameback" nowrap onMouseover="this.className='mouseoverback';" onMouseout="this.className='fieldnameback';">
<a href="backuprestore.php" class="lightlink2"><img src="backuprestore_icon.gif" alt="<?php echo $admtext[backuprestore]; ?>" width="40" height="40" border="1" align="left" hspace="5" style="border-color: black;">
<span class="whitesubhead"><strong><?php echo $admtext[backuprestore]; ?></strong></span><br/>
<span class="smaller"><?php echo $admtext[backupitems]; ?></span></a>
</td>
</tr>
<?php
$i = 1;
foreach (explode(',', $GLOBALS['addons']) as $addon) {
if ($i % 2 == 0) {
if (is_file("../addons/$addon/admin/main.php"))
include("../addons/$addon/admin/main.php");
}
$i++;
}
}
?>
</table>
4) English/cust_text.php
This will allow addons to include their own language dependent text files. I only show the English directory, but you would want to make this addition to all language directories you may have. Simply add these lines at the end of the file.
foreach (explode(',', $GLOBALS['addons']) as $addon) {
if ($cms[support])
$addon_path = "$rootpath$cms[tngpath]addons/$addon/$mylanguage";
else
$addon_path = "${rootpath}addons/$addon/$mylanguage";
if (is_file("$addon_path/text.php"))
include("$addon_path/text.php");
}
?>
5) mytngstyle.css
Finally you will need to add an additional tab setting in the
mytngstyle.css (since you will now have an additional tab on an individual's page). These lines could by added to the tngtabs1.css file, but this file is often overridden during a TNG upgrade.
#a7 { left: -165px;}
#tngnav a#a7 { left: -165px;}
Remember that this is only adding one tab... if you continue to add other addons you would need to add #a8, #a9, etc. You need only calculate the next value based on the spacing between the existing numbers (these can be found in the tngtabs1.css file).
6) customconfig.php (OPTIONAL)
If you would like addons to be automatically loaded when they are installed in the
addons directory, you can add the following code in to your
customconfig.php file.
$dir = "${rootpath}addons/";
$dirs = array();
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..")
$dirs[] = $file;
}
closedir($handle);
}
$addons = implode(',', $dirs);
This edit is not required, but if not installed you will need to manually set the $addons variable in your customconfig.php, such as:
$addons = "addon1,addon2";