#!/usr/bin/perl ############################################## ############################################## # SCRIPT NAME: Page_Database_Log.cgi # FUNCTION: List all Database Entries ############################################## # MINE: Molecular INformation Explorer # Copyright 2000 Dawn Field. All rights reserved. # The CGI-PERL scripts belonging to MINE # may be used and modified freely, but I do # request that this copyright notice remain attached # to this file/source code. If you make modifications # please do not distribute unless # you fully document the modifications. use CGI; require "CGI-MINE.pl"; use CGI qw/:standard :html3/; # here so the html3 functions like th can be used to make the table below ################# # START EACH MINE CGI SCRIPT ################# # this redirects the error messages to the user's screen # and is useful for debugging CGI scripts! open (STDERR, ">&STDOUT"); # print errors to screen $| = 1; # flush the print buffer continuously # make a new query object using CGI.pm module $query = new CGI; # print the required header and start the web page print $query->header; print $query->start_html('MINE'); # Each time a script is invoked for the first time (or $action undef), # log the visit in the custom MINE server log (see CGI-MINE.pl) # (put this after the header incase an error message is printed) # check value of $action $action = $query->param('action'); if ($action eq undef) {&log();} ####### # START THE WEBPAGE ####### # print the MINE menu &menu; # start the basic gray table used for formatting MINE pages &table_top(); # put the main title of your page here print "Link Mine: Search the Web for what you want!
";
# Copy this google search window to any page!
# Downloaded html from the google.com search engine site
print $google =< In such a file, each URL entry must follow this format so that it can be parsed correctly by this script:
";
print $query->submit('action', 'Category Descriptions');
print "
MESSAGE
}
&table_bottom();
# print out the table of file logs using the code in the CGI-MINE.pl file
print "
Text to link: URL:Description**
(e.g. BOOKs:Amazon.com:Great place to buy books online!**)
";
#################
# END PROCESS FORM
#################
# PRINT BOTTOM OF EACH WEB PAGE
# if $show_source is set to 1 show a link
# at the bottom of each script to the source
# code - pass the name of this script to the
# function in CGI-MINE.pl
if ($show_source) {
$script_name = $query->script_name();
&source ($script_name);
} # attach the MINE copywrite
&mine_cp;
#################
# END WEBPAGE
#################
#####################
# FUNCTIONS
#####################
# clean out "_" and LINK_MINE from a file name
# Usage &clean_file_name($filename)
sub clean_file_name {
$filename = @_[0];
push (@link_hash, $filename);
# take LINK_MINE off the end of the name for the table caption of each column
$trun_filename = $filename;
$trun_filename =~ s/LINK_MINE//;
# take out underscores!
$trun_filename =~s/_/ /g;
push (@link_hash, $trun_filename);
}
# Usage &show_linkmine ($filename)
sub show_linkmine {
$filename = @_[0];
# take LINK_MINE off the end of the name for the tabe caption of each column
$trun_filename = $filename;
$trun_filename =~ s/LINK_MINE//;
print "";
############
# START FORM
############
print $query->startform();
# print $query->start_form(-target=>'popup-window' -width=>'800' -height=>'400');
# pick up all the files in this directory ending with "LINK_MINE"
@linkmine_extensions = <*LINK_MINE>;
# clean up the names and put them in a hash so pretty names are printed in the web form
foreach $link (@linkmine_extensions) {
&clean_file_name($link)
}
# put the array made in the subroutine in a hash
%link_hash = @link_hash;
print "Categories
";
print $query->checkbox_group(-name=>'linkmine_extensions',
-values=>[@linkmine_extensions],
-default=>[@database_log_default_extensions],
-linebreak=>'true',
-labels=>\%link_hash
);
# print some buttons
print "
";
print $query->submit('action', 'Update View!');
print "
";
print $query->submit('action','Show All');
# print a 'clear' button at end of form: script self-calls
print "
";
print $query->defaults('Hide All');
print $query->submit('action','How to make New Links');
print "";
print $query->endform();
#################
# END FORM
#################
#################
# PROCESS FORM
################
# get the values
@turned_on = $query->param('linkmine_extensions');
@action = $query->param('action');
################ IF "Show All" ################
# put in all extensions if select SHOW ALL
if ($action eq "Show All") {
@turned_on = <*LINK_MINE>;
}
################ IF "List Extension Descriptions" ################
# print a pop-up window with the information
if ($action eq "Category Descriptions" || $action eq "") {
# print the hash in a table
@headings = ('File','Description');
@rows = th(\@headings);
foreach $key (keys %link_labels) {
push(@rows,td([$key,$link_labels{$key}]));
}
print table({-border=>undef},
caption(b('Categorie Descriptions
("LINK_MINE" files)')),
Tr(\@rows)
);
print "";
}
# if @turned_on has values make all the columns in the log
# the number of extensions called
$x = @turned_on;
# loop over them to make the view table
for (@turned_on) {
&show_linkmine("$_");
print " ";
}
print " ";
}
print "$desc