Changeset 29422


Ignore:
Timestamp:
11/12/14 12:20:21 (6 years ago)
Author:
kjdon
Message:

handling reading in and writing out defaultSort from and to collectionConfig.xml and buildConfig.xml

Location:
main/trunk/greenstone2/perllib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/buildConfigxml.pm

    r28876 r29422  
    376376    my $sortmap = {};  # maps index name to shortname
    377377    my $sortlist = []; # keeps the order for indexes
     378    my $defaultsort = "";
    378379
    379380    if (defined ($buildcfg->{"indexsortfieldmap"})) {
     381    my $first = 1;
     382
    380383    my $sortmap_t = $buildcfg->{"indexsortfieldmap"};
    381384    foreach my $s (@$sortmap_t) {
    382385        my ($k, $v) = $s =~ /^(.*)\-\>(.*)$/;
     386        $sortmap->{$k} = $v;
    383387        $sortmap->{$v} = $k;
     388        if ($first) {
     389        $defaultsort = $v;
     390        $first = 0;
     391        }
    384392    }
    385393    }
     
    388396    }
    389397
     398    if (defined $collectcfg->{"defaultsort"}) {
     399    $defaultsort = $sortmap->{$collectcfg->{"defaultsort"}};
     400    }
    390401    $settings->{'sortlist'} = $sortlist;
    391402    $settings->{'sortmap'} = $sortmap;
     403    $settings->{'defaultsort'} = $defaultsort;
    392404
    393405    # facet field list
     
    512524        $sortf = $sortmap->{$sf};
    513525        }
    514         &write_line('COLCFG', ["<sort name=\"", $sortf, "\" shortname=\"", $sf, "\" />"]);
     526        &write_line('COLCFG', ["<sort name=\"", $sf, "\" shortname=\"", $sortf, "\" />"]);
    515527       
    516528    }
    517529    &write_line('COLCFG', ["</sortList>"]);
     530    &write_line('COLCFG', ["<defaultSort shortname=\"", $settings->{'defaultsort'}, "\" />"]);
    518531    }
    519532
  • main/trunk/greenstone2/perllib/collConfigxml.pm

    r29176 r29422  
    5555           "indexfieldoptions" => "indexfieldoptions",
    5656           "sort" => "sortfields",
     57           "defaultSort" => "defaultsort",
    5758           "facet" => "facetfields",
    5859           "plugin" => "plugin",
     
    101102my $hashhashexp = q/^(displayItem)$/; # add other (collectionmeta) element names that should be represented by hashes of hashes here.
    102103
    103 my $defaults = q/^(defaultIndex|defaultLevel|defaultIndexLanguage|languageMetadata)$/;
     104my $defaults = q/^(defaultIndex|defaultLevel|defaultSort|defaultIndexLanguage|languageMetadata)$/;
    104105
    105106# Reads in the model collection configuration file, collectionConfig.xml,
Note: See TracChangeset for help on using the changeset viewer.