#!/usr/local/bin/perl # ######################## # By Kenning Arlitsch and Scott Cowley 12/28/00 # based loosely on # Quick Links # Written by Mike Wheeler 6/26/96 # Copyright 1996, All Rights Reserved # ########################## # Set the variables $static_dir = $ENV{'QUERY_STRING'}; $static_dir_url = $ENV{'QUERY_STRING'}; $file_dir = "server path to files goes here"; $file_dir_url = "http://www.lib.utah.edu/epubs/accn425/"; # These specify the directory where all the files you want links added for # are located. The first is their path on the server, the second is # their URL. $link_file = "server path to results file goes here"; # This is the name of the file which will be created. DO NOT # specify an existing file, because the contents of it will # be overwritten by these links. $links = "http://www.lib.utah.edu/epubs/accn425/results/links.html"; # # That's all there is to it. You can edit the resulting file to your heart's # content. Be sure to chmod the script to 755. This script can (and should) # be run from the Unix shell rather than a browser. (A web browser should # be able to run it, but then the resulting file will be owned by nobody # and the directory where the file is created would need by be chmod 777) ################# ########################################################## # Concatenate the query string and the variables into one # and then open and read the contents of the directory ########################################################## $file_dir = $file_dir . $static_dir; $file_dir_url = $file_dir_url . $static_dir_url; opendir(FILES,"$file_dir")|| die "cannot open dir"; @allfiles = grep(/.*html/,readdir(FILES)); closedir(FILES); ########################################################## # Start a NEW html page ########################################################## open(NEW,">$link_file"); #print NEW "Content-type: text/html\n\n"; print NEW "\n"; print NEW "\n"; print NEW "
\n"; ########################################################## # Print the ML Digitized Collections image at the top ########################################################## #print NEW "\n"; #print NEW "\n"; #print NEW "\n"; #print NEW "
\ \;\n"; #print NEW "\"Marriott

\n"; print NEW "INTERMOUNTAIN SKI INSTRUCTORS ASSOCIATION
\n"; print NEW "Documents found in $static_dir

\n"; print NEW "\n"; print NEW "\n"; print NEW "\n"; print NEW "\n"; print NEW "\n"; @allfiles = sort(@allfiles); foreach $file(@allfiles){ ########################################################## # Scan each file ########################################################## open (fileData, $file_dir . '/' . $file) || die "cannot open file"; @pageData = ; close (fileData); ########################################################## # Scan each line in each file for the text between the # tags and then print that text to the # second column of the HTML page ########################################################## foreach $b (@pageData) { if ($b =~ m/(.*)<\/TITLE>/gi) { $title = $1; break; print NEW "<tr>\n"; print NEW "<td> <A href=\"$file_dir_url/$file\">$file</a></td>\n"; print NEW "<td> $title </td>\n"; print NEW "</tr>\n"; } } } print NEW "</table>\n"; print NEW "<p></p>\n"; ########################################################## # Print out the the green footer with white text ########################################################## print NEW "<table width=\"800\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"; print NEW "<tr bgcolor=\"#909875\">\n"; print NEW "<td width=\"4\" bgcolor=\"#ede8cf\">\ </td>\n"; print NEW "<td width=\"131\">\ \;</td>\n"; print NEW "<td width=\"265\"><a href=\"http://www.lib.utah.edu/digital/index.html\">\n"; print NEW "<font color=\"white\" face=\"Arial, Helvetica, sans-serif\"> Digitization Center</font></a>\ \;\ \;\ \;\ \;\n"; print NEW "<a href=\"http://www.lib.utah.edu\"></a></td>\n"; print NEW "<td width=\"435\">\n"; print NEW "<div align=\"left\"><font face=\"Arial, Helvetica, sans-serif\">\n"; print NEW "<a href=\"http://www.lib.utah.edu\"><font color=\"white\">Marriott Library</font></a></font></div>\n"; print NEW "</td></tr></table></center>\n"; print NEW "</body>\n"; close(NEW); print "Location: $links\n\n"; exit;
FILE NAMEDOCUMENT TITLE