ASNMTAP
view release on metacpan or search on metacpan
applications/htmlroot/cgi-bin/moderator/downtimes.pl view on Meta::CPAN
$CactivationTimeslot = $CentryTimeslot;
}
if ($CsuspentionDate eq '' or $CsuspentionTime eq '') {
$CsuspentionDate = "0000-00-00";
$CsuspentionTime = "00:00:00";
$CsuspentionTimeslot = "9999999999";
}
my $dummyInstability = ($Cinstability eq 'on') ? 1 : 0;
my $dummyPersistent = ($Cpersistent eq 'on') ? 1 : 0;
my $dummyDowntime = ($Cdowntime eq 'on') ? 1 : 0;
foreach $catalogID_uKey (@CatalogIDuKeyList) {
my ($catalogID, $uKey) = split(/_/, $catalogID_uKey);
unless ( defined $uKey ) {
$uKey = $catalogID;
$catalogID = $CcatalogID;
}
($rv, $Ctitle) = get_title( $dbh, $rv, $catalogID, $uKey, $debug, -1, $sessionID );
$CatalogIDuKeyListStatus .= "<tr><td>$uKey from $catalogID</td>";
if ($rv and defined $Ctitle) {
$sql = 'INSERT INTO ' .$SERVERTABLCOMMENTS. ' SET catalogID="' .$catalogID. '", uKey="' .$uKey. '", replicationStatus="I", title="' .$Ctitle. '", entryDate="' .$CentryDate. '", entryTime="' .$CentryTime.'", entryTimeslot="' .$CentryTimesl...
$CatalogIDuKeyListStatus .= "<td>$Ctitle</td></tr>";
if ( $debug eq 'F' ) {
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
} else {
$CatalogIDuKeyListStatus .= "<tr><td> </td><td>$sql</td></tr>";
}
} else {
$CatalogIDuKeyListStatus .= "<td>NOT found</td></tr>";
}
}
}
$dbh->disconnect or $rv = error_trap_DBI(*STDOUT, "Sorry, the database was unable to add your entry.", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
if ( $rv ) {
# HTML - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if ($action eq 'insertView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', "<script type=\"text/javascript\" language=\"JavaScript\" src=\"$HTTPSURL/TimeParserValidator.js\"></script>\n <script type=\"text/javascript\" language=\"JavaS...
my ($firstYear, $firstMonth, $firstDay) = Add_Delta_Days ($currentYear, $currentMonth, $currentDay, -1);
print <<HTML;
<script language="JavaScript" type="text/javascript" id="jsCal1Calendar">
var cal1Calendar = new CalendarPopup("CalendarDIV");
cal1Calendar.offsetX = 1;
cal1Calendar.showNavigationDropdowns();
cal1Calendar.addDisabledDates(null, "$firstYear-$firstMonth-$firstDay");
</script>
<DIV ID="CalendarDIV" STYLE="position:absolute;visibility:hidden;background-color:black;layer-background-color:black;"></DIV>
<script language="JavaScript1.2" type="text/javascript">
function validateForm() {
var now = new Date();
currentlyFullYear = now.getFullYear();
currentlyMonth = now.getMonth();
currentlyDay = now.getDate();
currentlyHours = now.getHours();
currentlyMinutes = now.getMinutes();
currentlySeconds = now.getSeconds();
var nowEpochtime = Date.UTC(currentlyFullYear, currentlyMonth, currentlyDay, currentlyHours, currentlyMinutes, currentlySeconds);
var objectRegularExpressionDateFormat = /\^20\\d\\d-\\d\\d-\\d\\d\$/;
var objectRegularExpressionDateValue = /\^20\\d\\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])\$/;
var objectRegularExpressionTimeFormat = /\^\\d\\d:\\d\\d:\\d\\d\$/;
var objectRegularExpressionTimeValue = /\^[0-1]\\d|2[0-3]:[0-5]\\d:[0-5]\\d\$/;
if( document.downtimes.uploadFilename.value == null || document.downtimes.uploadFilename.value == '' ) {
document.downtimes.uploadFilename.focus();
alert('Please upload the applications uKey list!');
return false;
}
if( document.downtimes.remoteUser.options[document.downtimes.remoteUser.selectedIndex].value == 'none' ) {
document.downtimes.remoteUser.focus();
alert('Please create/select one of the remote users!');
return false;
}
if ( document.downtimes.commentData.value == null || document.downtimes.commentData.value == '' ) {
document.downtimes.commentData.focus();
alert('Please enter a comment!');
return false;
}
if ( document.downtimes.activationDate.value != null && document.downtimes.activationDate.value != '' ) {
if ( ! objectRegularExpressionDateFormat.test(document.downtimes.activationDate.value) ) {
document.downtimes.activationDate.focus();
alert('Please re-enter activation date: Bad date format!');
return false;
}
if ( ! objectRegularExpressionDateValue.test(document.downtimes.activationDate.value) ) {
document.downtimes.activationDate.focus();
alert('Please re-enter activation date: Bad date value!');
return false;
}
}
if ( ( document.downtimes.activationDate.value == '' && document.downtimes.activationTime.value != '' ) || ( document.downtimes.activationDate.value != '' && document.downtimes.activationTime.value == '' ) ) {
if ( document.downtimes.activationDate.value == '' ) {
document.downtimes.activationDate.focus();
alert('Please enter one activation date!');
} else {
document.downtimes.activationTime.focus();
alert('Please enter one activation time!');
}
return false;
} else if ( document.downtimes.activationDate.value != '' && document.downtimes.activationTime.value != '' ) {
if ( ! objectRegularExpressionTimeFormat.test(document.downtimes.activationTime.value) ) {
applications/htmlroot/cgi-bin/moderator/downtimes.pl view on Meta::CPAN
document.downtimes.suspentionDate.focus();
alert('Please re-enter suspention date: Bad date value!');
return false;
}
}
if ( ( document.downtimes.suspentionDate.value == '' && document.downtimes.suspentionTime.value != '' ) || ( document.downtimes.suspentionDate.value != '' && document.downtimes.suspentionTime.value == '' ) ) {
if ( document.downtimes.suspentionDate.value == '' ) {
document.downtimes.suspentionDate.focus();
alert('Please enter one suspention date!');
} else {
document.downtimes.suspentionTime.focus();
alert('Please enter one suspention time!');
}
return false;
} else if ( document.downtimes.suspentionDate.value != '' && document.downtimes.suspentionTime.value != '' ) {
if ( ! objectRegularExpressionTimeFormat.test(document.downtimes.suspentionTime.value) ) {
document.downtimes.suspentionTime.focus();
alert('Please re-enter suspention time: Bad time format!');
return false;
} else if ( ! objectRegularExpressionTimeValue.test(document.downtimes.suspentionTime.value) ) {
document.downtimes.suspentionTime.focus();
alert('Please re-enter suspention time: Bad time value!');
return false;
}
}
var suspentionEpochtime = 0;
if ( document.downtimes.suspentionTime.value != null && document.downtimes.suspentionTime.value != '' ) {
suspentionDate = document.downtimes.suspentionDate.value;
suspentionFullYear = suspentionDate.substring(0, 4);
suspentionMonth = suspentionDate.substring(5, 7) - 1;
suspentionDay = suspentionDate.substring(8, 10);
suspentionTime = document.downtimes.suspentionTime.value;
suspentionHours = suspentionTime.substring(0, 2);
suspentionMinutes = suspentionTime.substring(3, 5);
suspentionSeconds = suspentionTime.substring(6, 8);
suspentionEpochtime = Date.UTC(suspentionFullYear, suspentionMonth, suspentionDay, suspentionHours, suspentionMinutes, suspentionSeconds);
if ( nowEpochtime > suspentionEpochtime ) {
document.downtimes.suspentionDate.focus();
alert('Please re-enter suspention date/time: Date/Time are into the past!');
return false;
}
}
if ( activationEpochtime != 0 && suspentionEpochtime != 0 ) {
if ( activationEpochtime > suspentionEpochtime ) {
document.downtimes.activationDate.focus();
alert('Please re-enter activation/suspention date/time: Activation Date/Time > Suspention Date/Time !');
return false;
}
}
return true;
}
</script>
<form action="$ENV{SCRIPT_NAME}" method="post" name="downtimes" enctype="multipart/form-data" onSubmit="return validateForm();">
<input type="hidden" name="pagedir" value="$pagedir">
<input type="hidden" name="pageset" value="$pageset">
<input type="hidden" name="debug" value="$debug">
<input type="hidden" name="CGISESSID" value="$sessionID">
<input type="hidden" name="pageNo" value="$pageNo">
<input type="hidden" name="pageOffset" value="$pageOffset">
<input type="hidden" name="action" value="$nextAction">
HTML
} else {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print "<br>\n";
}
print <<HTML;
<table width="100%" border="0" cellspacing="0" cellpadding="0">
HTML
if ( $action eq 'insert' and $userType != 0 ) {
print <<HTML;
<tr align="center"><td colspan="2">
<table border="0" cellspacing="0" cellpadding="0"><tr>
<td class="StatusItem"><a href="$urlWithAccessParameters&action=insertView">[Insert downtimes]</a></td>
<td class="StatusItem"> </td>
</tr></table>
</td></tr>
HTML
}
print "<tr><td colspan=\"2\"> </td></tr>";
if ($action eq 'insertView') {
my $instabilityDisabled = ($userType < 2) ? 'disabled' : '';
my $persistentDisabled = 'disabled';
my $downtimeDisabled = 'disabled';
my $instabilityChecked = ($Cinstability eq 'on') ? ' checked' : '';
my $persistentChecked = ($Cpersistent eq 'on') ? ' checked' : '';
my $downtimeChecked = ($Cdowntime eq 'on') ? ' checked' : '';
print <<HTML;
<tr><td><table border="0" cellspacing="0" cellpadding="0">
<tr><td><b>Catalog ID: </b></td><td>
<input type="text" name="catalogID" value="$CcatalogID" size="5" maxlength="5" disabled>
</td></tr>
<tr><td><b>Applications uKey List: </b></td><td>
<input type="file" name="uploadFilename" size="100" accept="text/plain">
</td></tr><tr><td><b>Remote User: </b></td><td>
$remoteUsersSelect
</td>
</tr><tr>
<td valign="top"><b>Comment: </b></td>
<td><textarea name=commentData cols=84 rows=13>$CcommentData</textarea></td>
</tr><tr>
<td><b>Instability: </b></td>
<td><b><input type="checkbox" name="instability" $instabilityChecked $instabilityDisabled></b> 'checked' means 'instability' and 'not checked' means 'not instability'</td>
</tr><tr>
<td><b>Persistent: </b></td>
<td><b><input type="checkbox" name="persistent" $persistentChecked $persistentDisabled></b> 'checked' means 'persistent' and 'not checked' means 'not persistent'</td>
</tr><tr><td> </td><td>
When 'Instability' and 'Persistent' are checked, this 'comment' will be not visible into the 'Minimal Condenced View'
( run in 0.862 second using v1.01-cache-2.11-cpan-483215c6ad5 )