Changeset 29098

Show
Ignore:
Timestamp:
16.06.2014 19:44:41 (5 years ago)
Author:
ak19
Message:

Removing import metadata needs to take into account prevmetavalue and and not delete all metavalues in override mode if metapos is undefined. In the case of prevmetavalue being defined, it should only handle prevmetavalue. Kathy had already fixed the archives_metadata case, and the index_metadata case does not deal with xml files but the database.

Files:
1 modified

Legend:

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

    r29086 r29098  
    23572357            return []; 
    23582358        } 
    2359     } 
    2360  
    2361     if ((defined $parser->{'parameters'}->{'metapos'}) && ($parser->{'parameters'}->{'metaname'} eq $attrHash->{'name'}) && ($parser->{'parameters'}->{'poscount'} == $parser->{'parameters'}->{'metapos'})) 
    2362     {    
    2363         return []; 
    2364     } 
    2365  
    2366     if ((defined $parser->{'parameters'}->{'metavalue'}) && ($parser->{'parameters'}->{'metaname'} eq $attrHash->{'name'}) && ($parser->{'parameters'}->{'metavalue'} eq $attrHash->{'_content'})) 
    2367     {    
    2368         return []; 
     2359 
     2360        if ((defined $parser->{'parameters'}->{'metapos'}) && ($parser->{'parameters'}->{'poscount'} == $parser->{'parameters'}->{'metapos'})) 
     2361        {    
     2362            return []; 
     2363        } 
     2364         
     2365        if ((defined $parser->{'parameters'}->{'metavalue'}) && ($parser->{'parameters'}->{'metavalue'} eq $attrHash->{'_content'})) 
     2366        {    
     2367            return []; 
     2368        } 
    23692369    } 
    23702370     
     
    28982898    my $metadata_xml_filename = &util::filename_cat($import_dirname,"metadata.xml"); 
    28992899     
    2900     # If we're overriding everything, then $metamode=override combined with $metapos=undefined 
    2901     # in which case, we need to remove all metavalues for the metaname at the given (sub)section 
     2900    # If we're overriding everything, then $prevmetavalue=undefined and 
     2901    # $metamode=override combined with $metapos=undefined 
     2902    # in which case we need to remove all metavalues for the metaname at the given (sub)section 
    29022903    # Thereafter, we will finally be able to set the overriding metavalue for this metaname 
    2903     if(!defined $metapos && $metamode eq "override") { 
     2904    if(!defined $prevmetavalue && !defined $metapos && $metamode eq "override") { 
    29042905##  print STDERR "@@@ REMOVING all import metadata for $metaname\n"; 
    29052906    $self->remove_from_metadata_xml($gsdl_cgi, $metadata_xml_filename, $metaname, $metapos, undef, $import_tailname, $metamode); # we're removing all values, so metavalue=undef 
     
    30953096 
    30963097        # if overriding but no metapos, then clear all the meta for this metaname 
    3097         if ((defined $parser->{'parameters'}->{'metamode'}) && ($parser->{'parameters'}->{'metamode'} eq "override") && (!defined $parser->{'parameters'}->{'metapos'})) { 
     3098        if ((defined $parser->{'parameters'}->{'metamode'}) && ($parser->{'parameters'}->{'metamode'} eq "override") && (!defined $parser->{'parameters'}->{'metapos'}) && (!defined $parser->{'parameters'}->{'metavalue'})) { 
    30983099            return []; 
    30993100        } 
     
    31033104            return []; 
    31043105        } 
    3105  
    31063106        if ((defined $parser->{'parameters'}->{'metavalue'}) && ($attrHash->{'_content'} eq $parser->{'parameters'}->{'metavalue'})) 
    31073107        { 
     
    33063306    $mess .= "  $metaname"; 
    33073307    $mess .= "->[$metapos]" if (defined $metapos); 
     3308    $mess .= " ($metavalue)" if (defined $metavalue); 
    33083309 
    33093310    $gsdl_cgi->generate_ok_message($mess);