Changeset 3148


Ignore:
Timestamp:
2002-06-17T10:28:16+12:00 (22 years ago)
Author:
jrm21
Message:

If a document has associated files that are also given a subdirectory, that subdirectory is now a subdir of the HASH... dir and not just a subdir of the assoc dir. If the given subdir starts with a '/' then it will be a subdir of the assoc dir.

Eg
"1.jpg" will be put into building/assoc/HASHnnn.dir/1.jpg
"0/1.jpg" will be put into building/assoc/HASHnnn.dir/0/1.jpg
"/foo/1.jpg" -> building/assoc/foo/1.jpg

This is because HTMLPlug was putting first 1000 assoc files into "assoc/0", next thousand into "assoc/1", etc. But this meant that if you updated a collection, files in "0" would get overridden.

The only change to HTMLPlug is to use the _httpdocimg_ macro instead of the _httpcolling_ so we link to the right place.

Location:
trunk/gsdl/perllib
Files:
3 edited

Legend:

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

    r2505 r3148  
    239239   
    240240    foreach my $assoc_file (@{$doc_obj->get_assoc_files()}) {
    241     # if assoc file contains directory structure of
    242     # its own use it, otherwise use HASH... directory
    243     if ($assoc_file->[1] =~ /[\/\\]/) {
    244         $afile = &util::filename_cat($self->{'assocdir'}, $assoc_file->[1]);
     241    # if assoc file starts with a slash, we put it relative to the assoc
     242    # dir, otherwise it is relative to the HASH... directory
     243    if ($assoc_file->[1] =~ m@^[/\\]@) {
     244        $afile = &util::filename_cat($self->{'assocdir'},$assoc_file->[1]);
    245245    } else {
    246246        $afile = &util::filename_cat($self->{'assocdir'}, $archivedir, $assoc_file->[1]);
  • trunk/gsdl/perllib/mgppbuildproc.pm

    r2771 r3148  
    272272   
    273273    foreach my $assoc_file (@{$doc_obj->get_assoc_files()}) {
    274     # if assoc file contains directory structure of
    275     # its own use it, otherwise use HASH... directory
    276     if ($assoc_file->[1] =~ /[\/\\]/) {
    277         $afile = &util::filename_cat($self->{'assocdir'}, $assoc_file->[1]);
     274    # if assoc file starts with a slash, we put it relative to the assoc
     275    # dir, otherwise it is relative to the HASH... directory
     276    if ($assoc_file->[1] =~ m@^[/\\]@) {
     277        $afile = &util::filename_cat($self->{'assocdir'},$assoc_file->[1]);
    278278    } else {
    279279        $afile = &util::filename_cat($self->{'assocdir'}, $archivedir, $assoc_file->[1]);
  • trunk/gsdl/perllib/plugins/HTMLPlug.pm

    r3135 r3148  
    149149      $file =~ s@(\\)+@/@g;
    150150    }
     151
     152    # reset per-doc stuff...
     153    $self->{'aux_files'} = {};
     154    $self->{'dir_num'} = 0;
     155    $self->{'file_num'} = 0;
     156
    151157    my $cursection = $doc_obj->get_top_section();
    152158
     
    372378    }
    373379    $doc_obj->associate_file($filename, $newname, undef, $section);
    374     return "_httpcollimg_/$newname";
     380    return "_httpdocimg_/$newname";
    375381
    376382    } else {
Note: See TracChangeset for help on using the changeset viewer.