*********************************************************************************
*	MOD NAME: Extended Category Settings for 6.5.0				*
*********************************************************************************
*    DESCRIPTION: Lets you change the style template, HTML template and hide    *
*                 settings of a category. If you choose to hide a category,     *
*                 it can only be accessible through ultimatebb.cgi?category=X.  *
*     6.3.0 DEMO: http://www.lkubb.dns2go.com,					*
*                 http://www.lkubb.dns2go.com/ultimatebb.cgi?category=3		*
*									     	*
*********************************************************************************
*    ORIGINAL BY: LK								*
*           DATE: 04/30/02                                                 	*
*     AS VERSION: version 1.0 for UBB 6.3.0 ONLY                               	*
*										*
*********************************************************************************
*     UPDATED AS: version 1.5		                                    	*
*    UPDATED FOR                                                                *
*   UBB 6.5.0 BY: LBritish	                                    	        *
*                 http://www.littlefishtank.com					*
*********************************************************************************
*   REQUIREMENTS: Full License							*
*  COMPATABILITY: Tested and updated for use with v6.5.0 ONLY		      	*
*********************************************************************************
* FILES MODIFIED: cp_forums_cats.pl, cp_forums.cgi, ubb_forum_summary.cgi	*
*                 public_common.pl                                              *
*********************************************************************************
*     DISCLAIMER: By using this modification, the user implicitly agrees 	*
*		  that they are willingly modifying any and all files at 	*
*		  their own risk.  Should any errors occur either as a 		*
*		  direct or indirect result of said modifications the user 	*
*		  agrees not to hold Infopop Corporation or any of the 		*
*		  individuals listed accountable.                            	*
*                                                                            	*
*                                                                            	*
*    IN OTHER WORDS: PLEASE MAKE BACKUP COPIES OF EVERY FILE YOU PLAN TO     	*
*                      MODIFY PRIOR TO MODIFICATION!!                        	*
*********************************************************************************
* LBritish's comments:								*
*********************************************************************************
*										*
*  WARNING!!!!!!!!!: This version is NOT NOT NOT NOT NOT NOT NOT >>NOT<<        *
*		     no way at all compatible with 6.3.0 AT ALL anymore.	*
*		     Please see LK's original mod for 6.3.0 compatibility.	*
*		     I had last used 6.2 UBB prior to 6.5.0 so you are on your  *
*                    own for anything but 6.5.0 because I have no idea at all   *
*		     if it will work with this mod.  Test and use at your own   *
*		     risk as LK's disclaimer above indicates.         	        *
*										*
*  PROPER HTML NOTE: Note in the first find there is width statements... in my	*
*		     add statement I do not include width statements or tell	*
*		     you to replace the previous widths.  Really you should	*
*		     adjust this as you see fit for those 3 lines.  It works ok	*
*		     without this.  But... that's not proper ways of making 	*
*		     tables and I'm sure it'll eat someone's browser for lunch. *
*                    I just took out the 3 width parameters and it looks ok to  *
*                    to me... if you dont know how to edit a <TD> tag you 	*
*		     probably shouldnt be modifying UBB anyway... LOL... :P     *
*										*
*	  GUARANTEE: It works for me... you're on your own... 			*
		     See In Other Words and Disclaimer above.....		*
*                                                                            	*
*********************************************************************************
*                                                                            	*
*     FOR MORE TIPS AND TRICKS FOR USE WITH THE ULTIMATE BULLETIN BOARD      	*
*                            PLEASE VISIT US AT:                             	*
*                                                                            	*
*                           http://www.ubbdev.com/                           	*
*                                                                            	*
*********************************************************************************
*********************************************************************************

**************************
* Open cp_forums_cats.pl *
**************************

Find:
=====

<td width="10%" class="secondheaderrow">$vars_wordlets_cp{cats_header_number}</td>
<td width="60%" class="secondheaderrow">$vars_wordlets_cp{cats_header_name}</td>
<td width="30%" class="secondheaderrow">$vars_wordlets_cp{cats_display_order}</td>

