Ignore:
Timestamp:
2008-12-11T10:37:02+13:00 (15 years ago)
Author:
kjdon
Message:

commented out some print statements, fixed up the broken assocfile stuff in extra_metadata

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/plugins/BasePlugin.pm

    r17300 r18171  
    402402    my $associate_tail_re = $self->{'associate_tail_re'};
    403403    if ((defined $associate_tail_re) && ($associate_tail_re ne "")) {
    404    
    405404    my ($file_prefix,$file_ext)
    406405        = &util::get_prefix_and_tail_by_regex($filename_full_path,$associate_tail_re);
    407    
    408406    if ((defined $file_prefix) && (defined $file_ext)) {
    409407        my $shared_fileroot = $block_hash->{'shared_fileroot'};
     
    545543    }
    546544
    547     print STDERR "**** UTF8 encoding the filename $filemeta ";
     545    #print STDERR "**** UTF8 encoding the filename $filemeta ";
    548546   
    549547    # if the filename encoding is set to utf8 but it isn't utf8 already--such as when
     
    563561    }
    564562
    565     print STDERR " from encoding $filename_encoding -> $filemeta\n";
     563    #print STDERR " from encoding $filename_encoding -> $filemeta\n";
    566564    return $filemeta;
    567565}
     
    593591    }
    594592
    595     print STDERR "*** filename encoding determined based on locale: " . $self->{'filesystem_encoding'} . "\n";
     593    #print STDERR "*** filename encoding determined based on locale: " . $self->{'filesystem_encoding'} . "\n";
    596594    return $self->{'filesystem_encoding'}; # can be the string "undefined"
    597595}
     
    10031001        foreach my $gaf (@{$metadata->{$field}}) {
    10041002        my ($full_filename,$mimetype) = ($gaf =~ m/^(.*):(.*):$/);
    1005         #my ($tail_filename) = ($full_filename =~ /^.*[\/\\](.+?)$/);
    1006         my $tail_filename = $doc_obj->get_assocfile_from_sourcefile();
    1007         my $filename = $full_filename;
     1003        my ($tail_filename) = ($full_filename =~ /^.*[\/\\](.+?)$/);
     1004       
     1005        # we need to make sure the filename is valid utf-8 - we do
     1006        # this by url encoding it
     1007        # $tail_filename is the name that we store the file as
     1008        $tail_filename = &unicode::url_encode($tail_filename);
    10081009        $doc_obj->associate_file($full_filename,$tail_filename,$mimetype);
    1009 
     1010        # then we need to encode the % signs in the filename, so that
     1011        # it works in a url
     1012        my $url_tail_filename = &unicode::filename_to_url($tail_filename);
    10101013        # work out extended tail extension (i.e. matching tail re)
    10111014
     
    10131016            = &util::get_prefix_and_tail_by_regex($tail_filename,$associate_tail_re);
    10141017        my ($pre_doc_ext) = ($file_extended_ext =~ m/^(.*)\..*$/);
    1015 
    10161018        my ($doc_ext) = ($tail_filename =~ m/^.*\.(.*)$/);
    1017         my $start_doclink = "<a href=\"_httpprefix_/collect/[collection]/index/assoc/{Or}{[parent(Top):archivedir],[archivedir]}/$tail_filename\">";
     1019        my $start_doclink = "<a href=\"_httpprefix_/collect/[collection]/index/assoc/{Or}{[parent(Top):archivedir],[archivedir]}/$url_tail_filename\">";
    10181020        my $srcicon = "_icon".$doc_ext."_";
    10191021        my $end_doclink = "</a>";
     
    10211023        my $assoc_form = "$start_doclink\{If\}{$srcicon,$srcicon,$doc_ext\}$end_doclink";
    10221024
    1023         if (defined $pre_doc_ext) {
     1025        if (defined $pre_doc_ext && $pre_doc_ext ne "") {
    10241026            # for metadata such as [mp3._edited] [mp3._full] ...
    10251027            $doc_obj->add_utf8_metadata ($cursection, "$doc_ext.$pre_doc_ext", $assoc_form);
Note: See TracChangeset for help on using the changeset viewer.