[m-dev.] for review: generate index files on web site

David Glen JEFFERY dgj at hydra.cs.mu.oz.au
Mon Jun 26 16:42:07 AEST 2000


Hi,

For Tyson to review:


===================================================================

Estimated hours taken: 2.5

Seeing that the departmental www server no longer generates indexes for
directories without an index.html (or whatever), generate suitable index 
files for the directories in download/files/

bin/install_webpages:
	Call the new script to generate the index files.
bin/generate_index_html:
	New file that generates index files for a directory and all its
	sub-directories.

===================================================================

Index: bin/install_webpages
===================================================================
RCS file: /home/staff/zs/imp/w3/bin/install_webpages,v
retrieving revision 1.15
diff -u -t -r1.15 install_webpages
--- bin/install_webpages	2000/03/14 00:25:06	1.15
+++ bin/install_webpages	2000/06/26 06:24:07
@@ -49,6 +49,16 @@
 cvs checkout tutorial
 make install
 
+    # 
+    # Rebuild the index.html files in the download directories.
+    # The #@!%$ www server doesn't generate these any more.
+    #
+(
+    export PATH=`pwd`/bin:$PATH
+    cd $INSTALL_WEBDIR/download/files/
+    generate_index_html
+)
+
     #
     # Reindex the web site for searching.
     #

New File: bin/generate_index_html
===================================================================
#!/bin/sh
#
# generate_index_html
#
# Generates index.html files with a link to each file in the directory, and
# recursively for its sub-directories.
#
# Note: This script recursively calls itself, so it had better be in its
# own path!
#

INDEX=index.html

    #
    # These are the standard locations for apache's icons
    #
img_txt="<img src=/icons/text.gif>"
img_dir="<img src=/icons/folder.gif>"
img_bak="<img src=/icons/back.gif>"

echo "<H1>Directory listing</H1>" > $INDEX
echo "<hr>" >> $INDEX
echo "$img_bak <a href=../>Parent Directory</a><br>" >> $INDEX

for file in * 
do
    if [ $file != index.html ]  && [ $file != README ]
    then
        if [ -d $file ]
        then
    	    (cd $file && generate_index_html)
            echo "$img_dir <a href=$file/>$file/</a><br>" >> $INDEX
        else
	    size=`ls -l $file | awk '{ print $5; }'`
	    sizekb=`expr $size / 1024`
            echo "$img_txt <a href=$file>$file</a> ($sizekb kilobytes)<br>" >> $INDEX
        fi
    fi
done

echo "<hr>" >> $INDEX

if [ -f README ]
then
    echo "<pre>" >> $INDEX
    cat README >> $INDEX
    echo "</pre>" >> $INDEX
fi

chmod a+r,g+w $INDEX
chgrp mercury $INDEX

===================================================================




dgj
-- 
David Jeffery (dgj at cs.mu.oz.au) | If your thesis is utterly vacuous
PhD student,                    | Use first-order predicate calculus.
Dept. of Comp. Sci. & Soft. Eng.|     With sufficient formality
The University of Melbourne     |     The sheerist banality
Australia                       | Will be hailed by the critics: "Miraculous!"
                                |     -- Anon.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list