Skagit Ground Water Model
Publications and Products
#!/usr/bin/perl -- -*-perl-*-
# This script displays the navigation bar for all project pages.
#----------------------------------------------------------------------------------------------------------------------
# Print html header
#----------------------------------------------------------------------------------------------------------------------
print "Content-type: text/html\n\n";
#----------------------------------------------------------------------------------------------------------------------
# Retrieve query string and specify variables for links.
#----------------------------------------------------------------------------------------------------------------------
$publications_link = "
Publications and Products | ";
$links_link = "
Related Links | ";
$news_link = "
News Releases | ";
$data_link = "
Data | ";
$maps_link = "
Maps | ";
$science_link = "
Scientific Topics | ";
$bibliography_link = "
Bibliography | ";
$status_link = "
Status | ";
$database_link = "
Database | ";
$acknowledge_link = "
Acknowledgments | ";
$photo_link = "
Photo Gallery | ";
$asses_link = "
Assessment Document | ";
$gis_link = "
GIS and Aerial Photography Sources | ";
$contact_link = "
Contact Us | ";
$flood_link = "
Flood Hazards | ";
$path = $ENV{'QUERY_STRING'};
$path =~ s/%([0-9|A-F]{2})/pack("C",hex($1))/eg;
$path =~ s/[;<>\*\|'&\$!#\(\)\[\]\{\}:"\\\/]//g;
$path = "../projects/".$path."/includes/".$path.".config";
#----------------------------------------------------------------------------------------------------------------------
# Open the configuration file for the specific project.
#----------------------------------------------------------------------------------------------------------------------
require $path;
#----------------------------------------------------------------------------------------------------------------------
# Print table head
#----------------------------------------------------------------------------------------------------------------------
print qq~
| |
| Project Home |
~;
#----------------------------------------------------------------------------------------------------------------------
# Determine which links to display for specific project, based on configuration file.
#----------------------------------------------------------------------------------------------------------------------
while ($status > 0) {
print "$status_link";
$status = 0;
}
while ($publications > 0) {
print "$publications_link";
$publications = 0;
}
while ($links > 0) {
print "$links_link";
$links = 0;
}
while ($news > 0) {
print "$news_link";
$news = 0
}
while ($data > 0) {
print "$data_link";
$data =0;
}
while ($maps > 0) {
print "$maps_link";
$maps = 0;
}
while ($science > 0) {
print "$science_link";
$science = 0;
}
while ($bibliography > 0) {
print "$bibliography_link";
$bibliography = 0;
}
while ($database > 0) {
print "$database_link";
$database = 0;
}
while ($acknowledge > 0) {
print "$acknowledge_link";
$acknowledge = 0;
}
while ($photo > 0) {
print "$photo_link";
$photo = 0;
}
while ($asses > 0) {
print "$asses_link";
$asses = 0;
}
while ($gis > 0) {
print "$gis_link";
$gis = 0;
}
while ($contact > 0) {
print "$contact_link";
$contact = 0;
}
while ($flood > 0) {
print "$flood_link";
$flood = 0;
}
#----------------------------------------------------------------------------------------------------------------------
# Print table footer
#----------------------------------------------------------------------------------------------------------------------
print qq~
Project Summaries |
Partnerships |
|
|
~;
#----------------------------------------------------------------------------------------------------------------------
# End Script
#----------------------------------------------------------------------------------------------------------------------
#!/usr/bin/perl -- -*-perl-*-
# This script searches the bibliography database and prints
# citations to the corresponding project page.
#----------------------------------------------------------------------------------------------------------------------
# Print html header
#----------------------------------------------------------------------------------------------------------------------
print "Content-type: text/html\n\n";
#----------------------------------------------------------------------------------------------------------------------
# Set Variables
#----------------------------------------------------------------------------------------------------------------------
$study = $ENV{'QUERY_STRING'};
$study =~ s/%([0-9|A-F]{2})/pack("C",hex($1))/eg;
$study =~ s/[;<>\*\|'&\$!#\(\)\[\]\{\}:"\\\/]//g;
$temp = int(rand(time ^ $$));
$temp2 = int(rand(time ^ $$));
#----------------------------------------------------------------------------------------------------------------------
# Execute script
#----------------------------------------------------------------------------------------------------------------------
&search();
&sorting();
&opendb();
&results();
#----------------------------------------------------------------------------------------------------------------------
# Search by project name
#----------------------------------------------------------------------------------------------------------------------
sub search {
system("/usr/opt/bin/row Study =~ /$study/i < /afs/usgs.gov/www/wa.water/htdocs/pubs/Bibliography.rdb > /tmp/$temp.rdb");
#system("/usr/opt/bin/row Study =~ /$study/i < /snld07/www_projects/webdev/wa.water.gov/htdocs/pubs/Bibliography.rdb > /tmp/$temp.rdb");
}
#----------------------------------------------------------------------------------------------------------------------
# Perform final sorting and delete extra temp files
#----------------------------------------------------------------------------------------------------------------------
sub sorting {
system("/usr/opt/bin/sorttbl Authors < /tmp/$temp.rdb > /tmp/$temp2.rdb");
system("/bin/rm /tmp/$temp.rdb");
system("/usr/opt/bin/column -v ID < /tmp/$temp2.rdb > /tmp/$temp.rdb");
system("/usr/opt/bin/headchg -del < /tmp/$temp.rdb > /tmp/$temp2.rdb");
system("/bin/rm /tmp/$temp.rdb");
}
#----------------------------------------------------------------------------------------------------------------------
# Open database results from search for display
#----------------------------------------------------------------------------------------------------------------------
sub opendb {open(INFO, "/tmp/$temp2.rdb"); # Open db for reading
@array=
;
close (INFO);
}
#----------------------------------------------------------------------------------------------------------------------
# Split fields in database and display results
#----------------------------------------------------------------------------------------------------------------------
sub results {
foreach $array (@array){
($pub_type,
$authors,
$year,
$title,
$pub,
$url,
$study,
$display,
$county,
$basin,
$keywords,$test)=split(/\t/,$array);
if ($url) {
print qq~
$authors, $year, $title: $pub
~;
}
else {
print qq~
$authors, $year, $title: $pub
~;
}
}
}
unlink("/tmp/$temp.rdb", "/tmp/$temp2.rdb") or die "couldn't delete file\n";
#----------------------------------------------------------------------------------------------------------------------
# End Script
#----------------------------------------------------------------------------------------------------------------------