Changeset 28703 for main/trunk


Ignore:
Timestamp:
2013-11-28T14:50:43+13:00 (10 years ago)
Author:
kjdon
Message:

can set the defaults now in the args structure, as we have default_argname to see if it was set by the user or not.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/bin/script/import.pl

    r28640 r28703  
    103103    'type' => "enum",
    104104    'list' => $saveas_list,
    105     #'deft' => "GreenstoneXML", # if saveas is defined a default here, then any valid value provided in collect.cfg is ignored
     105    'deft' => "GreenstoneXML",
    106106    'reqd' => "no",
    107107    'modegli' => "3" };
     
    139139    'type' => "string",
    140140    'reqd' => "no",
     141    'deft' => "archives",
    141142        'hiddengli' => "yes" },
    142143      @$inexport::directory_arguments,
     
    284285    my $out        = $inexport->{'out'};
    285286
    286     #groupsize can (currently) only be defined for import, not export, and
    287     # will be set to 1 if the user has not set it
    288     if ((defined $inexport->{'groupsize'}) && ($inexport->{'groupsize'} == 1)) {
     287    # check all options for default_optname - this will be set if the parsing
     288    # code has just set the value based on the arg default. In this case,
     289    # check in collect.cfg for the option
     290   
     291    # groupsize can only be defined for import, not export, and actually only
     292    # applies to GreenstoneXML format.
     293    if (defined $inexport->{'default_groupsize'}) {
    289294    if (defined $collectcfg->{'groupsize'} && $collectcfg->{'groupsize'} =~ /\d+/) {
    290295        $inexport->{'groupsize'} = $collectcfg->{'groupsize'};
    291296    }
    292     }
    293 
    294     if (!defined $inexport->{'saveas'}) {
     297
     298    }
     299    if (defined $inexport->{'default_saveas'}) {
    295300    if (defined $collectcfg->{'saveas'}
    296301        && $collectcfg->{'saveas'} =~ /^(GreenstoneXML|GreenstoneMETS)$/) {
     
    302307   
    303308    my $sortmeta = $inexport->{'sortmeta'};
    304     if (defined $collectcfg->{'sortmeta'} && (!defined $sortmeta || $sortmeta eq "")) {
     309    if (defined $collectcfg->{'sortmeta'} && $sortmeta eq "") {
    305310    $sortmeta = $collectcfg->{'sortmeta'};
    306311    }
Note: See TracChangeset for help on using the changeset viewer.