#!/usr/bin/perl -I. use strict; use Pos::Webtop::Web::ContentModule (); use Pos::Policy::LayeredBurrito (); use Pos::Webtop::Web::ContentModule::UserPrefs::PrefModule::DesktopWallpaper; use Pos::Webtop::Web::ContentModule::UserPrefs::PrefModule::IntranetAccessMethod; use Pos::Webtop::Web::ContentModule::UserPrefs::PrefModule::XPRDASettings; package Pos::Webtop::Web::ContentModule::UserPrefs; our @ISA = qw( Pos::Webtop::Web::ContentModule ); sub new { my $this = shift; my $class = ref($this) || $this; my ($self) = @{{@_}}{qw/self/}; if ( not defined $self ) { $self = {}; bless($self,$class); } # setup base class my %args = @_; $args{'self'} = $self; Pos::Webtop::Web::ContentModule->new( %args ); my $tb = $self->getToolBox(); my $pdb = $tb->getPolicyDb(); my $lb = Pos::Policy::LayeredBurrito->new( db=> $pdb ); $self->{'layeredBurrito'} = $lb; $self->{'policyDb'} = $pdb; return $self; } my @prefModules = qw( DesktopWallpaper IntranetAccessMethod XPRDASettings ); # returns undef if fails or invalid class sub createPrefModuleFromClassName { my $self = shift; my ($className) = @{{@_}}{qw/className/}; my $pref = undef; my $toolBox = $self->{'toolBox'}; my $lb = $self->{'layeredBurrito'}; my $pdb = $self->{'policyDb'}; # my $lb = Pos::Policy::LayeredBurrito->new( db=> $pdb ); # make sure className is valid my $cleanClassName = undef; foreach ( @prefModules ) { # this satisifes taint check $cleanClassName = $_ if $className eq $_; } if ( defined $cleanClassName ) { eval '$pref = Pos::Webtop::Web::ContentModule::UserPrefs::PrefModule::' . $cleanClassName . '->new( toolBox=> $toolBox, layeredBurrito=> $lb );'; } else { warn ref($self) . "createPrefModuleFromClassName(): className '$className' was not valid"; } return $pref; } # (pure virtual defined in Pos::Webtop::Web::ContentModule) sub main { my $self = shift; my $toolBox = $self->getToolBox(); my $client = $toolBox->getClient(); my $cgi = $toolBox->getCgi(); my $lb = $self->{'layeredBurrito'}; my $db = $toolBox->getWebtopDbReader(); my $userId = $client->getUserId(); my $page = $toolBox->getPage(); my $continueToDefaultPage = 1; my $prefModule = $cgi->param('prefModule'); defined $prefModule and $client->setPersistedValue( name=> 'prefModule', value=> $prefModule ); $prefModule = $client->getPersistedValue( name=> 'prefModule' ); if ( defined $prefModule ) { $client->repersistValues( values=> ['prefModule'] ); my $pref = $self->createPrefModuleFromClassName( className=> $prefModule ); if ( not defined $pref ) { warn ref($self) . "::main(): failed to create PrefModule $prefModule"; } if ( defined $cgi->param('reset') and $cgi->param('reset') ) { $pref->deleteUserPreference(); } else { my $embeddedHtml = $pref->getEmbeddedHtml(); if ( not $pref->isDone() ) { $page->addNavBarElement( description=> $pref->getPreferenceName() ); print $page->getHeaderHtml( title=> "User Preferences" ); #print Pos::Webtop::OcxLauncher::getLauncherHtml(tb => $toolBox); print "
|
Overview: Below are a list of preferences which are available to you. Preferences which have the 'reset' link are extensions of policies set by your organization. Clicking the reset link will remove your preference settings and revert back to the value set by your organization. Items that are black instead of blue are read only and may not be changed. |
||
| Preference | Current Setting | Reset |
|---|---|---|
|
|
$link | "; if ( defined $pref->getPolicyTypeId() and ( not $pref->isLocked() ) ) { # we make the reset link print $client->getFormGetCode( text=> "Reset", values=> [ { name=> "reset", value=> 1 }, { name=> "prefModule", value=> $className } ], tagAttributes=> [ { name=> "CLASS", value=> "BOXLINK" } ] ); } else { print ' '; } print " |
| Click below to update any of your personal information, including your email address" . ($isSupportAccount ? " and phone number." : ", phone number, password, and secret question/answer pair." ) . " | |
| Personal Info: | $userInfoLink |
| Password: | $passwdLink |
| Secret Question/Answer: | $secretQuestionAnswerLink |