ASNMTAP
view release on metacpan or search on metacpan
applications/htmlroot/cgi-bin/admin/timeperiods.pl view on Meta::CPAN
$sql = 'UPDATE ' .$SERVERTABLTIMEPERIODS. ' SET catalogID="' .$CcatalogID. '", timeperiodID="' .$CtimeperiodID. '", timeperiodAlias="' .$CtimeperiodAlias. '", timeperiodName="' .$CtimeperiodName. '", sunday="' . $Csunday. '", monday="' . $Cmo...
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
$htmlTitle = "Timeperiod $CtimeperiodID from $CcatalogID updated";
} else {
$htmlTitle = "Timeperiod $CtimeperiodID from $CcatalogID not deactivated and updated, still used by";
}
} elsif ($action eq 'listView') {
$formDisabledPrimaryKey = '';
$htmlTitle = "All timeperiods listed";
if ( $CcatalogIDreload ) {
$pageNo = 1;
$pageOffset = 0;
}
$sql = "select catalogID, catalogName from $SERVERTABLCATALOG where not catalogID = '$CATALOGID' and activated = '1' order by catalogName asc";
($rv, $catalogIDSelect, undef) = create_combobox_from_DBI ($rv, $dbh, $sql, 1, '', $CcatalogID, 'catalogID', $CATALOGID, '-Parent-', '', 'onChange="javascript:submitForm();"', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$sql = "select SQL_NO_CACHE count(timeperiodID) from $SERVERTABLTIMEPERIODS where catalogID = '$CcatalogID'";
($rv, $numberRecordsIntoQuery) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$navigationBar = record_navigation_bar ($pageNo, $numberRecordsIntoQuery, $RECORDSONPAGE, $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&action=listView&catalogID=$CcatalogID&or...
$navigationBar .= record_navigation_bar_alpha ($rv, $dbh, $SERVERTABLTIMEPERIODS, 'timeperiodName', "catalogID = '$CcatalogID'", $numberRecordsIntoQuery, $RECORDSONPAGE, $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$deb...
$sql = "select catalogID, timeperiodID, timeperiodName, activated from $SERVERTABLTIMEPERIODS where $SERVERTABLTIMEPERIODS.catalogID = '$CcatalogID' order by $orderBy limit $pageOffset, $RECORDSONPAGE";
$header = "<th><a href=\"$urlWithAccessParameters&action=listView&orderBy=catalogID desc, timeperiodID asc\"><IMG SRC=\"$IMAGESURL/$ICONSRECORD{up}\" ALT=\"Up\" BORDER=0></a> Catalog ID <a href=\"$urlWithAccessParameters&action=list...
($rv, $matchingTimeperiods, $nextAction) = record_navigation_table ($rv, $dbh, $sql, 'Timeperiod', 'catalogID|timeperiodID', '0|1', '', '', '', $orderBy, $header, $navigationBar, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $nextAction, $pag...
}
if ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView') {
$sql = "select catalogID, timeperiodID, timeperiodAlias, timeperiodName, sunday, monday, tuesday, wednesday, thursday, friday, saturday, activated from $SERVERTABLTIMEPERIODS where catalogID = '$CcatalogID' and timeperiodID = '$CtimeperiodID'";
$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 ) {
($CcatalogID, $CtimeperiodID, $CtimeperiodAlias, $CtimeperiodName, $Csunday, $Cmonday, $Ctuesday, $Cwednesday, $Cthursday, $Cfriday, $Csaturday, $Cactivated) = $sth->fetchrow_array() or $rv = error_trap_DBI(*STDOUT, "Cannot $sth->fetchrow_arr...
if ($action eq 'duplicateView') {
$CcatalogID = $CATALOGID;
$CtimeperiodID = 'new';
}
$Cactivated = ($Cactivated == 1) ? 'on' : 'off';
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
}
$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 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print <<HTML;
<script language="JavaScript1.2" type="text/javascript">
function validateForm() {
var objectRegularExpressionTimeFormat = /\^\\d\\d:\\d\\d-\\d\\d:\\d\\d(,\\d\\d:\\d\\d-\\d\\d:\\d\\d){0,2}\$/;
var objectRegularExpressionTimeValue = /\^(([0-1]\\d|2[0-3]):[0-5]\\d|24:00)-(([0-1]\\d|2[0-3]):[0-5]\\d|24:00)(,(([0-1]\\d|2[0-3]):[0-5]\\d|24:00)-(([0-1]\\d|2[0-3]):[0-5]\\d|24:00)){0,3}\$/;
if ( document.timeperiods.timeperiodAlias.value == null || document.timeperiods.timeperiodAlias.value == '' ) {
document.timeperiods.timeperiodAlias.focus();
alert('Please enter a timeperiod alias!');
return false;
}
if ( document.timeperiods.timeperiodName.value == null || document.timeperiods.timeperiodName.value == '' ) {
document.timeperiods.timeperiodName.focus();
alert('Please enter a timeperiod name!');
return false;
}
if ( document.timeperiods.sunday.value != null && document.timeperiods.sunday.value != '' ) {
if ( ! objectRegularExpressionTimeFormat.test(document.timeperiods.sunday.value) ) {
document.timeperiods.sunday.focus();
alert('Please re-enter sunday time: Bad time format!');
return false;
} else if ( ! objectRegularExpressionTimeValue.test(document.timeperiods.sunday.value) ) {
document.timeperiods.sunday.focus();
alert('Please re-enter sunday time: Bad time value!');
return false;
}
}
if ( document.timeperiods.monday.value != null && document.timeperiods.monday.value != '' ) {
if ( ! objectRegularExpressionTimeFormat.test(document.timeperiods.monday.value) ) {
document.timeperiods.monday.focus();
alert('Please re-enter monday time: Bad time format!');
return false;
} else if ( ! objectRegularExpressionTimeValue.test(document.timeperiods.monday.value) ) {
document.timeperiods.monday.focus();
alert('Please re-enter monday time: Bad time value!');
return false;
}
}
if ( document.timeperiods.tuesday.value != null && document.timeperiods.tuesday.value != '' ) {
if ( ! objectRegularExpressionTimeFormat.test(document.timeperiods.tuesday.value) ) {
document.timeperiods.tuesday.focus();
alert('Please re-enter tuesday time: Bad time format!');
return false;
} else if ( ! objectRegularExpressionTimeValue.test(document.timeperiods.tuesday.value) ) {
document.timeperiods.tuesday.focus();
alert('Please re-enter tuesday time: Bad time value!');
return false;
}
}
if ( document.timeperiods.wednesday.value != null && document.timeperiods.wednesday.value != '' ) {
if ( ! objectRegularExpressionTimeFormat.test(document.timeperiods.wednesday.value) ) {
document.timeperiods.wednesday.focus();
alert('Please re-enter wednesday time: Bad time format!');
return false;
} else if ( ! objectRegularExpressionTimeValue.test(document.timeperiods.wednesday.value) ) {
document.timeperiods.wednesday.focus();
alert('Please re-enter wednesday time: Bad time value!');
return false;
}
}
if ( document.timeperiods.thursday.value != null && document.timeperiods.thursday.value != '' ) {
if ( ! objectRegularExpressionTimeFormat.test(document.timeperiods.thursday.value) ) {
document.timeperiods.thursday.focus();
alert('Please re-enter thursday time: Bad time format!');
return false;
} else if ( ! objectRegularExpressionTimeValue.test(document.timeperiods.thursday.value) ) {
document.timeperiods.thursday.focus();
alert('Please re-enter thursday time: Bad time value!');
return false;
}
}
if ( document.timeperiods.friday.value != null && document.timeperiods.friday.value != '' ) {
if ( ! objectRegularExpressionTimeFormat.test(document.timeperiods.friday.value) ) {
document.timeperiods.friday.focus();
alert('Please re-enter friday time: Bad time format!');
return false;
} else if ( ! objectRegularExpressionTimeValue.test(document.timeperiods.friday.value) ) {
document.timeperiods.friday.focus();
alert('Please re-enter friday time: Bad time value!');
return false;
}
}
if ( document.timeperiods.saturday.value != null && document.timeperiods.saturday.value != '' ) {
if ( ! objectRegularExpressionTimeFormat.test(document.timeperiods.saturday.value) ) {
document.timeperiods.saturday.focus();
alert('Please re-enter saturday time: Bad time format!');
return false;
} else if ( ! objectRegularExpressionTimeValue.test(document.timeperiods.saturday.value) ) {
document.timeperiods.saturday.focus();
alert('Please re-enter saturday time: Bad time value!');
return false;
}
}
return true;
}
</script>
<form action="$ENV{SCRIPT_NAME}" method="post" name="timeperiods" onSubmit="return validateForm();">
HTML
} elsif ($action eq 'listView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print <<HTML;
<script language="JavaScript1.2" type="text/javascript">
function submitForm() {
document.timeperiods.catalogIDreload.value = 1;
document.timeperiods.submit();
return true;
}
</script>
<form action="$ENV{SCRIPT_NAME}" method="post" name="timeperiods">
HTML
} elsif ($action eq 'deleteView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print "<form action=\"" . $ENV{SCRIPT_NAME} . "\" method=\"post\" name=\"timeperiods\">\n";
$pageNo = 1; $pageOffset = 0;
} else {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
}
if ($action eq 'deleteView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView' or $action eq 'listView') {
print <<HTML;
<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">
<input type="hidden" name="orderBy" value="$orderBy">
<input type="hidden" name="catalogIDreload" value="0">
HTML
} else {
print "<br>\n";
}
print " <input type=\"hidden\" name=\"catalogID\" value=\"$CcatalogID\">\n <input type=\"hidden\" name=\"timeperiodID\" value=\"$CtimeperiodID\">\n" if ($formDisabledPrimaryKey ne '' and $action ne 'displayView');
print <<HTML;
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center"><td>
<table border="0" cellspacing="0" cellpadding="0"><tr>
HTML
if ( $iconAdd ) {
print <<HTML;
<td class="StatusItem"><a href="$urlWithAccessParameters&action=insertView&orderBy=$orderBy">[Insert timeperiod]</a></td>
<td class="StatusItem"> </td>
HTML
}
print <<HTML;
<td class="StatusItem"><a href="$urlWithAccessParameters&action=listView&orderBy=$orderBy">[List all timeperiods]</a></td>
</tr></table>
</td></tr>
HTML
( run in 0.997 second using v1.01-cache-2.11-cpan-483215c6ad5 )