Changeset 28263


Ignore:
Timestamp:
09/12/13 10:31:48 (8 years ago)
Author:
davidb
Message:

Code added to make the new document have a differentdoc-id from the original document it came from

File:
1 edited

Legend:

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

    r28261 r28263  
    117117   
    118118    1;
     119}
     120
     121
     122
     123sub dxml_metadata
     124{
     125    my ($tagname, $attrHash, $contextArray, $parentDataArray, $parser) = @_;
     126
     127    my $parent_sec_num_hash = $parser->{'parameters'}->{'parent_sec_num_hash'};
     128   
     129    my $keep_parent_metadata = $parser->{'parameters'}->{'keep_parent_metadata'};
     130    my $keep_parent_content  = $parser->{'parameters'}->{'keep_parent_content'};
     131
     132    my $mode = $parser->{'parameters'}->{'mode'};
     133
     134    if ($mode eq "extract") {
     135
     136        my $new_docid = $parser->{'parameters'}->{'new_docid'};
     137        if ($attrHash->{'name'} eq "Identifier") {
     138        $attrHash->{'_content'} = $new_docid;
     139        }
     140    }
     141
     142    return [ $tagname => $attrHash ];
    119143}
    120144
     
    232256    (
    233257        _default => 'raw',
    234         'Section' => \&dxml_section
     258        'Section' => \&dxml_section,
     259            'Metadata' => \&dxml_metadata
    235260    );
    236261       
     
    276301                    keep_parent_metadata => $self->{'keep-parent-metadata'},
    277302                    keep_parent_content  => $self->{'keep-parent-content'},
     303                    new_docid            => $self->{'new_docid'},
    278304                        mode => $mode };
    279305
     
    361387    my $timestamp = time();
    362388    my $new_docid = $self->{'newd'} || "HASH$timestamp";
     389    $self->{'new_docid'} = $new_docid;
    363390
    364391    $self->{'keep-parent-metadata'} = $self->parse_flag("keep-parent-metadata");
Note: See TracChangeset for help on using the changeset viewer.