Changeset 12961


Ignore:
Timestamp:
2006-10-01T12:12:31+13:00 (18 years ago)
Author:
kjdon
Message:

added a new option to ConvertToPlug: -keep_original_filename. The original fileanme will be used for the assocaited file rather than doc,pdf, doc.doc etc

Location:
trunk/gsdl/perllib
Files:
2 edited

Legend:

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

    r12741 r12961  
    6262    'list' => $convert_to_list,
    6363    'deft' => "auto" },
     64      { 'name' => "keep_original_filename",
     65    'desc' => "{ConvertToPlug.keep_original_filename}",
     66    'type' => "flag" },
    6467      { 'name' => "title_sub",
    6568    'desc' => "{HTMLPlug.title_sub}",
     
    459462    my $cursection = $doc_obj->get_top_section();
    460463    my $filename = &util::filename_cat($base_dir, $file);
    461     $doc_obj->associate_file($filename, "doc.$doc_ext", undef, $cursection);
     464    my $assocfilename = "doc.$doc_ext";
     465    if ($self->{'keep_original_filename'} == 1) {
     466    # this should be the same filename that was used for the Source metadata, as we will use [Source] in the srclink
     467    ($assocfilename) = $file =~ /([^\\\/]+)$/;
     468    }
     469    $doc_obj->associate_file($filename, $assocfilename, undef, $cursection);
    462470
    463471    my $file_type;
     
    481489    # We use set instead of add here because we only want one value
    482490    $doc_obj->set_utf8_metadata_element($cursection, "FileFormat", $file_format);
    483 
    484491    my $doclink = "<a href=\"_httpprefix_/collect/[collection]/index/assoc/[archivedir]/doc.$doc_ext\">";
     492    if ($self->{'keep_original_filename'} == 1) {
     493    $doclink = "<a href=\"_httpprefix_/collect/[collection]/index/assoc/[archivedir]/[Source]\">";
     494    }
    485495    $doc_obj->add_utf8_metadata ($cursection, "srclink",  $doclink);
    486496    $doc_obj->add_utf8_metadata ($cursection, "srcicon",  "_icon".$doc_ext."_");
  • trunk/gsdl/perllib/strings.properties

    r12947 r12961  
    733733
    734734ConvertToPlug.desc:This plugin is inherited by such plugins as WordPlug, PPTPlug, PSPlug, RTFPlug and PDFPlug. It facilitates the conversion of these document types to either HTML, TEXT or a series of images. It works by dynamically loading an appropriate secondary plugin (HTMLPlug, StructuredHTMLPlug, PagedImgPlug or TEXTPlug) based on the plugin argument 'convert_to'.
    735 
     735ConvertToPlug.keep_original_filename:Keep the original filename for the associated file, rather than converting to doc.pdf, doc.doc etc.
    736736ConvertToPlug.use_strings:If set, a simple strings function will be called to extract text if the conversion utility fails.
    737737
Note: See TracChangeset for help on using the changeset viewer.