Changeset 23767

Show
Ignore:
Timestamp:
09.03.2011 15:04:33 (8 years ago)
Author:
davidb
Message:

CGI Perl scripts updated to work with Greenstone 3. This in turn required these supporting routines to optionally handle the 'site' variable

Location:
main/trunk/greenstone2/perllib
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/cgiactions/baseaction.pm

    r23755 r23767  
    104104    } 
    105105 
    106  
     106     
    107107    if (!defined $action_table->{$action}) { 
    108108    my $valid_actions = join(", ", keys %$action_table); 
     
    144144    } 
    145145     
     146 
    146147    $self->{'action'} = $action; 
    147148    $self->{'collect'} = $collect; 
     
    149150    $self->{'timestamp'} = $timestamp; 
    150151    $self->{'site'} = $site; 
    151  
     152       
    152153    # Locate and store compulsory arguments 
    153154    my $comp_args = $action_table->{$action}->{'compulsory-args'}; 
     
    171172    } 
    172173 
     174     
     175     
    173176    # Retrieve infodb-type 
    174177    if (defined $collect) { 
    175     my $inexport = newCGI inexport(ref $self,$collect); 
     178     
     179    my $opt_site = $self->{'site'} || ""; 
     180     
     181    my $inexport = newCGI inexport(ref $self,$collect,$gsdl_cgi,$opt_site); 
    176182    my ($config_filename,$collect_cfg) = $inexport->read_collection_cfg($collect);    
    177183    $self->{'infodbtype'} = $collect_cfg->{'infodbtype'}; 
     184 
    178185    } 
    179186     
     187     
    180188    return $self; 
    181189} 
  • main/trunk/greenstone2/perllib/inexport.pm

    r23485 r23767  
    130130{ 
    131131    my $class = shift (@_); 
    132     my ($mode,$collect) = @_; 
     132    my ($mode,$collect,$gsdl_cgi,$opt_site) = @_; 
    133133 
    134134    my $self = { 'xml' => 0, 'mode' => $mode }; 
    135135 
    136136    $self->{'out'} = STDERR; 
    137     $self->{'site'} = ""; 
    138     $self->{'collectdir'} = &util::filename_cat($ENV{'GSDLHOME'},"collect"); 
     137     
     138    if (defined $gsdl_cgi) { 
     139        $self->{'site'} = $opt_site; 
     140        my $collect_dir = $gsdl_cgi->get_collection_dir($opt_site); 
     141        $self->{'collectdir'} = $collect_dir; 
     142    } 
     143    else {   
     144        $self->{'site'} = ""; 
     145        $self->{'collectdir'} = &util::filename_cat($ENV{'GSDLHOME'},"collect"); 
     146    } 
    139147    $self->{'faillog'} = ""; 
    140148    
     
    159167    my $site       = $self->{'site'}; 
    160168    my $out        = $self->{'out'}; 
    161   
     169     
    162170    if (($collection = &colcfg::use_collection($site, $collection, $collectdir)) eq "") { 
    163171    &PrintUsage::print_txt_usage($options, "{import.params}");