Ignore:
Timestamp:
2000-02-02T14:32:33+13:00 (24 years ago)
Author:
sjboddie
Message:

small change to doc data structure to allow for some hacking
in WebPlug

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/basedoc.pm

    r846 r899  
    716716# methods for dealing with associated files
    717717
     718# a file is associated with a document, NOT a section.
     719# if section is defined it is noted in the data structure
     720# only so that files associated from a particular section
     721# may be removed later (using delete_section_assoc_files)
    718722sub associate_file {
    719723    my $self = shift (@_);
    720     my ($real_filename, $assoc_filename, $mime_type) = @_;
     724    my ($real_filename, $assoc_filename, $mime_type, $section) = @_;
    721725    $mime_type = &html::guess_mime_type ($real_filename) unless defined $mime_type;
    722726
     
    725729
    726730    push (@{$self->{'associated_files'}},
    727       [$real_filename, $assoc_filename, $mime_type]);
     731      [$real_filename, $assoc_filename, $mime_type, $section]);
    728732}
    729733
     
    734738
    735739    return $self->{'associated_files'};
     740}
     741
     742sub delete_section_assoc_files {
     743    my $self = shift (@_);
     744    my ($section) = @_;
     745
     746    my $i=0;
     747    while ($i < scalar (@{$self->{'associated_files'}})) {
     748    if (defined $self->{'associated_files'}->[$i]->[3] &&
     749        $self->{'associated_files'}->[$i]->[3] eq $section) {
     750        splice (@{$self->{'associated_files'}}, $i, 1);
     751    } else {
     752        $i++;
     753    }
     754    }
    736755}
    737756
Note: See TracChangeset for help on using the changeset viewer.