Changeset 29084

Show
Ignore:
Timestamp:
29.05.2014 11:37:53 (6 years ago)
Author:
kjdon
Message:

when editing metadata from the on line library (log in, and edit content), we are not passing in a metapos when changing a value. we are passing in the previous value. So need to test that metapos and prevvalue are both empty before deleting all values of a particular meta elem. Otherwise if we are editing a piece of metadata on line, then all the other values are deleted.

Files:
1 modified

Legend:

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

    r28252 r29084  
    20092009    my $doc_xml_filename = &util::filename_cat($archives_dir,$doc_xml_file); 
    20102010 
    2011     # If we're overriding everything, then $metamode=override combined with $metapos=undefined 
     2011    # If we're overriding everything, then $metamode=override combined with $metapos=undefined and $prevmetavalue=undefined 
    20122012    # in which case, we need to remove all metavalues for the metaname at the given (sub)section 
    20132013    # Thereafter, we will finally be setting the overriding metavalue for this metaname 
    2014     if(!defined $metapos && $metamode eq "override") { 
    2015     $self->remove_from_doc_xml($gsdl_cgi, &util::filename_cat($archive_dir, $doc_xml_file), $metaname, $metapos, undef, $docid_secnum, $metamode); 
    2016     } 
    2017  
     2014    if (!defined $prevmetavalue && !defined $metapos && $metamode eq "override") { 
     2015    # remove all values of $metaname metadata  
     2016    $self->remove_from_doc_xml($gsdl_cgi, &util::filename_cat($archive_dir, $doc_xml_file), $metaname, undef, undef, $docid_secnum, $metamode); 
     2017    } 
    20182018    # Edit the doc.xml file with the specified metadata name, value and position. 
    20192019    # TODO: there is a potential problem here as this edit_doc_xml function