IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 7, 2008, 3:59:25 PM (18 years ago)
Author:
bills
Message:

Allow the data store server to be installed without a full IPP installation.

File:
1 edited

Legend:

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

    r16955 r17381  
    55# The only required argument is the REQUEST_URI.
    66# The number of elements in the URI tell us whether we are listing
    7 # the root, a product, or a fileset.
    8 #
    9 # if a second argument -html is provided, the output is in HTML
     7# the data store root, a product, or a fileset.
     8#
     9# if a second argument -html is provided, the output is in HTML format
     10# otherwise plain text is used
    1011#
    1112# The only thing specific to the ipp used here is the exit codes.
     
    1617use CGI ':standard';
    1718use IPC::Cmd 0.36 qw( can_run run );
    18 use PS::IPP::Config qw($PS_EXIT_SUCCESS
    19                        $PS_EXIT_UNKNOWN_ERROR
    20                        $PS_EXIT_SYS_ERROR
    21                        $PS_EXIT_CONFIG_ERROR
    22                        $PS_EXIT_PROG_ERROR
    23                        $PS_EXIT_DATA_ERROR
    24                        $PS_EXIT_TIMEOUT_ERROR
    25                        metadataLookupStr
    26                        metadataLookupBool
    27                        caturi
    28                        );
     19
     20my $PS_EXIT_CONFIG_ERROR = 3;
     21my $PS_EXIT_DATA_ERROR = 5;
    2922
    3023my $uri = shift;
     
    3427    exit ($PS_EXIT_CONFIG_ERROR);
    3528}
     29
     30my $DS_ROOT = $ENV{DS_ROOT};
     31
     32die("DS_ROOT not found in the environment") unless defined($DS_ROOT);
    3633
    3734my @path;
     
    5956    # there is no file on the url
    6057
    61     print STDERR "html mode\n";
     58    # print STDERR "html mode\n";
    6259
    6360    ($directories, $query_str) = split/\?/, $uri;
     
    9693
    9794if (@dirs) {
     95    # XXX need to output an error page
    9896    warn("unexpected extra directories: @dirs in uri: $uri");
    9997    exit ($PS_EXIT_CONFIG_ERROR);
     
    167165# XXX:
    168166# quick hacky pretty printer
    169 # Stolen Eric's mock up
     167# Stolen from Eric's Data Store mock up
    170168#
    171169
     
    174172
    175173    print header('text/html', '200 OK');
    176     print start_html('Datastore');
     174    print start_html('Data Store');
    177175
    178176        # get free space
    179         # XXX: need to configure DS_DIR
    180         my $DS_DIR = '/var/www/html/ds/dsroot';
    181         my $ref = df($DS_DIR);
     177        my $ref = df($DS_ROOT);
    182178        printf '<p>Free space: %.2fG (%.1f%%)</p>',
    183179                $ref->{bfree}/(1024*1024),
Note: See TracChangeset for help on using the changeset viewer.