Show GDBgui.pm syntax highlighted
#!/usr/bin/perl
package GDBgui;
do 'SITEDEF.pl';
use CGI ":all";
sub new{
my $class = shift;
my ($argHR) = @_;
my $self = {};
bless $self, ref($class) || $class;
return $self;
}
sub printXGDB_page{
my ($self,$cpHR) = @_;
$self->printXGDB_Head($cpHR);
$self->printXGDB_StartHtml($cpHR);
print $cpHR->{preHeader};
$self->print_SiteHeader($cpHR);
print "<div align=\"center\">" . $cpHR->{main} . "</div>\n";
print $cpHR->{preFooter};
$self->print_SiteFooter($cpHR);
$self->printXGDB_EndHtml($cpHR);
return 1;
}
sub printXGDB_Head{
my ($self,$cpHR) = @_;
## set default HTML <head> properties ($cpHR->{headHR})
print header(%{$cpHR->{headHR}}) . "\n";;
return 1;
}
sub printXGDB_StartHtml{
my ($self,$cpHR) = @_;
## set default HTML <html> properties ($cpHR->{htmlHR})
$cpHR->{htmlHR}->{-title} =(exists($cpHR->{htmlHR}->{-title})) ? $cpHR->{htmlHR}->{-title} : $SITENAME;
$cpHR->{htmlHR}->{-bgcolor} = "#FFFFFF" if(!exists($cpHR->{htmlHR}->{-bgcolor}));
$cpHR->{htmlHR}->{-style} = {-src=>$defaultStyleSheet} if(!exists($cpHR->{htmlHR}->{-style}));
if(exists($cpHR->{htmlHR}->{-onLoad})){
$cpHR->{htmlHR}->{-onLoad} .= 'reloadTracks();';
# $cpHR->{htmlHR}->{-onLoad} .= 'reloadTracks();mmLoadMenus();';
}elsif($cpHR->{htmlHR}->{-onLoad} !~ /reloadTracks\(/){
$cpHR->{htmlHR}->{-onLoad} = 'reloadTracks();';
# $cpHR->{htmlHR}->{-onLoad} = 'reloadTracks();mmLoadMenus();';
}
if(exists($cpHR->{htmlHR}->{-script})){
push(@{$cpHR->{htmlHR}->{-script}},({-src=>"${JSPATH}XGDBheader.js"},{-src=>"${JSPATH}tracks.js"},{-src=>"${JSPATH}gdbmenus.js"},{-src=>"${JSPATH}mm_menu.js"}));
}else{
$cpHR->{htmlHR}->{-script} = [{-src=>"${JSPATH}XGDBheader.js"},{-src=>"${JSPATH}tracks.js"},{-src=>"${JSPATH}gdbmenus.js"},{-src=>"${JSPATH}mm_menu.js"}];
}
print start_html(%{$cpHR->{htmlHR}}) . "\n";
return 1;
}
sub printXGDB_EndHtml{
my ($self,$cpHR) = @_;
print end_html();
return 1;
}
sub print_SiteHeader{
my ($self,$cpHR) = @_;
my $fontstyle = "'font-family: Verdana,Arial,sans-serif;font-size: 12px;'";
my $fontstyle2 = "'font-family: Verdana,Arial,sans-serif;font-size: 16px;'";
my $link_color = (exists($cpHR->{gseg_gi}))?'#0000FF':'#FFFFFF';
## Print header javascript
my $CHRLIST = join(',',@{$DBver[$cpHR->{dbid}]->{chrSIZE}});
print <<END_OF_PRINT;
<SCRIPT LANGUAGE="JavaScript">
var ChrLen = new Array(${CHRLIST});
var GSQwebpath = "${GSQwebpath}";
var UCAwebpath = "${ucaPATH}AnnotationTool.pl";
var CGIPATH = "${CGIPATH}";
var HAS_TRACK_CONTROL = 0;
var xgdb_state = "${SITENAMEshort}_state";
</SCRIPT>
END_OF_PRINT
## Print form tag and default inputs
print <<END_OF_PRINT;
<form METHOD="POST" ENCTYPE="multipart/form-data" NAME="guiFORM">
<input type="text" name="wsize" value="$cpHR->{wsize}" class='debug'>
<input type="text" name="resid" value="$cpHR->{resid}" class='debug'>
<input type="text" name="curDBID" value="$cpHR->{dbid}" class='debug'>
<input type="text" name="userid" value="$cpHR->{USERid}" class='debug'>
<input type="text" name="trackORDER" value="$cpHR->{trackORDER}" class='debug'>
<input type="text" name="trackVISIBLE" value="$cpHR->{trackVISIBLE}" class='debug'>
<input type="text" name="trackDATA" value="$cpHR->{trackDATA}" class='debug'>
<input type="text" name="customORDER" value="$cpHR->{customORDER}" class='debug'>
<input type="text" name="customVISIBLE" value="$cpHR->{customVISIBLE}" class='debug'>
END_OF_PRINT
## Print logo and title ( header top )
print <<END_OF_PRINT;
<MAP name="ftuLOGO">
<AREA shape="RECT" coords="0,0,136,18" href="${GDBDIR}site_map.php">
<AREA shape="RECT" coords="0,18,136,35" href="$WEBMASTER">
</MAP>
<div id='HeaderLogos'>
<a href="${GDBhome}"><img id='topLeftLogo' src="${TOP_LEFT_LOGO}"></a>
<img id='topCenterLogo' src="${TOP_CENTER_LOGO}">
<img id='topRightLogo' src="${TOP_RIGHT_LOGO}" usemap="#ftuLOGO">
</div>
END_OF_PRINT
## Print site nav row ( header row 1 )
print <<END_OF_PRINT;
<div id='HeaderRow1'>
<table id='navTable'>
<td><a href="${GDBhome}">Home</a></td>
<td><a href="${CGIPATH}search.pl">Search</a></td>
<td><a href="${CGIPATH}blastGDB.pl" onmousemove="window.status='Run BLAST';" onmouseout="window.status='';">BLAST @ ${SITENAMEshort}</a></td>
<td><a href="javascript:RunGeneSeqer();" onmousemove="window.status='Use GeneSeqer';" onmouseout="window.status='';">GeneSeqer @ ${SITENAMEshort}</a></td>
<td><a href="javascript:doAnnotation('$cpHR->{altCONTEXT}','$cpHR->{blastDB}');" onmousemove="window.status='Contribute an annotation';" onmouseout="window.status='';">Annotation @ ${SITENAMEshort}</a></td>
<td><a href="${GDBDIR}site_map.php">Site Map</a></td>
<td><a href="${GDBDIR}tutorial/">Tutorial</a></td>
</table>
</div>
END_OF_PRINT
## Print query search row ( header row 2 )
my $LOGGEDin = ((exists($cpHR->{USERid}))&&($cpHR->{USERid}))?
"<A CLASS='userID' HREF=\"javascript:goHome('${CGIPATH}UserHome.pl');\">$cpHR->{USERid} @ ${SITENAMEshort}</A>":
"Anonymous";
print <<END_OF_PRINT;
<div id='HeaderRow2'>
<P id='userIDleft'>$LOGGEDin</P>
<P id='userIDright'>$LOGGEDin</P>
<P id='searchCONTROL'>
<input class='searchINPUT' name="searchSTR" type="text" size=35 value="" onfocus="this.value=''" onKeyPress="check2KEY(event,'${CGIPATH}findRegion.pl','${CGIPATH}findRecord.pl')">
Search:
<INPUT class='searchINPUT' name="Genome" TYPE="button" VALUE="Genome" ONCLICK="submitTo('${CGIPATH}findRegion.pl');">
<INPUT class='searchINPUT' name="Records" TYPE="button" VALUE="Records" ONCLICK="submitTo('${CGIPATH}findRecord.pl');">
<A id="searchHELP" href="${DOCDIR}searchDOC.html"><IMG id='searchHELP' src="${IMAGEDIR}helpINFO.gif"></A>
</P>
</div>
END_OF_PRINT
## Print genome navigation row ( header row 3 )
my $chrDROPDOWN = '';
for($x=1;$x<=scalar(@{$DBver[$cpHR->{dbid}]->{chrSIZE}});$x++){
$chrDROPDOWN .= ($x == $cpHR->{chr})?" <OPTION VALUE=\"$x\" SELECTED>$x</OPTION>\n":" <OPTION VALUE=\"$x\">$x</OPTION>\n";
}
my $dbidDROPDOWN = '';
for($x=0;$x<=$#DBver;$x++){
$dbidDROPDOWN .= ($x == $cpHR->{dbid})?" <OPTION VALUE=\"$x\" SELECTED>$DBver[$x]->{DBtag}</OPTION>\n":" <OPTION VALUE=\"$x\">$DBver[$x]->{DBtag}</OPTION>\n";
}
my $loginMenu = ((exists($cpHR->{USERid}))&&($cpHR->{USERid}))?
"<A HREF=\"${PlantGDBadminPATH}logout.php\">Logout</A>":
"<A HREF=\"javascript:doLogin('${PlantGDBadminPATH}login.php?lastPage=$ENV{REQUEST_URI}');\">Login</A> / <A HREF=\"javascript:doRegister('${PlantGDBadminPATH}createAccount.php');\">Register</A>"
#"<A HREF=\"${PlantGDBadminPATH}login.php?lastPage=".$ENV{REQUEST_URI}."\" target=\"_blank\">Login</A> / <A HREF=\"javascript:doRegister('${PlantGDBadminPATH}createAccount.php');\">Register</A>"
;
my $ACname = '';
## print SITEDEF defined alternativecontexts
if(defined($altCONTEXT)){
foreach $ACname (keys %$altCONTEXT){
print <<END_OF_PRINT;
<div id='HeaderRow3_${ACname}'>
<p id='loginMenu'>$loginMenu</p>
<p id='annotationLink'><A HREF="javascript:doAnnotation('$cpHR->{altCONTEXT}','$cpHR->{blastDB}');">Provide Expert<BR>Annotation</A></p>
$altCONTEXT->{$ACname}
</div>
END_OF_PRINT
}
}
## print standard alternative context ( BAC )
if(!exists($altCONTEXT->{BAC})){
print <<END_OF_PRINT;
<div id='HeaderRow3_BAC'>
<p id='loginMenu'>$loginMenu</p>
<p id='annotationLink'><A HREF="javascript:doAnnotation('$cpHR->{altCONTEXT}','$cpHR->{blastDB}');">Provide Expert<BR>Annotation</A></p>
<p class='navCONTROL' id='bacNav'>
BAC / Clone gi-<INPUT NAME="gseg_gi" class='navINPUT' TYPE="text" VALUE="$cpHR->{gseg_gi}" SIZE=12><BR>
Start:<INPUT NAME="bac_lpos" class='navINPUT' TYPE="text" VALUE="$cpHR->{l_pos}" SIZE=12 onKeyPress="checkEnter(event,'')">
End:<INPUT NAME="bac_rpos" class='navINPUT' TYPE="text" VALUE="$cpHR->{r_pos}" SIZE=12 onKeyPress="checkEnter(event,'')">
<INPUT NAME="bac_GoButton" class='navINPUT' TYPE="button" VALUE="Go" ONCLICK="getRegion('${CGIPATH}getGSEG_Region.pl');">
</p>
</div>
END_OF_PRINT
}
## print default context ( pseudo-chromosome )
print <<END_OF_PRINT;
<div id='HeaderRow3_pCHR'>
<p id='loginMenu'>$loginMenu</p>
<p id='annotationLink'><A HREF="javascript:doAnnotation('$cpHR->{altCONTEXT}','$cpHR->{blastDB}');">Provide Expert<BR>Annotation</A></p>
<p class='navCONTROL' id='pseudochromosomeNav'>
${COMMONORGN} Genome Assembly<SELECT ID="dbid" NAME="dbid" class='navINPUT'>${dbidDROPDOWN}</SELECT><BR>
Chromosome:<SELECT ID="chr" NAME="chr" class='navINPUT'>${chrDROPDOWN}</SELECT>
Start:<INPUT NAME="l_pos" class='navINPUT' TYPE="text" VALUE="$cpHR->{l_pos}" SIZE=12 onKeyPress="checkEnter(event,'')">
End:<INPUT NAME="r_pos" class='navINPUT' TYPE="text" VALUE="$cpHR->{r_pos}" SIZE=12 onKeyPress="checkEnter(event,'')">
<INPUT NAME="GoButton" class='navINPUT' TYPE="button" VALUE="Go" ONCLICK="getRegion('${CGIPATH}getRegion.pl');">
</p>
</div>
END_OF_PRINT
#####################################################
#print "<HR><P>" . join(':',@INC) . "</P><HR>";
return 1;
}
sub print_LeftSidebar{
my($self) = @_;
do 'xgdbSidebarLEFT.pl'; ## define @sidebarLinks
my @links = (); my $linkAR = '';
foreach $linkAR (@sidebarLinks){
push(@links,a($linkAR->[0],$linkAR->[1]));
}
my $link_list = ul({-type=>'none',-id=>'LinkList'},li({-class=>'LinkList'},\@links));
print <<END_OF_PRINT;
<div id='LeftSidebar'>
<h3 class='GroupID'>Links</h3>
$link_list
<h3 class='GroupID'> </h3>
END_OF_PRINT
my $menu = "";
my $NavLinkGroup = "";
@sidebarNavMenuORDER = sort {return $a cmp $b;} keys %sidebarNavMenu if(! scalar(@sidebarNavMenuORDER));
foreach $menu (@sidebarNavMenuORDER){
if(exists($sidebarNavMenu{$menu})){
@links = ();
$linkAR = shift(@{$sidebarNavMenu{$menu}});
$NavLinkGroup = a($linkAR->[0],$menu);
print stderr ">> $#$linkAR << \n";
if(scalar(@{$sidebarNavMenu{$menu}})){
my $NLGheader = a({-class=>'NLGheader',%{$linkAR->[0]}},$linkAR->[1]) if($#$linkAR);
foreach $linkAR (@{$sidebarNavMenu{$menu}}){
$linkAR->[0]{-class} = 'NavLink';
push(@links,a($linkAR->[0],$linkAR->[1]));
}
print "<div class='NavMenu' onmouseover='IEsucksAtCSS(this,\"NavMenu_hover\");' onmouseout='IEsucksAtCSS(this,\"NavMenu\");'>\n";
print ul({-id=>"${menu}NLG",-class=>'NavLinkGroup'},li({-class=>'NLGheader'},[$NLGheader]) . li({-class=>"${menu}NLG"},\@links));
print "\n${NavLinkGroup}\n<img id='arrow' src='${IMAGEDIR}GDBmenuArrow2.png'><img id='mo_arrow' src='${IMAGEDIR}GDBmenuArrow.png'></div>\n";
}else{
print "<div class='NavMenu'>${NavLinkGroup}</div>\n";
}
}
}
print <<END_OF_PRINT;
<div class='NavMenu'><a href="${GDBDIR}resource.php">Data & Methods</a></div>
<div class='NavMenu'><a href="${GDBDIR}download.php">Downloads</a></div>
</div>
END_OF_PRINT
return 1;
}
sub print_RightSidebar{
my ($self) = @_;
do 'xgdbSidebarRIGHT.pl'; ## define @sidebarNoteworthy
my @links = (); my $linkAR = '';
foreach $linkAR (@sidebarNoteworthy){
push(@links,a($linkAR->[0],$linkAR->[1]));
}
my $noteworthy_list = ul({-type=>'none',-id=>'NoteworthyList'},li({-class=>'NoteworthyList'},\@links));
print <<END_OF_PRINT;
<div id="RightSidebar">
<h3 class='GroupID'>Noteworthy</h3>
$noteworthy_list
</div>
END_OF_PRINT
return 1;
}
sub print_SiteFooter{
my ($self) = @_;
print <<END_OF_PRINT;
<HR id='footer'>
<table border=0 width="100%" !cellspacing="30" cellpadding="2" align="center">
<td align="center" valign="bottom"><a href="http://www.plantgdb.org/AtGDB/" style="text-decoration:none;">
<img src="${IMAGEDIR}AtGDB_logo.png" width=100 border=0>
<br><font style="font-size:10pt; font-family:Arial; text-decoration:underline;">AtGDB</font></a></font></td>
<td align="center" valign="bottom"><a href="http://www.plantgdb.org/" style="text-decoration:none;">
<img src="${IMAGEDIR}PlantGDB.gif" width=75 border=0>
<br><font style="font-size:10pt; font-family:Arial; text-decoration:underline;">PlantGDB</a></font></td>
<td align="center" valign="bottom"><a href="http://www.maizegdb.org/" style="text-decoration:none;">
<img src="${IMAGEDIR}maizeGDB.gif" width=125 border=0>
<br><font style="font-size:10pt; font-family:Arial; text-decoration:underline;">MaizeGDB</font></a></td>
<td align="center" valign="bottom"><a href="http://www.nsf.gov/bio/dbi/dbi_pgr.htm" style="text-decoration:none;">
<img src="${IMAGEDIR}nsfgray.gif" border=0 height=50>
<br><font style="font-size:10pt; font-family:Arial; text-decoration:underline;">NSF Plant Genome Research</font></a></td>
<td align="center" valign="bottom"><a href="http://gremlin1.gdcb.iastate.edu/~volker/" style="text-decoration:none;">
<img src="${IMAGEDIR}BGlogo.jpg" width=60 border=0>
<br><font style="font-size:10pt; font-family:Arial; text-decoration:underline;">Brendel Group</font></a></td>
<td align="center" valign="bottom"><a href="http://www.plantsciences.iastate.edu/" style="text-decoration:none;">
<img src="${IMAGEDIR}PSI.gif" width=60 border=0>
<br><font style="font-size:10pt; font-family:Arial; text-decoration:underline;">Plant Sciences Institute</font></a></td>
<td align="center" valign="bottom"><a href="http://www.iastate.edu/" style="text-decoration:none;">
<img src="${IMAGEDIR}isu.gif" border=0 width=100>
<br><font style="font-size:10pt; font-family:Arial; text-decoration:underline;">Iowa State University</font></a></td>
</table>
</form>
END_OF_PRINT
return 1;
}
See more files for this project here