========== Ajax Toggle Folders ==========
Created by Giam Teck Choon (choon _ at _ choon.net)

========== Brief Description ==========
This module is based on the ideas of the following modules:

- Collapsible Folders (http://www.phorum.org/phorum5/read.php?62,138406)
- AJAX style Mark Read Module for Emerald (http://www.phorum.org/phorum5/read.php?62,142855)

This module allows users to toggle (collapse/expand) forum folders with ajax
calls without requiring a page refresh.  Expand/Collapse state are saved except
for guest users.

Custom profile field name mod_ajax_toggle_folders_list will be created
when you click this module settings in Phorum Admin.  This module settings
also let you change the used YUI version and YUI combo URL.  Currently this
module only tested and works in YUI version 2.

========== Credits ==========
Some codes are copied and modified from the modules Collapsible Folders and
AJAX style Mark Read Module for Emerald.  Thanks to both modules author(s).

========== Installation Instructions ==========
1. Unpack the archive.

2. Move the directory "ajax_toggle_folders" to the directory "mods" within
   your Phorum installation.

3. Login as administrator in Phorum's administrative interface and go to the
   "Modules" section.

4. Enable the module "Ajax Toggle Folders".

5. Go to the settings page of the Ajax Toggle Folders module to configure the
   module.

6. Edit the index_new.tpl file for your template.

   See emerald-index_new.tpl.patch file provided about how to patch your 
   template index_new.tpl file.

   If you prefer to edit on your own, please read emerald-index_new.tpl.patch
   to get an idea.  Manually edit index_new.tpl steps as below:

6.1. Go to line 19: <th align="left">{LANG->LastPost}</th> and replace with the
   following:

{IF LOGGEDIN}
    {IF LANG->ajax_toggle_folders}
        {IF FORUMS->COLLAPSE}
            <th align="left">{LANG->LastPost} <a href="{FORUMS->URL->EXPAND}" style="float:right;" id="togglefolder_{FORUMS->forum_id}"><img src="{LANG->ajax_toggle_folders->Icon->Expand}" title="{LANG->ajax_toggle_folders->Expand}"></a></th>
        {ELSE}
            <th align="left">{LANG->LastPost} <a href="{FORUMS->URL->COLLAPSE}" style="float:right;" id="togglefolder_{FORUMS->forum_id}"><img src="{LANG->ajax_toggle_folders->Icon->Collapse}" title="{LANG->ajax_toggle_folders->Collapse}"></a></th>
        {/IF}
    {ELSE}
        <th align="left">{LANG->LastPost}</th>
    {/IF}
{ELSE}
    {IF LANG->ajax_toggle_folders}
        <th align="left">{LANG->LastPost} <a href="#{FORUMS->forum_id}" style="float:right;" id="togglefolder_{FORUMS->forum_id}" onclick="togglefolder('togglefolder_{FORUMS->forum_id}'); return false" title="Click to Show/Hide"><img src="{LANG->ajax_toggle_folders->Icon->Collapse}" title="{LANG->ajax_toggle_folders->Collapse}" /></a></th>
    {ELSE}
        <th align="left">{LANG->LastPost}</th>
    {/IF}
{/IF}

6.2. Locate the following lines:

             </tr>
         {ELSE}
             <tr>

   Replace with the following:

       	     </tr>
       	 {ELSE}
{IF LOGGEDIN}
    {IF LANG->ajax_toggle_folders}
        {IF FORUMS->COLLAPSE}
           <tr {IF FORUMS->parent_id} id="togglefolder_{FORUMS->parent_id}_{FORUMS->forum_id}" style="display:none;" {/IF}>
        {ELSE}
           <tr {IF FORUMS->parent_id} id="togglefolder_{FORUMS->parent_id}_{FORUMS->forum_id}" {/IF}> 
        {/IF}
    {ELSE}
        <tr>
    {/IF}
{ELSE}
    {IF LANG->ajax_toggle_folders}
        <tr {IF FORUMS->parent_id} id="togglefolder_{FORUMS->parent_id}_{FORUMS->forum_id}" {/IF}>
    {ELSE}
        <tr>
    {/IF}
{/IF}

That is all :)
