package Ledmonds::Form::MenuItem;
sub new
{
my $class = shift;
return bless {}, $class;
}
#--------------------------------------------------------------------------------------------------
# setTSData - sets hidden fields with all the ENV vars from teamsite GUI
# This is only for use by menu items
#--------------------------------------------------------------------------------------------------
sub setTSData
{
my ($className) = shift;
my ($cgi) = @_;
my ($thisKey, $thisValue);
my $bKeyFound = 0;
my @MENU_ITEM_FIELDS = ("editfile_session",
"vpath",
"archive_id",
"archive_name",
"archive_path",
"area_id",
"area_name",
"area_path",
"branch_id",
"branch_name",
"branch_path",
"directory_id",
"directory_name",
"directory_path",
"domain",
"iw_prog_name",
"mount_path",
"overwrite",
"page_id",
"page_type",
"subpage_type",
"user_name",
"user_role",
"wrapper_version",);
foreach $thisKey (sort keys %{$cgi->{form}})
{
#look for the ts key and set flag if it is the current key
foreach my $tsField (@MENU_ITEM_FIELDS)
{
$tsField = lc($tsField);
my $tmpKey = lc($thisKey);
$bKeyFound = 1 if ($tsField eq $tmpKey);
last if ($bKeyFound);
}
if ($bKeyFound)
{
$bKeyFound = 0;
} else {
next;
}
if (!ref $cgi->{form}{$thisKey})
{
$thisValue = $cgi->escape_html_data($cgi->{form}{$thisKey});
print " \n";
}
else
{
foreach my $refItem (@{$cgi->{form}{$thisKey}})
{
$thisValue = TeamSite::CGI_lite->escape_html_data($refItem);
print " \n";
}
}
}
}
1;