Show UCAcheckout.pl syntax highlighted
#!/usr/bin/perl
use DBI;
use CGI ':all';
do 'UCAheader.pl';
if ($USERfname eq 'ADMIN'){ # only display page for admins
$geneId = param('mode');
if ($geneId){
$sql = "insert into admin_session (USERid,geneId,checked_out_date) VALUES ('$USERid','$geneId',now())";
$DBH->do($sql);
}
$ownedRef = getAdminOwnership();
%statusHash = (
'aREVIEW' => '0',
'ACCEPTED' => '0',
'REJECTED' => '0'
);
$sql = "select geneId,modDate,status,USERid,chr from user_gene_annotation where status != 'SAVED' order by status, modDate desc";
$UCAref = $DBH->selectall_arrayref($sql);
$page .= "<span class=mainT><font style='font-weight:bold;font-size:24px'>User Contributed Annotation System<br>
Administration Tool - List of Annotations</font><br>
<font style='font-weight:bold;font-size:14px'> $specieName ($dbTitle)</font><br><br>
<br><br>
<a href='../UserHome.pl'>User Home</a><br></span><br><Br><br>";
$page .= "<table class=mainT width=600><tr class='headRow'><td>Annotation ID</td><td>Owner</td><td>Last Modified</td><td>Chromosome</td><td>Checked out by Admin?</td></tr>";
$tablePage = "";
$beenHere = 0;
for (my $i=0;$i<scalar(@$UCAref);$i++){
($geneId,$modDate,$status,$owner,$chr) = @{$UCAref->[$i]};
if ($statusHash{$status}==0){
#$tablePage .= ($beenHere) ? "\n</div>\n" : "";
$beenHere = 1;
$tablePage .= "<tr class='catRow'><td colpsan=5>$status</td></tr>\n";
# $tablePage .= "<div id='$status' style='height:20px;width:400px;overflow:auto;background:blue;'>\n";
$statusHash{$status} = 1;
}
if ( !$$ownedRef{$geneId} || ($$ownedRef{$geneId} eq $USERid)){
$tablePage .= "<tr><td class='myLink'><a target=\"_blank\" onClick=\"checkout('$geneId');\">$geneId</a></td>";
}else{
$tablePage .= "<tr class='checked'><td>$geneId</td>";
}
$tablePage .= "<td>$owner</td><td>$modDate</td><td>$chr</td><td>$$ownedRef{$geneId}</td></tr>\n";
}
# for empty status
for my $k (keys %statusHash){
if ($statusHash{$k} == 0){
$tablePage .= "<tr><td class='catRow' colpsan=5>$k</td></tr>\n";
$statusHash{$k} = 1;
}
}
#$tablePage .= "</div>";
$tablePage .= "</table><br><br><br>";
$page .= $tablePage;
print header();
$HTML_head = <<END_OF_HEAD;
<html>
<head>
<title>UCA Administration Annotation Check Out Page</title>
<style>
.myLink a {background:white; color:black; text-decoration:none;}
.myLink a:hover {background:#f4a30c; cursor:pointer;}
.mainT {font-family:Arial;font-size:11px;}
.checked {font-family:Arial;font-size:11px;background-color:lightyellow}
.headRow {font-family:Arial;font-size:14px;font-weight:bold}
.catRow {font-family:Arial;font-size:14px;background-color:lightblue}
</style>
<script>
function checkout(id){
Sname = id;
illChar = new RegExp("[-_\s\.]","g");
Sname = Sname.replace(illChar,"");
window.open("${rootPATH}${CGIPATH}UCA/UCAview.pl?seqUID=" + id, 'UCA'+id,'resizable=yes,screenX=100,screenY=100,top=100,left=100,toolbar=no,status=yes,scrollbars=yes,location=yes,menubar=no,directories=no,width=800,height=600');
document.forms.tFrm.mode.value = id;
document.forms.tFrm.submit();
return;
}
</script>
</head>
<body><form name='tFrm' method=post><input type=hidden name=mode value="">$mode
END_OF_HEAD
print $HTML_head;
print $page;
print "<input type=submit value='Reload Page'><br>";
print "</form></body></html>";
}else{
print header();
print "Action not allowed.";
}
See more files for this project here