ASNMTAP
view release on metacpan or search on metacpan
applications/htmlroot/cgi-bin/moderator/plugins.pl view on Meta::CPAN
my $prgtext = "Plugins";
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 $filter = (defined $cgi->param('filter')) ? $cgi->param('filter') : '';
my $orderBy = (defined $cgi->param('orderBy')) ? $cgi->param('orderBy') : 'optionValueTitle';
my $action = (defined $cgi->param('action')) ? $cgi->param('action') : 'listView';
my $CcatalogID = (defined $cgi->param('catalogID')) ? $cgi->param('catalogID') : $CATALOGID;
my $CcatalogIDreload = (defined $cgi->param('catalogIDreload')) ? $cgi->param('catalogIDreload') : 0;
my $CuKey = (defined $cgi->param('uKey')) ? $cgi->param('uKey') : '';
my $CshortDescription = (defined $cgi->param('shortDescription')) ? $cgi->param('shortDescription') : '';
my $Ctrendline = (defined $cgi->param('trendline')) ? $cgi->param('trendline') : 0;
my $ChelpPluginTextname = (defined $cgi->param('helpPluginTextname')) ? $cgi->param('helpPluginTextname') : '<NIHIL>';
my $ChelpPluginFilename = (defined $cgi->param('helpPluginFilename')) ? $cgi->param('helpPluginFilename') : '<NIHIL>';
my $CholidayBundleID = (defined $cgi->param('holidayBundleID')) ? $cgi->param('holidayBundleID') : 1;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $htmlTitle = $APPLICATION;
# Init parameters
my ($rv, $dbh, $sth, $sql, $header, $numberRecordsIntoQuery, $nextAction, $formDisabledAll, $formDisabledUniqueKey, $submitButton);
# User Session and Access Control
my ($sessionID, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $iconQuery, $iconTable, $errorUserAccessControl, $remoteUserLoggedOn, undef, undef, $givenNameLoggedOn, $familyNameLoggedOn, undef, undef, undef, undef, undef, undef, $subTitle) = user_s...
# Serialize the URL Access Parameters into a string
my $urlAccessParameters = "pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=$pageNo&pageOffset=$pageOffset&filter=$filter&orderBy=$orderBy&action=$action&catalogID=$CcatalogID&catalogIDreload=$CcatalogIDreload&uKey=$CuKey&sh...
# Debug information
print "<pre>pagedir : $pagedir<br>pageset : $pageset<br>debug : $debug<br>CGISESSID : $sessionID<br>page no : $pageNo<br>page offset : $pageOffset<br>filter : $filter<br>order by ...
my $uploadPluginStatus = 'OK';
if ( defined $sessionID and ! defined $errorUserAccessControl ) {
if ( $ChelpPluginFilename eq '' or $ChelpPluginFilename eq '<NIHIL>' ) {
$ChelpPluginFilename = ( $ChelpPluginTextname eq '' ? '<NIHIL>' : $ChelpPluginTextname );
$ChelpPluginTextname = '';
} else {
if ( $cgi->param('helpPluginFilename') eq '' ) {
$ChelpPluginFilename = $ChelpPluginTextname;
$ChelpPluginTextname = '';
} else {
$ChelpPluginFilename =~ s/^.*(?:\/|\\)//;
$ChelpPluginTextname = '<br><br>Help Plugin Filename: '. $ChelpPluginFilename;
my $type = $cgi->uploadInfo( $cgi->param('helpPluginFilename') )->{'Content-Type'};
if ( $type eq 'application/pdf') {
my $fhOpen = open( FHOPEN, ">$PDPHELPPATH/$ChelpPluginFilename" );
if ($fhOpen) {
binmode FHOPEN;
my $fh = $cgi->upload('helpPluginFilename');
if ( defined $fh ) {
while (<$fh>) { print FHOPEN; }
$ChelpPluginTextname .= ', Uploaded and wrote file OK!';
} else {
$uploadPluginStatus = 'UNKNOWN';
$ChelpPluginTextname .= ', Cannot upload PDF file!';
}
close FHOPEN;
} else {
$uploadPluginStatus = 'UNKNOWN';
$ChelpPluginFilename = '<NIHIL>';
$ChelpPluginTextname .= ', Cannot create PDF file!';
}
} else {
$uploadPluginStatus = 'UNKNOWN';
$ChelpPluginFilename = '<NIHIL>';
$ChelpPluginTextname .= ', PDF files only!';
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my ($title, $environmentLabel, $catalogIDSelect, $holidayBundleSelect, $matchingPlugins, $navigationBar, $generatePluginCrontabSchedulingReport);
my $urlWithAccessParameters = $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=$pageNo&pageOffset=$pageOffset&filter=$filter&catalogID=$CcatalogID";
# open connection to database and query data
$rv = 1;
$dbh = DBI->connect("dbi:mysql:$DATABASE:$SERVERNAMEREADWRITE:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE" ) or $rv = error_trap_DBI(*STDOUT, "Cannot connect to the database", $debug, $pagedir, $pageset, $htmlTitle, $subTit...
if ($dbh and $rv) {
$formDisabledAll = $formDisabledUniqueKey = '';
if ($action eq 'displayView') {
$formDisabledUniqueKey = $formDisabledAll = 'disabled';
$htmlTitle = "Display plugin $CuKey from $CcatalogID";
$nextAction = "listView" if ($rv);
} elsif ($action eq 'editView') {
$formDisabledUniqueKey = 'disabled';
$htmlTitle = "Update plugin $CuKey from $CcatalogID";
$submitButton = "Update";
$nextAction = "edit" if ($rv);
} elsif ($action eq 'edit') {
$htmlTitle = "Plugin $CuKey updated from $CcatalogID";
$sql = "select concat( LTRIM(SUBSTRING_INDEX(title, ']', -1)), ' (', $SERVERTABLENVIRONMENT.label, ')' ), shortDescription, trendline, helpPluginFilename, holidayBundleID from $SERVERTABLPLUGINS, $SERVERTABLENVIRONMENT where catalogID = '$Ccata...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID) if $rv;
if ( $rv ) {
my ($Otitle, $OshortDescription, $Otrendline, $OhelpPluginFilename, $OholidayBundleID) = $sth->fetchrow_array() or $rv = error_trap_DBI(*STDOUT, "Cannot $sth->fetchrow_array: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '',...
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$sql = 'UPDATE ' .$SERVERTABLPLUGINS. ' SET catalogID="' .$CcatalogID. '", uKey="' .$CuKey. '", shortDescription="' .$CshortDescription. '", trendline="' .$Ctrendline. '", helpPluginFilename="' .$ChelpPluginFilename. '", holidayBundleID="' .$...
( run in 0.522 second using v1.01-cache-2.11-cpan-39bf76dae61 )