ASNMTAP
view release on metacpan or search on metacpan
applications/htmlroot/cgi-bin/moderator/downtimes.pl view on Meta::CPAN
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use ASNMTAP::Asnmtap::Applications::CGI v3.002.003;
use ASNMTAP::Asnmtap::Applications::CGI qw(:APPLICATIONS :CGI :MODERATOR :DBREADWRITE :DBTABLES);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use vars qw($PROGNAME);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$PROGNAME = "downtimes.pl";
my $prgtext = "Downtimes";
my $version = do { my @r = (q$Revision: 3.002.003$ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r }; # must be all on one line or MakeMaker will get confused.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# URL Access Parameters
my $cgi = new CGI;
my $pagedir = (defined $cgi->param('pagedir')) ? $cgi->param('pagedir') : '<NIHIL>'; $pagedir =~ s/\+/ /g;
my $pageset = (defined $cgi->param('pageset')) ? $cgi->param('pageset') : 'moderator'; $pageset =~ s/\+/ /g;
my $debug = (defined $cgi->param('debug')) ? $cgi->param('debug') : 'F';
my $pageNo = (defined $cgi->param('pageNo')) ? $cgi->param('pageNo') : 1;
my $pageOffset = (defined $cgi->param('pageOffset')) ? $cgi->param('pageOffset') : 0;
my $action = (defined $cgi->param('action')) ? $cgi->param('action') : 'insertView';
my $CcatalogID = (defined $cgi->param('catalogID')) ? $cgi->param('catalogID') : $CATALOGID;
my $Cid = (defined $cgi->param('id')) ? $cgi->param('id') : '';
my $CuploadFilename = (defined $cgi->param('uploadFilename')) ? $cgi->param('uploadFilename') : '<NIHIL>';
my $Ctitle = (defined $cgi->param('title')) ? $cgi->param('title') : '';
my $Cinstability = (defined $cgi->param('instability')) ? $cgi->param('instability') : 'off';
my $Cpersistent = (defined $cgi->param('persistent')) ? $cgi->param('persistent') : 'off';
my $Cdowntime = (defined $cgi->param('downtime')) ? $cgi->param('downtime') : 'on';
my $CactivationDate = (defined $cgi->param('activationDate')) ? $cgi->param('activationDate') : '';
my $CactivationTime = (defined $cgi->param('activationTime')) ? $cgi->param('activationTime') : '';
my $CsuspentionDate = (defined $cgi->param('suspentionDate')) ? $cgi->param('suspentionDate') : '';
my $CsuspentionTime = (defined $cgi->param('suspentionTime')) ? $cgi->param('suspentionTime') : '';
my $CremoteUser = (defined $cgi->param('remoteUser')) ? $cgi->param('remoteUser') : 'none';
my $CcommentData = (defined $cgi->param('commentData')) ? $cgi->param('commentData') : '';
$CcommentData =~ s/"/'/g;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $htmlTitle = $APPLICATION;
# Init parameters
my ($rv, $dbh, $sth, $sql, $catalogID_uKey, $nextAction, $remoteUsersSelect, $CatalogIDuKeyListStatus, @CatalogIDuKeyList);
# User Session and Access Control
my ($sessionID, undef, undef, undef, undef, undef, undef, $errorUserAccessControl, $remoteUserLoggedOn, undef, undef, $givenNameLoggedOn, $familyNameLoggedOn, undef, undef, $userType, undef, undef, undef, $subTitle) = user_session_and_access_control ...
# Serialize the URL Access Parameters into a string
my $urlAccessParameters = "pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=$pageNo&pageOffset=$pageOffset&action=$action&id=$Cid&uploadFilename=$CuploadFilename&title=$Ctitle&activationDate=$CactivationDate&activationTime=$...
# Debug information
print "<pre>pagedir : $pagedir<br>pageset : $pageset<br>debug : $debug<br>CGISESSID : $sessionID<br>page no : $pageNo<br>page offset : $pageOffset<br>action : $action<br>id : $Cid<br>uploadFilename: $...
if ( defined $sessionID and ! defined $errorUserAccessControl ) {
unless ( defined $userType ) {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print "<br>\n<table WIDTH=\"100%\" border=0><tr><td class=\"HelpPluginFilename\">\n<font size=\"+1\">$errorUserAccessControl</font>\n</td></tr></table>\n<br>\n";
} else {
if ( $action eq 'insert' ) {
if ( $CuploadFilename eq '' or $CuploadFilename eq '<NIHIL>' ) {
$CatalogIDuKeyListStatus = 'ERROR: No applications CatalogID & uKey list selected!';
} else {
if ( $cgi->param('uploadFilename') eq '' ) {
$CatalogIDuKeyListStatus = 'ERROR: No applications CatalogID & uKey list uploaded!';
} else {
$CuploadFilename =~ s/^.*(?:\/|\\)//;
$Ctitle = 'Applications CatalogID & uKey List: '. $CuploadFilename;
my $type = $cgi->uploadInfo( $cgi->param('uploadFilename') )->{'Content-Type'};
if ( $type eq 'text/plain' ) {
my $fh = $cgi->upload('uploadFilename');
if ( defined $fh ) {
my $uploadFilenameBoolean = 0;
while (<$fh>) {
s/(^\s*|\r*|\n*|\s*$)//g;
if ( /^#/ ) {
$uploadFilenameBoolean = 1 if ( /^# ASNMTAP DOWNTIMES$/ );
} elsif ( $uploadFilenameBoolean ) {
push (@CatalogIDuKeyList, $_) if ( $_ );
}
}
my $uploadStatus = ( $uploadFilenameBoolean ? 'OK' : 'NOT OK' );
$CatalogIDuKeyListStatus = "$Ctitle: Uploaded and imported file $uploadStatus!";
} else {
$CatalogIDuKeyListStatus = "ERROR: $Ctitle, Cannot upload TXT file!";
}
} else {
$CatalogIDuKeyListStatus = "ERROR: $Ctitle, TXT files only!";
}
$CatalogIDuKeyListStatus .= "</td></tr><tr><td colspan=\"2\"> ";
}
}
}
my $urlWithAccessParameters = $ENV{SCRIPT_NAME} ."?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID";
my $localYear = sprintf ("%04d", (localtime)[5] );
my $localMonth = sprintf ("%02d", (localtime)[4] );
my $currentYear = sprintf ("%04d", (localtime)[5] + 1900 );
my $currentMonth = sprintf ("%02d", (localtime)[4] + 1 );
my $currentDay = sprintf ("%02d", (localtime)[3] );
my $currentHour = sprintf ("%02d", (localtime)[2] );
my $currentMin = sprintf ("%02d", (localtime)[1] );
my $currentSec = sprintf ("%02d", (localtime)[0] );
my ($CactivationTimeslot, $CsuspentionTimeslot, $tsec, $tmin, $thour, $tday, $tmonth, $tyear);
if ($CactivationDate ne '' and $CactivationTime ne '') {
($tyear, $tmonth, $tday) = split(/\-/, $CactivationDate);
$tyear -= 1900; $tmonth--;
($thour, $tmin, $tsec) = split(/:/, $CactivationTime);
( run in 0.511 second using v1.01-cache-2.11-cpan-98e64b0badf )