IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39658


Ignore:
Timestamp:
Aug 23, 2016, 9:17:22 AM (10 years ago)
Author:
bills
Message:

committing several data store scripts that have been in production
for quite a while but never committed to the source tree

Location:
trunk/DataStoreServer
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataStoreServer/scripts/dsprodindex

    r26926 r39658  
    7575        #
    7676        # XXX: the spec doesn't say what should happen in this case.
    77         # Here we follow the conductor implementation and return the whole list.
    78         # This may not be the right thing to do. It might be better to throw an error
     77        # We used to follow the conductor implementation and return the whole list.
     78        # but that is definitely not the right thing to do in our context.
     79        # Exit with an error
     80        exit 404;
    7981    }
    8082}
  • trunk/DataStoreServer/scripts/dsrootindex

    r17381 r39658  
    1414my $PS_EXIT_CONFIG_ERROR = 3;
    1515
     16# set this variable to redirect listings of the root datastore directory
     17# to the password protected php page on the postage stamp server web site.
     18# Since the data store is restricted by IP address now this is no longer necessary
     19my $redirect_root_to_pstamp = 0;
     20if ($redirect_root_to_pstamp) {
     21
     22        print '
     23        <html>
     24        <head>
     25        <meta HTTP-EQUIV="REFRESH" content="0; url=http://pstamp.ipp.ifa.hawaii.edu/dsroot.php">
     26        </head>
     27        </html>
     28        ';
     29
     30        exit 0;
     31}
     32
    1633my $dbh = getDBHandle();
    1734
    18 my $stmt = $dbh->prepare("SELECT * FROM dsProduct");
     35my $stmt = $dbh->prepare("SELECT * FROM dsProduct ORDER BY type");
    1936$stmt->execute();
    2037
     
    3653        $row->{type}, $row->{description};
    3754
     55    # XXX EAM : security by obfuscation
    3856    print $line;
    3957}
  • trunk/DataStoreServer/web/cgi/dsgetindex

    r25366 r39658  
    2020my $PS_EXIT_CONFIG_ERROR = 3;
    2121my $PS_EXIT_DATA_ERROR = 5;
     22
     23my $redirect_root_to_pstamp = 0;
    2224
    2325my $uri = shift;
     
    132134            print @$stdout_buf;
    133135        }
     136        $error_code = 0 if !defined $error_code;
    134137    } else {
    135138        if (0 && $html_mode) {
     
    199202
    200203        # return link
    201         print a({-href=>"./index.txt"}, "Text Version");
     204        if (!$redirect_root_to_pstamp || $program ne "dsrootindex") {
     205            print a({-href=>"./index.txt"}, "Text Version");
     206        }
    202207
    203208        if ($#path >= 1) {
    204             print "&nbsp&nbsp&nbsp&nbsp\n";
    205 
    206             my $up = join('/', @path[0..$#path-1]);
    207             print a({-href=>".."}, "Up to $up");
    208 
     209            # including the up links in the data store display causes
     210            # wget -r to follow them up which makes a mess
     211            # Turn them off if the user agent looks like wget
     212            my $display_up_links = (lc($ENV{HTTP_USER_AGENT}) =~ /wget/) ? 0 : 1;
     213            if ($display_up_links) {
     214                print "&nbsp&nbsp&nbsp&nbsp\n";
     215                my $up = join('/', @path[0..$#path-1]);
     216                if ($redirect_root_to_pstamp and $program eq "dsprodindex") {
     217                    print a({-href=>"http://pstamp.ipp.ifa.hawaii.edu/dsroot.php"}, "Up to $up");
     218                } elsif ($program eq 'dsrootindex') {
     219                    # no up link in dsroot
     220                } else {
     221                    print a({-href=>".."}, "Up to $up");
     222                }
     223            }
    209224        }
    210225        print "</p>\n";
     
    244259    if ($nolink) {
    245260       print $toks[0];
    246     }
    247 
    248     else {
    249                 # assumes id is always first field
    250             my $wpath = "./$toks[0]";
    251 
    252             # if this is a file request, use a download cgi
    253             if ($wpath =~ /\.fits\s*$/) {
    254                 # This doesn't work through the proxy
    255                 # The /ds-cgi gets tried on alala
    256                 #    $wpath = '/ds-cgi/dsfits.cgi?'.substr($wpath, 4); # strip' /ds/'
     261    } else {
     262         # First column is link to an entity down one level in data store (product, fileset, file)
     263         # assumes id is always first field
     264         my $wpath = "./$toks[0]";
     265
     266         # if this is a file request, use a download cgi
     267         my $fits = 0;
     268         if ($wpath =~ /\.fits\s*$/) {
     269             # This doesn't work through the proxy
     270             # The /ds-cgi gets tried on alala
     271             #    $wpath = '/ds-cgi/dsfits.cgi?'.substr($wpath, 4); # strip' /ds/'
     272             $fits = 1;
     273         }
     274
     275        if ($fits) {
     276            print a({-href=>$wpath, -type=>'image/x-fits'}, $toks[0]);
     277        } else {
     278            print a({-href=>$wpath}, $toks[0]);
     279        }
     280
     281        if ($program eq 'dsrootindex') {
     282            # for root listing make most recent fileset a link as well unless there are no filesets
     283            my $fileset = $toks[1];
     284            $fileset =~ s/^\s+//;
     285            $fileset =~ s/\s+$//;
     286            if ($fileset ne 'none') {
     287                print "</$celltag>";
     288                print "<$celltag>";
     289                # drop the product from the list of tokens
     290                my $product = shift @toks;
     291                # elmiminate any whitesapace
     292                $product =~ s/^\s+//;
     293                $product =~ s/\s+$//;
     294                print a({-href=>"./$product/$fileset"}, $fileset);
    257295            }
    258 
    259         print a({-href=>$wpath, -type=>'image/x-fits'}, $toks[0]);
    260     }
     296        }
     297    }
     298    shift @toks;
    261299
    262300    print "</$celltag>";
    263301
    264     foreach my $val (@toks[1..$#toks]) {
     302    # foreach my $val (@toks[1..$#toks]) {
     303    foreach my $val (@toks) {
    265304                print "<$celltag>";
    266305                print $val;
  • trunk/DataStoreServer/web/cgi/findsmf.pl

    r35241 r39658  
    3535
    3636# NOTE: We do not use the ipp configuration to simplify running from a CGI script
    37 my $dbname = "XXX";
    38 my $dbserver = "XXX";
    39 my $dbuser = "XXX";
    40 my $dbpassword = "XXX";
     37my $dbname = "gpc1";
     38my $dbserver = "scidbm";
     39my $dbuser = "ippuser";
     40my $dbpassword = "ippuser";
    4141
    4242
     
    7777        exit 2 if (!$resolved)
    7878    }
     79    # HERE IS THE OUTPUT FOR A SUCCESSFUL LOOKUP
    7980    print "$filename $resolved";
    8081} else {
Note: See TracChangeset for help on using the changeset viewer.