Ignore:
Timestamp:
1999-06-25T11:35:22+12:00 (25 years ago)
Author:
rjmcnab
Message:

Added code to retain the ordering of indexes, subcollections, and languages
in build.cfg.

File:
1 edited

Legend:

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

    r246 r290  
    231231
    232232    my %mapping = ();
     233    $mapping{'indexmaporder'} = [];
     234    $mapping{'subcollectionmaporder'} = [];
     235    $mapping{'languagemaporder'} = [];
    233236   
    234237    # dirnames is used to check for collisions. Start this off
     
    263266    }
    264267
    265     $mapping{'indexmap'}{"$level:$gran"} = $pindex;
    266     $mapping{'subcollectionmap'}{$subcollection} = $psub if $psub =~ /\w/;
    267     $mapping{'languagemap'}{$languages} = $plang if $plang =~ /\w/;
     268    # store the mapping orders as well as the maps
     269    if (!defined $mapping{'indexmap'}{"$level:$gran"}) {
     270        $mapping{'indexmap'}{"$level:$gran"} = $pindex;
     271        push (@{$mapping{'indexmaporder'}}, "$level:$gran");
     272    }
     273    if ($psub =~ /\w/ && !defined ($mapping{'subcollectionmap'}{$subcollection})) {
     274        $mapping{'subcollectionmap'}{$subcollection} = $psub;
     275        push (@{$mapping{'subcollectionmaporder'}}, $subcollection);
     276    }
     277    if ($plang =~ /\w/ && !defined ($mapping{'languagemap'}{$languages})) {
     278        $mapping{'languagemap'}{$languages} = $plang;
     279        push (@{$mapping{'languagemaporder'}}, $language);
     280    }
    268281    $mapping{$index} = $dirname;
    269282    $dirnames{$dirname} = $index;
     
    529542    # store the mapping between the index names and the directory names
    530543    my @indexmap = ();
    531     foreach $index (keys (%{$self->{'index_mapping'}->{'indexmap'}})) {
     544    foreach $index (@{$self->{'index_mapping'}->{'indexmaporder'}}) {
    532545    push (@indexmap, "$index\-\>$self->{'index_mapping'}->{'indexmap'}->{$index}");
    533546    }
     
    535548
    536549    my @subcollectionmap = ();
    537     foreach $subcollection (keys (%{$self->{'index_mapping'}->{'subcollectionmap'}})) {
    538     push (@subcollectionmap, "$subcollection\-\>$self->{'index_mapping'}->{'subcollectionmap'}->{$subcollection}");
     550    foreach $subcollection (@{$self->{'index_mapping'}->{'subcollectionmaporder'}}) {
     551    push (@subcollectionmap, "$subcollection\-\>$self->{'index_mapping'}->".
     552          "{'subcollectionmap'}->{$subcollection}");
    539553    }
    540554    $build_cfg->{'subcollectionmap'} = \@subcollectionmap if scalar (@subcollectionmap);
    541555
    542556    my @languagemap = ();
    543     foreach $language (keys (%{$self->{'index_mapping'}->{'languagemap'}})) {
    544     push (@languagemap, "$language\-\>$self->{'index_mapping'}->{'languagemap'}->{$language}");
     557    foreach $language (@{$self->{'index_mapping'}->{'languagemaporder'}}) {
     558    push (@languagemap, "$language\-\>$self->{'index_mapping'}->{'languagemap'}->".
     559          "{$language}");
    545560    }
    546561    $build_cfg->{'languagemap'} = \@languagemap if scalar (@languagemap);
Note: See TracChangeset for help on using the changeset viewer.