Changeset 22372


Ignore:
Timestamp:
07/09/10 18:30:29 (11 years ago)
Author:
ak19
Message:

None of Fedora, the GS3 democlient and Greenstone seem to require the first associated file to have a datastream named url, so the special handling for this has been removed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugouts/FedoraMETSPlugout.pm

    r22338 r22372  
    155155}
    156156
    157 
    158 #sub adjust_text_before_saving()
    159 sub adjust_links()
     157sub adjust_links
    160158{
    161159    my $self = shift(@_);
     
    163161
    164162    ## change links to be Fedora cognant:
    165     # 1. retrieve txt  $$textref ???
     163    # 1. retrieve txt of section - $$textref
    166164    # 2. change it:
    167165    # /$ENV{'FEDORA_PREFIX'}/objects/$greenstone-docobj-hash-xxx/datastreams/FG<orig-img-name>/content
    168     # (Note that the first image is always "url", instead of FG<orig-img-name>)
    169166    # 3. only replace it back in doc_obj if we didn't get a ref in the first place
    170167
    171168    my $OID = $doc_obj->get_OID();
    172169    my $fnamespace = $self->{'fedora_namespace'};
    173     my $replace_img_name = 1;
    174170    if($OID ne "collection" && defined $fnamespace) {
    175171    my $fed_id = "$fnamespace:".$ENV{'GSDLCOLLECTION'}."-$OID"; #oid_namespace:collection-OID
    176     my $fedora_url_prefix = $ENV{'FEDORA_PREFIX'}."/objects/$fed_id/datastreams/";
     172    my $fedora_url_prefix = $ENV{'FEDORA_PREFIX'}."/objects/$fed_id/datastreams/FG";
    177173    my $fedora_url_suffix = "/content";
    178174
    179     $$textref =~ s/(<(?:img|embed|table|tr|td|link|script)[^>]*?(?:src|background|href)\s*=\s*)((?:[\"][^\"]+[\"])|(?:[\'][^\']+[\'])|(?:[^\s\/>]+))([^>]*>)/$self->replace_rel_link($1, $2, $3, $fedora_url_prefix, $fedora_url_suffix, $replace_img_name--)/isge;
     175    $$textref =~ s/(<(?:img|embed|table|tr|td|link|script)[^>]*?(?:src|background|href)\s*=\s*)((?:[\"][^\"]+[\"])|(?:[\'][^\']+[\'])|(?:[^\s\/>]+))([^>]*>)/$self->replace_rel_link($1, $2, $3, $fedora_url_prefix, $fedora_url_suffix)/isge;
    180176#   print STDERR "*** all text after: $$textref\n\n";
    181177    }
     
    188184{
    189185    my $self = shift (@_);
    190     my ($front, $link, $back, $url_prefix, $url_suffix, $replace_img_name) = @_;
     186    my ($front, $link, $back, $url_prefix, $url_suffix) = @_;
    191187
    192188    # only process relative links. Return if absolute link
     
    203199    }
    204200
    205     # remove any _httpdocimg/ that greenstone may have prefixed to the image
     201    # remove any _httpdocimg_/ that greenstone may have prefixed to the image
    206202    $link =~ s/^_httpdocimg_(?:\/|\\)//;
    207 
    208     # the datastream of the first image of each section is always called "url"
    209     if($replace_img_name) {
    210     return "$front$url_prefix"."url"."$url_suffix$back";
    211     }
    212     # else
    213     return "$front$url_prefix"."FG"."$link$url_suffix$back";
     203   
     204    return "$front$url_prefix$link$url_suffix$back";
    214205}
    215206
     
    683674
    684675
    685     my $first_assocfile = 1;
    686 
    687676    foreach my $data (@{$section_ptr->{'metadata'}}){
    688677       my $escaped_value = &docprint::escape_text($data->[1]);
     
    695684       my $assoc_dir  = $3;
    696685
    697        if ($first_assocfile) {
    698            $id_root = "url";
    699            $first_assocfile = 0;
    700        }
    701        else {
    702            $id_root = "FG$assoc_file";
    703        }
     686       $id_root = "FG$assoc_file";
    704687
    705688       $id_root =~ s/\//_/g;
Note: See TracChangeset for help on using the changeset viewer.