use strict; use Pos::Webtop::Toolbox (); use Pos::Policy::LayeredBurrito (); use Pos::Webtop::Web::ContentModule::UserPrefs::PrefModule (); # derived class package Pos::Webtop::Web::ContentModule::UserPrefs::PrefModule::IntranetAccessMethod; my $className = "Pos::Webtop::Web::ContentModule::UserPrefs::PrefModule::IntranetAccessMethod"; our @ISA = qw( Pos::Webtop::Web::ContentModule::UserPrefs::PrefModule ); sub new { my $this = shift; my $class = ref($this) || $this; my ($self) = @{{@_}}{qw/self/}; if ( not defined $self ) { $self = {}; bless($self,$class); } my %args = @_; $args{'self'} = $self; Pos::Webtop::Web::ContentModule::UserPrefs::PrefModule->new( %args ); $self->setPreferenceName( preferenceName=> "Intranet Access Method" ); $self->setPolicyTypeId( policyTypeId=> 521 ); return $self; } sub getEmbeddedHtml { my $self = shift; my $tb = $self->getToolBox(); my $client = $tb->getClient(); my $cgi = $tb->getCgi(); my $pdb = $tb->getPolicyDb(); my $dbr = $tb->getWebtopDbReader(); my $value = 'Standard'; my $policyValues = $self->getPolicyValues(); foreach my $val ( @{ $policyValues } ) { $value = $val->{'policyValue'}; last; } my $ret = ""; $ret .= $self->getEmbeddedHeader(); my $action = $cgi->param('action'); if (not defined($action)) { $action = ''; } if ($action eq 'save') { my $cancel = $cgi->param('cancel'); if (defined($cancel)) { $self->setDone(); return ""; } else { my $method = $cgi->param('method'); if ($method eq 'Standard') { $self->setPolicyValues( values => [ { type => "DEFAULT", value => 'Standard' } ]); } elsif ($method eq 'Enhanced') { $self->setPolicyValues( values => [ { type => "DEFAULT", value => 'Enhanced' } ]); } else { $self->setPolicyValues( values => [ { type => "DEFAULT", value => 'Compatible' } ]); } $self->setDone(); return ""; } } else { $ret .= "
"; } $ret .= $self->getEmbeddedFooter(); return $ret; } sub getPreviewText { my $self = shift; my $policyValues = $self->getPolicyValues(); my $value = ""; my $tb = $self->getToolBox(); my $client = $tb->getClient(); my @info; foreach my $val ( @{ $policyValues } ) { $value = $val->{'policyValue'}; last; } if ($value eq '' or $value eq 'Standard') { push @info, "Standard"; } elsif ($value eq 'Enhanced') { push @info, "Enhanced"; } else { push @info, "Compatible"; } return join(", ", @info); } 1;