#!/bin/ksh AWK=nawk INDEXTYPE=overview #INDEXTYPE=list #TITLETEXT="Images" #HEADERTEXT="Images" #IMAGETEXT="Image" #PREVTEXT="Previous" #NEXTTEXT="Next" #OVERVIEWTEXT="Overview" #ABOUTTEXT="Content" #FOOTER="(Copyright (c) 2005 Peter Eriksson <peter@ifm.liu.se>)" TITLETEXT="Bilder" HEADERTEXT="Bilder från Kopparspelen 2006" IMAGETEXT="Bild" PREVTEXT="Föregående" NEXTTEXT="Nästa" OVERVIEWTEXT="Översikt" ABOUTTEXT="Innehåll" FOOTER="(Copyright (c) 2006 Peter Eriksson, Åtvidabergs TK)
2006-08-09 2006-08-11 2006-08-12 2006-08-13" IMAGE="$1" DIR="`dirname $SCRIPT_FILENAME`" if [ "$IMAGE" = "" ]; then cat < ${TITLETEXT} EOF if [ "$INDEXTYPE" = "list" ]; then cat <${HEADERTEXT} EOF for D in `(cd "${DIR}" ; ls -d ???)`; do cat < EOF done cat < EOF else cat <${HEADERTEXT}
${IMAGETEXT} ${ABOUTTEXT}
EOF if [ -f "${DIR}/${D}/thumbnail.jpg" ]; then cat < EOF else cat <${D} EOF fi cat < EOF if [ -f "${DIR}"/$D/about.txt ]; then cat "${DIR}"/$D/about.txt fi cat <

EOF (( col=0 )) for D in `(cd "${DIR}" ; ls -d ???)`; do if [ $col = 0 ]; then cat < EOF fi cat < EOF if [ -f "${DIR}/${D}/thumbnail.jpg" ]; then cat <${D}

EOF if [ -f "${DIR}"/$D/about.txt ]; then echo '' cat "${DIR}"/$D/about.txt echo '' fi else cat <${D} EOF fi cat < EOF (( col=col+1 )) if [ "$col" = 5 ]; then (( col=0 )) cat <
EOF fi done cat <
EOF fi exit 0 fi if [ ! -d "$DIR/$IMAGE" ]; then cat < No such image

No such image

The image specified does not exist EOF exit 0 fi PREV="`$AWK -v no=$IMAGE 'END {printf "%03d\n", no-1}' < /dev/null`" NEXT="`$AWK -v no=$IMAGE 'END {printf "%03d\n", no+1}' < /dev/null`" cat < ${IMAGETEXT} ${IMAGE}

${IMAGETEXT} ${IMAGE}

EOF if [ -d "$DIR/$PREV" ]; then cat <[${PREVTEXT}] EOF fi cat <[${OVERVIEWTEXT}] EOF if [ -d "$DIR/$NEXT" ]; then cat <[${NEXTTEXT}] EOF fi if [ -f "$IMAGE/lores.jpg" ]; then cat < EOF else cat < EOF fi if [ -f "$DIR/$IMAGE/about.txt" ]; then echo '
' cat $DIR/$IMAGE/about.txt fi cat < ${FOOTER}
EOF exit 0