Changeset 2785


Ignore:
Timestamp:
2001-10-09T17:21:29+13:00 (20 years ago)
Author:
sjboddie
Message:

The build process now creates a summary of how many files were included,
which were rejected, etc. A link to a page containing this summary is
provided from the final page of the collector (once the collection is built
successfully) and from the default "about this collection" text for
collections built by the collector.

Also did a little bit of tidying in a couple of places

Location:
trunk/gsdl
Files:
1 added
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/bin/script/build

    r2774 r2785  
    132132&main();
    133133
    134 close OUT if $use_out;
     134if ($use_out) {
     135    close OUT;
     136
     137    # if we've created a build log we'll copy it to the collection's etc
     138    # directory
     139    my ($etcdir);
     140    if ($dontinstall) {
     141    $etcdir = &util::filename_cat($collectdir, "etc", "build.log");
     142    } else {
     143    $etcdir = &util::filename_cat($ENV{'GSDLHOME'}, "collect", $collection, "etc", "build.log");
     144    }
     145   
     146    &util::cp($outfile, $etcdir);
     147}
    135148
    136149sub print_usage {
     
    168181    print STDOUT "   -out                    Filename or handle to print output status to.\n";
    169182    print STDOUT "                           The default is STDERR\n";
     183    print STDOUT "   -statsfile name         Filename or handle to print import statistics to.\n";
     184    print STDOUT "                           The default is STDERR\n";
    170185    print STDOUT "   -make_writable          If set build will make the collection and any\n";
    171186    print STDOUT "                           temporary files it created globally writable after\n";
     
    373388    $import_cmd .= " -removeold" unless $append;
    374389    $import_cmd .= " -collectdir \"$collectdir\"" if $collectdir =~ /\w/;
     390    $import_cmd .= " -statsfile \"$statsfile\"" if $statsfile =~ /\w/;
    375391    $import_cmd .= " $maxdocs $collection";
     392
     393    print STDERR "\n**import_cmd: $import_cmd\n";
     394
    376395    system ($import_cmd);
    377396    # if using output directory append the import output to it
     
    558577             'email_events/.*/', \$email_events,
    559578             'mail_server/.*/', \$mail_server,
     579             'statsfile/.*/STDERR', \$statsfile,
    560580             'event_header/.*/', \$event_header)) {
    561581   
  • trunk/gsdl/bin/script/buildcol.pl

    r2524 r2785  
    7676    print STDOUT "   -no_strip_html        Do not strip the html tags from the indexed text\n";
    7777    print STDOUT "                         (only used for mgpp collections).\n\n";
     78    print STDOUT "   -faillog name         Fail log filename. This log receives the filenames\n";
     79    print STDOUT "                         of any files which fail to be processed (defaults.\n";
     80    print STDOUT "                         to " .
     81    &util::filename_cat("<collectdir>", "colname", "etc", "fail.log") . ")\n";
    7882    print STDOUT "  [Type \"perl -S buildcol.pl | more\" if this help text scrolled off your screen]";
    7983    print STDOUT "\n" unless $ENV{'GSDLOS'} =~ /^windows$/i;
     
    8690    $debug, $mode, $indexname, $keepold, $allclassifications,
    8791    $create_images, $collectdir, $out, $buildtype, $textindex,
    88     $no_strip_html, $no_text);
     92    $no_strip_html, $no_text, $faillog);
    8993
    9094    # note that no defaults are passed for most options as they're set
     
    106110             'out/.*/STDERR', \$out,
    107111             'no_strip_html', \$no_strip_html,
    108              'buildtype/^(mg|mgpp)$/', \$buildtype)) {
     112             'buildtype/^(mg|mgpp)$/', \$buildtype,
     113             'faillog/.*/', \$faillog)) {
    109114    &print_usage();
    110115    die "\n";
     
    125130    die "\n";
    126131    }
     132
     133    if ($faillog eq "") {
     134    $faillog = &util::filename_cat($ENV{'GSDLCOLLECTDIR'}, "etc", "fail.log");
     135    }
     136    # note that we're appending to the faillog here (import.pl clears it each time)
     137    # this could potentially create a situation where the faillog keeps being added
     138    # to over multiple builds (if the import process is being skipped)
     139    open (FAILLOG, ">>$faillog") || die "Couldn't open fail log $faillog\n";
     140    $faillog = 'buildcol::FAILLOG';
     141    $faillog->autoflush(1);
    127142
    128143    # read the configuration file
     
    268283     "\$realarchivedir, \$realbuilddir, \$verbosity, " .
    269284     "\$maxdocs, \$debug, \$keepold, \$allclassifications, " .
    270      "\$out, \$no_text)");
     285     "\$out, \$no_text, \$faillog)");
    271286    die "$@" if $@;
    272287
     
    301316
    302317    close OUT if $close_out;
     318    close FAILLOG;
    303319}
    304320
  • trunk/gsdl/bin/script/classinfo.pl

    r1970 r2785  
    3535}
    3636
    37 use strict;
    3837use classify;
    3938use util;
  • trunk/gsdl/bin/script/import.pl

    r2766 r2785  
    8181    &util::filename_cat ($ENV{'GSDLHOME'}, "collect") . ")\n";
    8282    print STDOUT "   -out name              Filename or handle to print output status to.\n";
    83     print STDOUT "   -faillog name          Filename to log import failures to.\n";
    84     print STDOUT "                          The default is <collectdir>/colname/etc/fail.log\n\n";
     83    print STDOUT "                          The default is STDERR\n";
     84    print STDOUT "   -statsfile name        Filename or handle to print import statistics to.\n";
     85    print STDOUT "                          The default is STDERR\n";
     86    print STDOUT "   -faillog name          Fail log filename. This log receives the filenames\n";
     87    print STDOUT "                          of any files which fail to be processed (defaults.\n";
     88    print STDOUT "                          to " .
     89    &util::filename_cat("<collectdir>", "colname", "etc", "fail.log") . ")\n";
    8590    print STDOUT "  [Type \"perl -S import.pl | more\" if this help text scrolled off your screen]";
    8691    print STDOUT "\n" unless $ENV{'GSDLOS'} =~ /^windows$/i;
     
    9398    $removeold, $gzip, $groupsize, $OIDtype, $debug,
    9499    $maxdocs, $collection, $configfilename, $collectcfg,
    95     $pluginfo, $sortmeta, $archive_info_filename,
    96     $archive_info, $processor, $out, $faillogname, $collectdir);
     100    $pluginfo, $sortmeta, $archive_info_filename, $statsfile,
     101    $archive_info, $processor, $out, $faillog, $collectdir);
    97102
    98103    # note that no defaults are passed for most options as they're set
     
    112117             'collectdir/.*/', \$collectdir,
    113118             'out/.*/STDERR', \$out,
    114              'faillog/.*/', \$faillogname)) {
     119             'statsfile/.*/STDERR', \$statsfile,
     120             'faillog/.*/', \$faillog)) {
    115121    &print_usage();
    116122    die "\n";
     
    133139    die "\n";
    134140    }
    135    
    136     # check and/or set fail log file
    137     if ($faillogname eq "") {
    138     $faillogname="$ENV{GSDLCOLLECTDIR}/etc/fail.log";
    139     } else {
    140     my $can_open=1;
    141     open (TESTOPEN, ">$faillogname") || ($can_open=0);
    142     close (TESTOPEN);
    143     if ($can_open==0) {
    144         warn "fail.log - cannot write to \"$faillogname\", using default\n \"$ENV{GSDLCOLLECTDIR}/etc/fail.log\" instead.\n";
    145         $faillogname="$ENV{GSDLCOLLECTDIR}/etc/fail.log";
    146     }
    147     }
    148     # test that default is writable...
    149     if ($faillogname eq "$ENV{GSDLCOLLECTDIR}/etc/fail.log") {
    150     my $can_open=1;
    151     open (TESTOPEN, ">$faillogname") || ($can_open=0);
    152     close (TESTOPEN);
    153     if ($can_open==0) {
    154         warn "warning - cannot write to \"$faillogname\".\n";
    155         $faillogname="";
    156     }
    157     }
    158 
     141
     142    if ($faillog eq "") {
     143    $faillog = &util::filename_cat($ENV{'GSDLCOLLECTDIR'}, "etc", "fail.log");
     144    }
     145    open (FAILLOG, ">$faillog") || die "Couldn't open fail log $faillog\n";
     146    $faillog = 'import::FAILLOG';
     147    $faillog->autoflush(1);
    159148
    160149    # check sortmeta
     
    256245
    257246    # load all the plugins
    258     $pluginfo = &plugin::load_plugins ($plugins, $verbosity, $out, $faillogname);
     247    $pluginfo = &plugin::load_plugins ($plugins, $verbosity, $out, $faillog);
    259248    if (scalar(@$pluginfo) == 0) {
    260249    print $out "No plugins were loaded.\n";
     
    290279   
    291280    &plugin::end($pluginfo, $processor);
    292    
     281
    293282    # write out the archive information file
    294283    if (!$debug) {
     
    296285    $archive_info->save_info($archive_info_filename);
    297286    }
     287   
     288    # write out import stats
     289    my $close_stats = 0;
     290    if ($statsfile !~ /^(STDERR|STDOUT)$/i) {
     291    if (open (STATS, ">$statsfile")) {
     292        $statsfile = 'import::STATS';
     293        $close_stats = 1;
     294    } else {
     295        print $out "WARNING: couldn't open stats file $statsfile\n";
     296        print $out "         will print stats to STDERR instead\n";
     297        $statsfile = 'STDERR';
     298    }
     299    }
     300
     301    print $out "\n";
     302    print $out "*********************************************\n";
     303    print $out "Import Complete\n";
     304    print $out "*********************************************\n";
     305
     306    &plugin::write_stats($pluginfo, $statsfile);
     307    if ($close_stats) {
     308    close STATS;
     309    }
     310
    298311    close OUT if $close_out;
     312    close FAILLOG;
    299313}
     314
  • trunk/gsdl/bin/script/mirror.pl

    r2472 r2785  
    4848}
    4949
    50 use strict;
    5150use arcinfo;
    5251use colcfg;
  • trunk/gsdl/bin/script/nightly.pl

    r1970 r2785  
    4141}
    4242
    43 use strict;
    4443use arcinfo;
    4544use colcfg;
  • trunk/gsdl/bin/script/pluginfo.pl

    r1970 r2785  
    3636}
    3737
    38 use strict;
    3938use plugin;
    4039use util;
  • trunk/gsdl/bin/script/update.pl

    r1970 r2785  
    4646}
    4747
    48 use strict;
    4948use arcinfo;
    5049use colcfg;
  • trunk/gsdl/etc/main.cfg

    r2731 r2785  
    7474                spanish.dm dutch.dm port.dm russian.dm russian2.dm \
    7575                italian.dm italian2.dm home.dm collect.dm docs.dm \
    76                 hebrew.dm
    77 
     76                hebrew.dm bsummary.dm
    7877
    7978# Define the interface languages and encodings supported by this receptionist
  • trunk/gsdl/macros/collect.dm

    r2777 r2785  
    715715<p>_textbildsuc_
    716716
     717<p>_textviewbildsummary_
     718
    717719<p><center>
    718720_collectorbar_
  • trunk/gsdl/macros/english.dm

    r2765 r2785  
    6262_collectorextra_ {
    6363<p>This collection contains _numdocs_ _If_("_numdocs_" eq "1",document,documents), a total of _numbytes_.
     64<p><a href="_httppagex_(bsummary)">Click here</a> to view the build summary for this collection.
    6465}
    6566
  • trunk/gsdl/macros/english2.dm

    r2784 r2785  
    470470_textseconds_ {seconds}
    471471_textbildsuc_ {Collection built successfully.}
     472
     473_textviewbildsummary_ {
     474You may <a href="_httppagex_(bsummary)&c=_cgiargbc1dirname_" target=_top>view the build
     475summary</a> of this collection for further details.
     476}
    472477
    473478_textfailmsg11_ {
     
    917922_textmus_ {main.cfg updated successfully}
    918923
     924
     925######################################################################
     926# 'bsummary' pages
     927package bsummary
     928######################################################################
     929
     930
     931#------------------------------------------------------------
     932# text macros
     933#------------------------------------------------------------
     934
     935_textbsummary_ {Build summary for _collectionname_ collection}
     936_textflog_ {Fail log for _collectionname_ collection}
     937
     938
  • trunk/gsdl/perllib/acronym.pm

    r1405 r2785  
    2626###########################################################################
    2727
    28 use strict;
    2928use diagnostics;
    3029
  • trunk/gsdl/perllib/mgbuilder.pm

    r2772 r2785  
    6262    my ($class, $collection, $source_dir, $build_dir, $verbosity,
    6363    $maxdocs, $debug, $keepold, $allclassifications,
    64     $outhandle, $no_text) = @_;
     64    $outhandle, $no_text, $failhandle) = @_;
    6565
    6666    $outhandle = STDERR unless defined $outhandle;
    6767    $no_text = 0 unless defined $no_text;
     68    $failhandle = STDERR unless defined $failhandle;
    6869
    6970    # create an mgbuilder object
     
    7879              'outhandle'=>$outhandle,
    7980              'no_text'=>$no_text,
     81              'failhandle'=>$failhandle,
    8082              'notbuilt'=>[]    # indexes not built
    8183              }, $class;
     
    134136   
    135137    # load all the plugins
    136     $self->{'pluginfo'} = &plugin::load_plugins ($plugins, $verbosity, $outhandle);
     138    $self->{'pluginfo'} = &plugin::load_plugins ($plugins, $verbosity, $outhandle, $failhandle);
    137139    if (scalar(@{$self->{'pluginfo'}}) == 0) {
    138140    print $outhandle "No plugins were loaded.\n";
  • trunk/gsdl/perllib/plugin.pm

    r2755 r2785  
    2828require util;
    2929
     30my $stats = {'num_processed' => 0,
     31         'num_blocked' => 0,
     32         'num_not_processed' => 0,
     33         'num_archives' => 0
     34         };
     35
    3036sub load_plugins {
    3137    my ($plugin_list) = shift @_;
    32     ($verbosity, $outhandle, $faillogname) = @_; # globals
     38    ($verbosity, $outhandle, $failhandle) = @_; # globals
    3339    my @plugin_objects = ();
    3440
    3541    $verbosity = 2 unless defined $verbosity;
    3642    $outhandle = STDERR unless defined $outhandle;
     43    $failhandle = STDERR unless defined $failhandle;
    3744
    3845    foreach $pluginoptions (@$plugin_list) {
     
    5865   
    5966    # initialize plugin
    60     $plugobj->init($verbosity, $outhandle, $faillogname);
     67    $plugobj->init($verbosity, $outhandle, $failhandle);
    6168
    6269    # add this object to the list
     
    94101    return $rv if defined $rv;
    95102    }
     103
     104    if ($verbosity >= 2) {
     105    print $outhandle "WARNING - no plugin could process $file\n";
     106    }
    96107   
    97     if ($verbosity >= 2) {
    98     print $outhandle "WARNING - no plugin could process " .
    99         &util::filename_cat($base_dir,$file) . "\n";
     108    $file =~ s/([^\\\/]+)$/$1/;
     109    print $failhandle "$file: no plugin could process this file\n";
     110    $stats->{'num_not_processed'} ++;
     111
     112    return 0;
     113}
     114
     115# write out some general stats that the plugins have compiled - note that
     116# the buildcol.pl process doesn't currently call this process so the stats
     117# are only output after import.pl -
     118sub write_stats {
     119    my ($pluginfo, $statshandle) = @_;
     120
     121    foreach $plugobj (@$pluginfo) {
     122    $plugobj->compile_stats($stats);
    100123    }
    101     return 0;
     124
     125    my $total = $stats->{'num_processed'} + $stats->{'num_blocked'} +
     126    $stats->{'num_not_processed'};
     127
     128    if ($total == 1) {
     129    print $statshandle "* 1 document was considered for processing\n";
     130    } else {
     131    print $statshandle "* $total documents were considered for processing\n";
     132    }
     133    if ($stats->{'num_archives'}) {
     134    print $statshandle "   (including the contents of " . $stats->{'num_archives'} .
     135        " ZIP/TAR archive";
     136    if ($stats->{'num_archives'} == 1) {print $statshandle ")\n";}
     137    else {print $statshandle "s)\n";}
     138    }
     139    if ($stats->{'num_processed'} == 1) {
     140    print $statshandle "* 1 was processed and included in the collection\n";
     141    } else {
     142    print $statshandle "* " . $stats->{'num_processed'} . " were processed and included in the collection\n";
     143    }
     144    if ($stats->{'num_not_processed'} == 1) {
     145    print $statshandle "* 1 was rejected.";
     146    } else {
     147    print $statshandle "* " . $stats->{'num_not_processed'} . " were rejected.";
     148    }
     149    print $statshandle " See the fail log for a list of rejected documents\n";
     150   
    102151}
    103152
  • trunk/gsdl/perllib/plugins/BasPlug.pm

    r2755 r2785  
    142142
    143143    $self->{'textcat'} = new textcat();
     144
     145    $self->{'num_processed'} = 0;
     146    $self->{'num_not_processed'} = 0;
     147    $self->{'num_blocked'} = 0;
     148    $self->{'num_archives'} = 0;
    144149   
    145150    # general options available to all plugins
     
    175180sub init {
    176181    my $self = shift (@_);
    177     my ($verbosity, $outhandle, $faillogname) = @_;
     182    my ($verbosity, $outhandle, $failhandle) = @_;
    178183
    179184    # verbosity is passed through from the processor
    180185    $self->{'verbosity'} = $verbosity;
    181186
    182     # as is the outhandle ...
     187    # as are the outhandle and failhandle
    183188    $self->{'outhandle'} = $outhandle if defined $outhandle;
    184     $self->{'faillogname'} = $faillogname;
     189    $self->{'failhandle'} = $failhandle;
    185190
    186191    # set process_exp and block_exp to defaults unless they were
     
    258263
    259264    my $filename = &util::filename_cat($base_dir, $file);
    260     return 0 if $self->{'block_exp'} ne "" && $filename =~ /$self->{'block_exp'}/;
     265    if ($self->{'block_exp'} ne "" && $filename =~ /$self->{'block_exp'}/) {
     266    $self->{'num_blocked'} ++;
     267    return 0;
     268    }
    261269    if ($filename !~ /$self->{'process_exp'}/ || !-f $filename) {
    262270    return undef;
     
    298306    if (!length ($text)) {
    299307    print $outhandle "$plugin_name: ERROR: $file contains no text\n" if $self->{'verbosity'};
     308
     309    my $failhandle = $self->{'failhandle'};
     310    print $failhandle "$file: " . ref($self) . ": file contains no text\n";
     311    $self->{'num_not_processed'} ++;
     312
    300313    return 0;
    301314    }
     
    316329    # process the document
    317330    $processor->process($doc_obj);
     331
     332    $self->{'num_processed'} ++;
    318333
    319334    return 1; # processed the file
     
    671686}
    672687
     688sub compile_stats {
     689    my $self = shift(@_);
     690    my ($stats) = @_;
     691
     692    $stats->{'num_processed'} += $self->{'num_processed'};
     693    $stats->{'num_not_processed'} += $self->{'num_not_processed'};
     694
     695}
     696
     697
    6736981;
  • trunk/gsdl/perllib/plugins/ConvertToPlug.pm

    r2755 r2785  
    4848#    @ISA = ('BasPlug'); #, 'HTMLPlug', 'TEXTPlug');
    4949}
    50 
    51 # use strict;  # this breaks 'print $outhandle ' error msgs.
    5250
    5351sub print_usage {
     
    146144    my $outhandle = $self->{'outhandle'};
    147145    my $convert_to = $self->{'convert_to'};
     146    my $failhandle = $self->{'failhandle'};
    148147
    149148    # softlink to collection tmp dir
     
    184183    if ($output_type eq "fail") {
    185184    print $outhandle "Could not convert $tailname$suffix to $convert_to format\n";
    186     if ($self->{'faillogname'} ne "" && -s "$errlog") {
    187         open(SAVELOG, ">>$self->{'faillogname'}");
     185    print $failhandle "$tailname$suffix: " . ref($self) . " failed to convert to $convert_to\n";
     186    $self->{'num_not_processed'} ++;
     187    if (-s "$errlog") {
    188188        open(ERRLOG, "$errlog");
    189         print SAVELOG "$tailname$suffix (converting to $convert_to) failed:\n";
    190189        while (<ERRLOG>) {
    191         print SAVELOG "$_";
     190        print $outhandle "$_";
    192191        }
     192        print $outhandle "\n";
    193193        close ERRLOG;
    194         print SAVELOG "\n";
    195         close SAVELOG;
    196194    }
    197195    &util::rm("$errlog") if (-e "$errlog");
     
    236234
    237235    my $filename = &util::filename_cat($base_dir, $file);
    238     return 0 if $self->{'block_exp'} ne "" && $filename =~ /$self->{'block_exp'}/;
     236    if ($self->{'block_exp'} ne "" && $filename =~ /$self->{'block_exp'}/) {
     237    $self->{'num_blocked'} ++;
     238    return 0;
     239    }
    239240    if ($filename !~ /$self->{'process_exp'}/ || !-f $filename) {
    240241        return undef;
     
    299300    $self->cleanup_tmp_area();
    300301
     302    $self->{'num_processed'} ++;
    301303
    302304    return 1;
  • trunk/gsdl/perllib/plugins/PDFPlug.pm

    r2661 r2785  
    6363
    6464    my $outhandle = $self->{'outhandle'};
    65     print $outhandle "PDFPlug: passing $_[3] onto $self->{'convert_to'} Plug\n"
     65    print $outhandle "PDFPlug: passing $_[3] on to $self->{'convert_to'}Plug\n"
    6666    if $self->{'verbosity'} > 1;
    6767   
     
    6969}
    7070
    71 
    72711;
    73 
    74 
    75 
    76 
  • trunk/gsdl/perllib/plugins/PSPlug.pm

    r2451 r2785  
    3333}
    3434
    35 use strict;
    36 
    37 
    3835sub new {
    3936    my $class = shift (@_);
     
    6562    print STDERR "using the PRESCRIPT package, which is available for download at\n   http://www.nzdl.org/html/software.html\n\n";
    6663}
    67 
    6864
    6965sub get_default_block_exp {
     
    147143}
    148144
    149 
    150145# do plugin specific processing of doc_obj for HTML type
    151146sub process {
     
    153148    my ($trash, $trash2, $path, $file, $trash3, $doc) = @_;
    154149
    155     print STDERR "PSPlug: passing $_[3] onto $self->{'convert_to'} Plug\n"
     150    my $outhandle = $self->{'outhandle'};
     151    print $outhandle "PSPlug: passing $_[3] on to $self->{'convert_to'}Plug\n"
    156152    if $self->{'verbosity'} > 1;
    157153   
  • trunk/gsdl/perllib/plugins/RTFPlug.pm

    r2564 r2785  
    3333}
    3434
    35 use strict;
    36 
    3735sub get_default_process_exp {
    3836    my $self = shift (@_);
     
    4240sub process {
    4341    my $self = shift (@_);
    44     print STDERR "RTFPlug: passing $_[3] onto $self->{'convert_to'} Plug\n"
     42
     43    my $outhandle = $self->{'outhandle'};
     44    print $outhandle "RTFPlug: passing $_[3] on to $self->{'convert_to'}Plug\n"
    4545    if $self->{'verbosity'} > 1;
     46
    4647    return ConvertToPlug::process_type($self,"rtf",@_);
    4748}
  • trunk/gsdl/perllib/plugins/WordPlug.pm

    r2515 r2785  
    4545
    4646    my $outhandle = $self->{'outhandle'};   
    47     print $outhandle "WordPlug: passing $_[3] onto $self->{'convert_to'} Plug\n"
     47    print $outhandle "WordPlug: passing $_[3] on to $self->{'convert_to'}Plug\n"
    4848    if $self->{'verbosity'} > 1;
    4949   
     
    5151}
    5252
    53 
    54531;
    55 
  • trunk/gsdl/perllib/plugins/ZIPPlug.pm

    r2082 r2785  
    119119    my $numdocs = &plugin::read ($pluginfo, "", $tmpdir, $metadata, $processor, $maxdocs);
    120120    &util::rm_r ($tmpdir);
     121
     122    $self->{'num_archives'} ++;
     123
    121124    return $numdocs;
    122125
  • trunk/gsdl/src/recpt/collectoraction.cpp

    r2774 r2785  
    10301030  // _faillog_ - set to last 6 lines of .bld file if build failed
    10311031  // _gsdlhome_ - the gsdlhome path (dm_safe)
    1032 
    10331032  // _sourcelist_ -- "input source" text boxes
    10341033  // _badsources_ -- will be set to "1" if we've come from the
     
    11541153    collectorbar += get_button (collector_page, "grey", "view", false);
    11551154  }
     1155
     1156  collectorbar += "</tr></table>\n";
     1157  disp.setmacro ("collectorbar", "collector", collectorbar);
    11561158
    11571159  if (collector_page == "bildfail") {
     
    11751177    disp.setmacro ("faillog", "collector", dm_safe(faillog));
    11761178  }
    1177 
    1178   collectorbar += "</tr></table>\n";
    1179   disp.setmacro ("collectorbar", "collector", collectorbar);
    11801179
    11811180  if (collector_page == "srce" || collector_page == "existing")
     
    16591658  }
    16601659   
     1660  text_t collectdir = get_collectdir (args);
     1661
    16611662  // set up build options
    16621663  text_t options = "-make_writable -remove_import -out \"";
    16631664  options += filename_cat (tmpdir, collection + ".bld");
    1664   options += "\" -collectdir \"" + get_collectdir (args) + "\"";
     1665  options += "\" -collectdir \"" + collectdir + "\" -statsfile \"";
     1666  options += filename_cat(collectdir, collection, "etc", "import.log") + "\"";
    16651667
    16661668  if (args["bc1esrce"] == 1) {
  • trunk/gsdl/src/recpt/pageaction.cpp

    r2782 r2785  
    2828#include "receptionist.h"
    2929#include "fileutil.h"
     30#include "gsdltools.h"
    3031#include <time.h>
    3132
     
    327328}
    328329
     330void pageaction::set_macro_to_file_contents (displayclass &disp, const text_t &macroname,
     331                         const text_t &packagename, const text_t &filename) {
     332
     333  text_t filecontent;
     334  char *filenamec = filename.getcstr();
     335  ifstream file_in (filenamec);
     336  delete filenamec;
     337  if (file_in) {
     338    char c;
     339    file_in.get(c);
     340    while (!file_in.eof ()) {
     341      if (c == '\n') filecontent += "<br>";
     342      filecontent.push_back(c);
     343      file_in.get(c);
     344    }
     345    file_in.close();
     346  }
     347  disp.setmacro (macroname, packagename, dm_safe(filecontent));
     348}
     349
    329350void pageaction::define_internal_macros (displayclass &disp, cgiargsclass &args,
    330351                     recptprotolistclass *protos, ostream &logout) {
     
    383404  // if page is "docs"
    384405  // _documentation_       links to PDF documents if they're available
     406
     407
     408  // if page is "bsummary"
     409  // _importlog_           set to contents of collections import.log file
     410  // _faillog_             set to contents of collections fail.log file
    385411
    386412 
     
    418444  //setting _queryformcontent_ so that the query interface is consistent.
    419445  if(arg_p == "about"){
    420     text_t collection = args["c"];
    421      //check that the protocol is alive
    422     recptproto* colproto = protos->getrecptproto (collection, logout);
    423     if(colproto == NULL) {
    424       logout << "ERROR: Null collection protocol trying to query"
    425          << collection.getcstr() << "\n";
    426       return;
    427     }
    428    
    429     //check the collection is responding/in place
    430     ColInfoResponse_t *colinfo = recpt->get_collectinfo_ptr(colproto, collection,
    431                                 logout);
    432     if(colinfo == NULL){
    433       logout << "ERROR: Null returned for get_collectinfo_ptr on "
    434          << collection.getcstr() << "in queryaction::define_query_interface\n";
    435       return;
    436     }
    437    
    438    
    439     text_tmap::iterator check = colinfo->format.find("QueryInterface");
    440     if(check != colinfo->format.end()){
    441       if((*check).second=="DateSearch"){
    442     text_t current = "_basicqueryform_ _datesearch_";
     446    if (cinfo != NULL) {
     447      text_tmap::iterator check = cinfo->format.find("QueryInterface");
     448      if(check != cinfo->format.end()){
     449    if((*check).second=="DateSearch"){
     450      text_t current = "_basicqueryform_ _datesearch_";
    443451   
    444     disp.setmacro("queryformcontent","query",current);
    445       }
    446     }
    447   }
    448 
    449 
     452      disp.setmacro("queryformcontent","query",current);
     453    }
     454      }
     455    }
     456  }
    450457
    451458  if (arg_p == "home") {
     
    454461    if (collector_disabled) disp.setmacro ("textgocollector", "home", "");
    455462  }
    456 
    457 
    458  
    459463 
    460464  else if (arg_p == "preferences") {
     
    462466    // _collectionoption_
    463467
    464     if (args["ccs"] == "1" && collectproto != NULL && (cinfo->ccsCols.size() > 1)) {
     468    if ((args["ccs"] == "1") && (cinfo->ccsCols.size() > 1)) {
    465469      text_t collectionoption = "_textcollectionoption_";
    466470      text_tarray::const_iterator col_here = cinfo->ccsCols.begin();
     
    675679    set_documentation_macro (disp);
    676680
     681  } else if (arg_p == "bsummary" && !arg_c.empty()) {
     682
     683    set_macro_to_file_contents (disp, "importlog", "bsummary",
     684                filename_cat(gsdlhome, "collect", arg_c, "etc", "import.log"));
     685    set_macro_to_file_contents (disp, "faillog", "bsummary",
     686                filename_cat(gsdlhome, "collect", arg_c, "etc", "fail.log"));
    677687  }
    678688}
  • trunk/gsdl/src/recpt/pageaction.h

    r2767 r2785  
    7575  void set_documentation_macro (displayclass &disp);
    7676
     77  void set_macro_to_file_contents (displayclass &disp, const text_t &macroname,
     78                   const text_t &packagename, const text_t &filename);
     79
    7780  bool status_disabled;
    7881  bool collector_disabled;
Note: See TracChangeset for help on using the changeset viewer.