Changeset 15019


Ignore:
Timestamp:
2008-02-27T17:09:21+13:00 (14 years ago)
Author:
davidb
Message:

mkcol.pl now takes "-group" option to signal that the the collection being formed is to be a "group-level" collection (i.e. one that acts as a container that conveniently groups a further set of collections together).

Location:
gsdl/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/bin/script/mkcol.pl

    r14565 r15019  
    7979    'type' => "flag",
    8080    'reqd' => "no" },
     81      { 'name' => "group",
     82    'desc' => "mkcol.group",
     83    'type' => "flag",
     84    'reqd' => "no" },
    8185      { 'name' => "collectdir",
    8286    'desc' => "{mkcol.collectdir}",
     
    112116    'desc' => "{mkcol.win31compat}",
    113117    'type' => "enum",
    114     'deft' => "true",
     118    'deft' => "false",
    115119    'list' => $win31compat_list,
    116120    'reqd' => "no" },
     
    132136
    133137# options
    134 my ($creator, $optionfile, $maintainer, $gs3mode, $collectdir, $public,
     138my ($creator, $optionfile, $maintainer, $gs3mode, $group, $collectdir, $public,
    135139    $title, $about, $plugin, $quiet, $language, $win31compat, $gli);
    136140
    137141#other variables
    138 my ($collection, $capcollection, $pluginstring, @plugin);
     142my ($collection, $capcollection,
     143    $collection_tail, $capcollection_tail,
     144    $pluginstring, @plugin);
    139145
    140146&main();
     
    174180    } else {
    175181
    176         # There are only two configuration files in modelcol directory:
    177         # collect.cfg and collectionConfig.xml.
    178         # If it is gs2, copy collect.cfg file; if gs3, copy collectionConfig.xml.
    179       if ( ($gs3 && $file =~ /collect\.cfg/) || (!$gs3 && $file =~ /collectionConfig\.xml/) ) {
    180          
    181         next;
    182       }
    183182        my $destfile = $file;
    184183        $destfile =~ s/^modelcol/$collection/;
    185184        $destfile =~ s/^MODELCOL/$capcollection/;
     185
     186        # There are three configuration files in modelcol directory:
     187        # collect.cfg, group.cfg and collectionConfig.xml.
     188        # If it is gs2, copy relevant collect.cfg or group.cfg file; if gs3, copy collectionConfig.xml.
     189
     190        if ($gs3) {
     191        if ($group) {
     192            &gsprintf(STDERR,"{common.group_not_valid_in_gs3}\n");
     193        }
     194        else {
     195            next if ($file =~ m/(collect|group)\.cfg/);
     196        }
     197        }
     198        else {
     199        # Greenstone 2
     200        if ($group) {
     201            next if ($file =~ m/collect\.cfg/);
     202
     203            # If get to here: input file = group.cfg
     204            # => want output file = collect.cfg
     205            $destfile =~ s/group\.cfg/collect\.cfg/;
     206        }
     207        else {
     208            next if ($file =~ m/collect\.cfg/);
     209        }
     210
     211        }
     212
     213
    186214        &gsprintf(STDOUT, "{mkcol.doing_replacements}\n", $destfile)
    187215        unless $quiet;
     
    194222
    195223        while (defined (my $line = <INFILE>)) {
    196         $line =~ s/\*\*collection\*\*/$collection/g;
    197         $line =~ s/\*\*COLLECTION\*\*/$capcollection/g;
     224        $line =~ s/\*\*collection\*\*/$collection_tail/g;
     225        $line =~ s/\*\*COLLECTION\*\*/$capcollection_tail/g;
    198226        $line =~ s/\*\*creator\*\*/$creator/g;
    199227        $line =~ s/\*\*maintainer\*\*/$maintainer/g;
     
    290318    # get and check the collection name
    291319    ($collection) = @ARGV;
     320
     321    # get capitalised version of the collection
     322    $capcollection = $collection;
     323    $capcollection =~ tr/a-z/A-Z/;
     324
     325    $collection_tail = &util::get_dirsep_tail($collection);
     326    $capcollection_tail = &util::get_dirsep_tail($capcollection);
     327
     328
    292329    if (!defined($collection)) {
    293330    &gsprintf(STDOUT, "{mkcol.no_colname}\n");
     
    296333    }
    297334
    298     if (($win31compat eq "true") && (length($collection)) > 8) {
     335    if (($win31compat eq "true") && (length($collection_tail)) > 8) {
    299336    &gsprintf(STDOUT, "{mkcol.long_colname}\n");
    300337    die "\n";
     
    306343    }
    307344
    308     if ($collection eq "CVS") {
     345    if ($collection_tail eq "CVS") {
    309346    &gsprintf(STDOUT, "{mkcol.bad_name_cvs}\n");
     347    die "\n";
     348    }
     349
     350    if ($collection_tail eq ".svn") {
     351    &gsprintf(STDOUT, "{mkcol.bad_name_svn}\n");
    310352    die "\n";
    311353    }
     
    318360
    319361    if (!defined($title) || $title eq "") {
    320     $title = $collection;
    321     }
    322 
    323     # get capitalised version of the collection
    324     $capcollection = $collection;
    325     $capcollection =~ tr/a-z/A-Z/;
     362    $title = $collection_tail;
     363    }
     364
    326365
    327366    # get the strings to include.
  • gsdl/trunk/perllib/strings.properties

    r14997 r15019  
    346346mkcol.bad_name_cvs:ERROR: No collection can be named CVS as this may interfere with directories created by the CVS versioning system.
    347347
     348mkcol.bad_name_svn:ERROR: No collection can be named .svn as this may interfere with directories created by the SVN versioning system.
     349
    348350mkcol.bad_name_modelcol:ERROR: No collection can be named modelcol as this is the name of the model collection.
    349351
Note: See TracChangeset for help on using the changeset viewer.