Add below:
==========

<td class="secondheaderrow">$vars_wordlets_cp{style_template_assoc_header_style}</td>
<td class="secondheaderrow">$vars_wordlets_cp{style_template_assoc_header_html}</td>
<td class="secondheaderrow">Hidden?</td>

Find:
=====

TableTop


foreach $uno (@catz) {
	($CatOrder, $CatName, $CatNumber) = split (/\|\^\|/, $uno);

Replace with:
=============

TableTop

# style template
my @template_list = &OpenFileAsArray("$vars_config{VariablesPath}/vars_style_sets.cgi");
my @valid_html = &determine_html_templates;
local ($name, $num, $TemplateChoices);

foreach $uno (@catz) {
	($CatOrder, $CatName, $CatNumber, $Template, $HTML, $Hidden) = split (/\|\^\|/, $uno);
	my $selected = qq~ selected="selected"~ if !$Template;
	$TemplateChoices = qq~<select name="Template|^|$CatNumber"><option value=""$seleted>Default</option><option value="">---------</option>~;
	foreach (@template_list) {
		($name, $num) = split(/\|\^\|/, $_);
		chomp($num);
		my $selected;
		if ($Template == $num) {
			$selected = qq~ selected="selected"~;
		}
		$TemplateChoices .= qq!<option value="$num"$selected>$name</option>!;
	}
	$TemplateChoices .= qq!</select>!;
	my $checkedy; my $checkedn;
	if ($Hidden eq 'yes') { $checkedy = qq~ checked="checked"~; } else { $checkedn = qq~ checked="checked"~; }
	$cat = qq~<input type="radio" name="category|^|$CatNumber" value="yes"$checkedy />Yes
<input type="radio" name="category|^|$CatNumber" value="no"$checkedn />No~;

	my $selected = qq~ selected="selected"~ if !$HTML;

	my $ThatOtherDropDown = qq!<select name="HTML|^|$CatNumber"><option value=""$seleted>Default</option><option value="">---------</option>!;
	foreach my $set (@valid_html) {
		if($HTML eq $set) {
			$ThatOtherDropDown .= qq!<option value="$set" selected="selected">$set</option>!;
		} else {
			$ThatOtherDropDown .= qq!<option value="$set">$set</option>!;
		} # end if
	} # end foreach
	$ThatOtherDropDown .= qq!</select>!;

Find:
=====

<td class="autorow"><span class="autorow-options">$CatNumber</span></td>
<td class="autorow"><span class="autorow-options"><INPUT TYPE="TEXT" NAME="CatName|^|$CatNumber" VALUE="$CatName" SIZE="40" MAXLENGTH="100"></span></td>
<td class="autorow"><span class="autorow-options"><INPUT TYPE="TEXT" NAME="CatOrder|^|$CatNumber" VALUE="$CatOrderSimp" SIZE="5" MAXLENGTH="5"></span></td>

Add below:
==========

<td class="autorow"><span class="autorow-options">$TemplateChoices</span></td>
<td class="autorow"><span class="autorow-options">$ThatOtherDropDown</span></td>
<td class="autorow"><span class="autorow-options"><font size="2" face="Verdana, Arial">$cat</font></span></td>

Find:
=====

<td colspan="3" class="autorow">
<span class="autorow-options">$vars_wordlets_cp{cats_none_yet}
</span></td>

Replace with:
=============

<td colspan="6" class="autorow">
<span class="autorow-options">$vars_wordlets_cp{cats_none_yet}
</span></td>

Find:
=====

&HeaderRow($vars_wordlets_cp{cats_add_header}, "3", $vars_style_cp{SecondHeaderColor}, $vars_style_cp{SecondHeaderTextColor}, "left", "2");

Replace with:
=============

&HeaderRow($vars_wordlets_cp{cats_add_header}, "6", $vars_style_cp{SecondHeaderColor}, $vars_style_cp{SecondHeaderTextColor}, "left", "2");

Find:
=====

print <<BottomCatsHTML;
<tr bgcolor="$vars_style_cp{AltColumnColor1}">
<td colspan="3" class="autorow">

Replace with:
=============

print <<BottomCatsHTML;
<tr bgcolor="$vars_style_cp{AltColumnColor1}">
<td colspan="6" class="autorow">

Find:
=====

<td colspan="3" class="autorow"><span class="autorow-options">
<label for="NewCats">$vars_wordlets_cp{cats_add_prompt}</label>:

Replace with:
=============

<td colspan="6" class="autorow"><span class="autorow-options">
<label for="NewCats">$vars_wordlets_cp{cats_add_prompt}</label>:

**********************
* Open cp_forums.cgi *
**********************

Find:
=====

			if ($key eq "CatOrder|^|$num") {
				$ThisOrderPre = $in{$key};
				$ThisOrder    = &Do6Digit($ThisOrderPre);
			}

Add below:
==========

			if ($key eq "Template|^|$num") {
				$template     = $in{$key};
			}

			if ($key eq "HTML|^|$num") {
				$html         = $in{$key};
			}

			if ($key eq "category|^|$num") {
				$hidden       = $in{$key};
			}

Find:
=====

		$CATS[$arrayrow] = ("$ThisOrder|^|$ThisName|^|$num\n");

Replace with:
=============

		$CATS[$arrayrow] = ("$ThisOrder|^|$ThisName|^|$num|^|$template|^|$html|^|$hidden\n");

******************************
* Open ubb_forum_summary.cgi *
******************************

Find:
=====

# get assigned style template!
%vars_style = &LoadStyleTemplate("summary_page");

Add below:
==========

if ($in{category}) {
	@CATEGORIES = &GetCategoriesFile;
	foreach $one (@CATEGORIES) {
		($j, $CName, $CNum, $Template, $HTML, $Hidden) = split (/\|\^\|/, $one);
		chomp($Hidden); chomp($CNum); chomp($Template);
		if ($CNum eq $in{category}) {
			$template_match{test} = $Template || $template_match{summary_page};
			$template_html{test} = $HTML || $template_html{summary_page};
			%vars_style = &LoadStyleTemplate("test");
		}
	}
}

Find:
=====

	for $each (@forumlist) {
		undef($msg_icon2);
		undef($msg_icon);

Add below:
==========

		my $hide; my $Hidden; my $templ;
		@thisforuminfo = split (/\|\^\|/, $each);
		chomp($thisforuminfo[0]);
		foreach $one (@CATEGORIES) {
			($j, $CName, $CNum, $Template, $HTML, $Hidden) = split (/\|\^\|/, $one);
			chomp($Hidden); chomp($CNum); chomp($Template);
			if ($CNum eq $thisforuminfo[0] && $Hidden eq "yes" && !$in{category}) { $hide = "yes"; }
		}
		next if $hide eq 'yes';

Find:
=====

	local (@cats, $cat_color, $cat_line, $cat_name, $cat_number, $cat_order, $forum_count, $k, @this_match);

Replace with:
=============

	local (@cats, $cat_color, $cat_line, $cat_name, $cat_number, $cat_order, $forum_count, $k, @this_match, $template, $html, $hidden);

Find:
=====

		($cat_order, $cat_name, $cat_number) = split (/\|\^\|/, $cat_line);

Replace with:
=============

		($cat_order, $cat_name, $cat_number, $template, $html, $hidden) = split (/\|\^\|/, $cat_line);
		next if $hidden eq 'yes';

*************************
* Open public_common.pl *
*************************

Find:
=====

			($j, $ThisCatNam, $ThisCatNumb) = split (/\|\^\|/, $cat_type);

Replace with:
=============

			($j, $ThisCatNam, $ThisCatNumb, $template, $html, $hidden) = split (/\|\^\|/, $cat_type);
			next CATLOOP if $hidden eq 'yes';

*****************************************
*  Done! Upload, set settings and voila!
* Forum Settings -> Add/Review Categories