IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 13, 2009, 2:28:28 PM (17 years ago)
Author:
bills
Message:

Use relative links to be compatible with the simple proxy that we are using.
Since Filesys::Df is now avaialable on the cluster use it to show the free space
available.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataStoreServer/web/cgi/dsgetindex

    r17755 r24175  
    6262    # used by the pretty printer
    6363    @path = split(/\//, $directories);
     64    # shift off the empty bit
     65    shift @path;
    6466
    6567} else {
     
    167169# XXX:
    168170# quick hacky pretty printer
    169 # Stolen from Eric's Data Store mock up
    170 #
    171 
     171# Adapted from Eric's Data Store mock up
     172#
     173
     174sub print_free_space {
     175    use Filesys::Df;
     176        # get free space
     177        my $ref = df($DS_ROOT);
     178        printf '<p>Free space: %.2f G (%.1f%%)</p>',
     179                $ref->{bfree}/(1024*1024),
     180                100.0*$ref->{bfree}/$ref->{blocks};
     181        print "\n";
     182}
    172183sub pprint_pre {
    173     #use Filesys::Df;
    174184
    175185    print header('text/html', '200 OK');
    176186    print start_html('Data Store');
    177187
    178         # get free space
    179 #       my $ref = df($DS_ROOT);
    180 #       printf '<p>Free space: %.2fG (%.1f%%)</p>',
    181 #               $ref->{bfree}/(1024*1024),
    182 #               100.0*$ref->{bfree}/$ref->{blocks};
    183 #        print "\n";
    184188
    185189        # return link
    186190        print a({-href=>"./index.txt"}, "Text Version");
    187191
    188         if ($#path > 1) {
     192        if ($#path >= 1) {
    189193            print "&nbsp&nbsp&nbsp&nbsp\n";
    190194
    191                 my $up = join('/', @path[0..$#path-1]);
    192             print a({-href=>"$up"}, "Up to $up");
     195            my $up = join('/', @path[0..$#path-1]);
     196            print a({-href=>".."}, "Up to $up");
    193197
    194198        }
     
    204208    print p();
    205209
     210    print_free_space();
    206211    print end_html();
    207212}
     
    232237    else {
    233238                # assumes id is always first field
    234             my $wpath = join('/',@path)."/$toks[0]";
    235 
    236                 # if this is a file request, use a download cgi
    237                 if ($wpath =~ /\.fits\s*$/) {
    238                         $wpath = '/ds-cgi/dsfits.cgi?'.substr($wpath, 4); # strip' /ds/'
    239                 }
     239            my $wpath = "./$toks[0]";
     240
     241            # if this is a file request, use a download cgi
     242            if ($wpath =~ /\.fits\s*$/) {
     243                    $wpath = '/ds-cgi/dsfits.cgi?'.substr($wpath, 4); # strip' /ds/'
     244            }
    240245
    241246        print a({-href=>$wpath}, $toks[0]);
Note: See TracChangeset for help on using the changeset viewer.