#! /bin/csh -f # Last edited on 2001-05-14 01:00:25 by stolfi set usage = "$0 TITLE" # Creates an index page "index.html" for the MP004 project hand-in images. # Reads files # ras.txt : RA numbers of all registered students # dates.txt : dates (MM-DD) for which there are hand-ins # aus/MM-DD.txt : RA numbers of absentees # project-names.txt : table with entries "RA: PROJECT NAME" if ( $#argv != 1 ) then echo "usage: ${usage}"; exit 1 endif set title = "$1"; shift; set days = ( `cat dates.txt` ) set path = ( . ${STOLFIHOME}/pkg/netpbm-1mar1994-1/PUB/${PLATFORM}/bin/ $path ) # Make sure absentees have a gray file and thumbnail: foreach day ( $days ) set abfile = "aus/${day}.txt" foreach ra ( `cat ${abfile} | egrep -v '^ *([#]|$)'` ) echo "${ra} absent on ${day}" foreach phase ( ini fin ) set dir = ${ra}/${day}-${phase} # Reject any submission: if ( ( -r ${dir}/icon.gif ) && ( ! { cmp -s ${dir}/icon.gif absent-s.gif } ) ) then /bin/rm -f ${dir}/icon.gif endif set reject = 0 if ( ( -r ${dir}/main.gif ) && ( ! { cmp -s ${dir}/main.gif absent.gif } ) ) then set reject = 1 endif if ( -r ${dir}/main.pov ) then set reject = 1 endif if ( ${reject} ) then if ( ! ( -d ${dir}/reject ) ) mkdir ${dir}/reject /usr/bin/mv -vi ${dir}/*{.{inc,gif,pov},akefile} ${dir}/reject endif # Provide the default image for absentees: if ( ( ! -r ${dir}/main.gif ) ) then ( cd ${dir} && ln -s ../../absent.gif main.gif ) endif if ( ( ! -r ${dir}/icon.gif ) ) then ( cd ${dir} && ln -s ../../absent-s.gif icon.gif ) endif end end end # Get student numbers set rafile = "ras.txt" set ras = ( `cat ${rafile} | egrep -v '^ *([#]|$)'` ) # Generate all personal pages foreach ra ( ${ras} ) echo "building ${ra}/index.html ..." ../../tools/make-project-subpage "${ra}" "${title}" end # Generate master page set ofile = "index.html" if ( -e ${ofile} ) then /bin/mv ${ofile} ${ofile}~ endif cat <> ${ofile} ${title}

${title}

EOF @ n = 0 foreach ra ( ${ras} ) # Directory whre the final images are: set findir = ${ra}/final # Ckeck if the POV-ray source exists: if ( ! ( -r ${findir}/main.pov ) ) then set source = "[×××]" else set source = '[pov]' endif if ( -r ${findir}/main.gif ) then # Use image itself: set imgname = "${findir}/main.gif" set iconame = "${findir}/icon.gif" else # Remove thumbnail, if any if ( -r ${findir}/icon.gif ) /bin/rm -f ${findir}/icon.gif # Use dummy image: set imgname = "missing.gif" set iconame = "missing-s.gif" endif # Make pointer to history page: set wkhist = '[h]' # Make pointer to movie, if it exists: if ( -r ${findir}/movie.gif ) then set movie = '[filme]' else set movie = '' endif # Output the entry if ( ${n} == 0 ) then echo " " >> ${ofile} endif cat <> ${ofile} EOF @ n = ${n} + 1 if ( ${n} >= 4 ) then echo " " >> ${ofile} @ n = 0 endif end if ( ${n} > 0 ) then echo " " >> ${ofile} endif cat <> ${ofile}
${ra}  
${movie}  
${wkhist}${source}  
EOF