#!/usr/bin/perl -w use CGI qw(:all); #open categories file for reading open(CATG,"anim_categories.csv")|| die "cannot open categories list"; #read and discard first TOC line, that's just header/descriptors $line = ; #for each category file line $count = 0; while($line=){ #parse categories line @fld = split(/","/,$line); #field field 2 indexin #field 0 category field 3 indexout #field 1 directory field 4 title $fld[0] =~ s/"//; $fld[4] =~ s/"//; $count=$count+1; $cats[$count]=$fld[0]; $dirs[$count]=$fld[1]; $inis[$count]=$fld[2]; $outs[$count]=$fld[3]; $tlts[$count]=$fld[4]; $TOClink[$count] = $fld[1]."/".$fld[3]; $TOCdata[$count] = $fld[1]."/".$fld[2]; } #close categories file close(CATG); #write credits file credits(); for($i=1 ; $i<=$count ; $i++ ){ #Process each TOC category file SUB EACHCAT #GOSUB EACHCAT(indexin, indexout,directory,title) eachcat($TOCdata[$i],$TOClink[$i],$dirs[$i],$tlts[$i]); print "writing index file ".$i." of ".$count."\n"; } #SUB process list of directories and export to TOC html file #EACHCAT(indexin, indexout,directory,title) sub eachcat{ $infile=$_[0]; $outfile=$_[1]; $dir=$_[2]; $title=$_[3]; #open subcategory data file open(IND_IN,$infile)|| die "cannot open $_[0] for reading"; #read 'n drop first line, its just column headers $iline=; #open subcategory html file for writing open(IND_OUT,">".$outfile)|| die "cannot open TOC file for writing"; #write top of subcategory html file print IND_OUT < Physics Animations
$title
These animations are available for use under a Creative Commons License.
TOP_O_THIS_IND #dummy first subcat $thissubcat="zzz"; #for each subcategory file line while($iline=){ #parse item line #$itemfld[0 through 5] = ID subcategory media thumb comment html @itemfld = split(/"?,"?/,$iline); #if its a new category, write the category header if($itemfld[1] ne $thissubcat){ $thissubcat=$itemfld[1]; print IND_OUT < SUBCAT_THIS_IND } #write the component table row $em1="embeder".$itemfld[0].".html"; $em2="embederQ".$itemfld[0].".html"; print IND_OUT < ITEM_ROW_THIS_IND3 #write the various html files for the mediafiles #write embedder1(directory,embedding html file,media file, comment) embedder1($dir,$em1,$itemfld[2],$itemfld[4]); embedder2($dir,$em2,$itemfld[2],$itemfld[4]); } #finish off and close this indexer file print IND_OUT < BOT_O_IND_OUT close(IND_OUT); #close the subcategory data file close(IND_IN); } #embedder1(directory,embedding html file,media file, comment) sub embedder1{ $dir=$_[0]; $outfile=$_[1]; $media=$_[2]; $comment=$_[3]; #print "$dir $outfile \n"; #open embedder html file $fname=$_[0]."/".$_[1]; open(EMBD,">".$fname)|| die "cannot open $fname for writing"; #write embedder html file print EMBD < embedded media file

$thissubcat

$itemfld[4]

ITEM_ROW_THIS_IND1 print IND_OUT < Media | Old Embedded | QT Embedded | ITEM_ROW_THIS_IND2 if($itemfld[5] ){ chomp($itemfld[5]); $itemfld[5] =~ s/"//; if($itemfld[5] =~ /htm/){ print IND_OUT < HTML | ITEM_ROW_THIS_IND_HTML } } #finish up this row demarcation print IND_OUT <

$comment
ALL_OF_EMBD #close embedder html file close(EMBD); } #embedder2(directory,embedding html file,media file, comment) sub embedder2{ $dir=$_[0]; $outfile=$_[1]; $media=$_[2]; $comment=$_[3]; #print "$dir $outfile \n"; #open embedder html file $fname=$_[0]."/".$_[1]; open(EMBD2,">".$fname)|| die "cannot open $fname for writing"; #write embedder html file print EMBD2 < quicktime embedded media file

Error text.

$comment
ALL_OF_EMBD2 #close embedder html file close(EMBD2); } ############################################################################ # Sub name: credits # Input: none # Output: none # Description: writes credits file # ############################################################################ sub credits { #open TOC html file for writing/and write the top stuff open(TOC,">Phys_anim.htm")|| die "Phys_anim2.htm"; $myemail="mrg3@"."psu.edu"; print TOC < Physics Animations

Simple Animations of Basic Concepts in Physics and Astronomy
by Dr. Michael R. Gallis
$myemail
Select a category from the menu at left to browse the catalogue of animations by category. Most animations are 512 by 384 pixel avi files and are generally several megabytes long. Small screenshots are provided.
NEW: CWIS Portal to the Animations. The portal allows searching as well as browsing of animation topics. Users are invited to use the portal to provide feedback and suggestions.
POV-Ray, etc. Source Files directory
-=Papers and Presentations=-

Animations for Introductory Courses, Dr. Michael R. Gallis and Dr. Ping Wang presented at the 2004 ASEE Annual Conference and Exposition:   -Presentation  -Paper
3-D Animations for Introductory Electromagnetism, MichaelR. Gallis presented at CPS-AAPT 2005 Spring Meeting   -Presentation
Elementary Animated Illustrations of Geodesics using POV-Ray , Michael R. Gallis (unpublished)
See also Visual Mathematics by Dr. Michael R. Gallis and Dr. Ping Wang
Creative Commons License
These works are licensed under a Creative Commons License.
BOT_O_TOC close(TOC); }