Changeset 2785
- Timestamp:
- 2001-10-09T17:21:29+13:00 (23 years ago)
- Location:
- trunk/gsdl
- Files:
-
- 1 added
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/bin/script/build
r2774 r2785 132 132 &main(); 133 133 134 close OUT if $use_out; 134 if ($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 } 135 148 136 149 sub print_usage { … … 168 181 print STDOUT " -out Filename or handle to print output status to.\n"; 169 182 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"; 170 185 print STDOUT " -make_writable If set build will make the collection and any\n"; 171 186 print STDOUT " temporary files it created globally writable after\n"; … … 373 388 $import_cmd .= " -removeold" unless $append; 374 389 $import_cmd .= " -collectdir \"$collectdir\"" if $collectdir =~ /\w/; 390 $import_cmd .= " -statsfile \"$statsfile\"" if $statsfile =~ /\w/; 375 391 $import_cmd .= " $maxdocs $collection"; 392 393 print STDERR "\n**import_cmd: $import_cmd\n"; 394 376 395 system ($import_cmd); 377 396 # if using output directory append the import output to it … … 558 577 'email_events/.*/', \$email_events, 559 578 'mail_server/.*/', \$mail_server, 579 'statsfile/.*/STDERR', \$statsfile, 560 580 'event_header/.*/', \$event_header)) { 561 581 -
trunk/gsdl/bin/script/buildcol.pl
r2524 r2785 76 76 print STDOUT " -no_strip_html Do not strip the html tags from the indexed text\n"; 77 77 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"; 78 82 print STDOUT " [Type \"perl -S buildcol.pl | more\" if this help text scrolled off your screen]"; 79 83 print STDOUT "\n" unless $ENV{'GSDLOS'} =~ /^windows$/i; … … 86 90 $debug, $mode, $indexname, $keepold, $allclassifications, 87 91 $create_images, $collectdir, $out, $buildtype, $textindex, 88 $no_strip_html, $no_text );92 $no_strip_html, $no_text, $faillog); 89 93 90 94 # note that no defaults are passed for most options as they're set … … 106 110 'out/.*/STDERR', \$out, 107 111 'no_strip_html', \$no_strip_html, 108 'buildtype/^(mg|mgpp)$/', \$buildtype)) { 112 'buildtype/^(mg|mgpp)$/', \$buildtype, 113 'faillog/.*/', \$faillog)) { 109 114 &print_usage(); 110 115 die "\n"; … … 125 130 die "\n"; 126 131 } 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); 127 142 128 143 # read the configuration file … … 268 283 "\$realarchivedir, \$realbuilddir, \$verbosity, " . 269 284 "\$maxdocs, \$debug, \$keepold, \$allclassifications, " . 270 "\$out, \$no_text )");285 "\$out, \$no_text, \$faillog)"); 271 286 die "$@" if $@; 272 287 … … 301 316 302 317 close OUT if $close_out; 318 close FAILLOG; 303 319 } 304 320 -
trunk/gsdl/bin/script/classinfo.pl
r1970 r2785 35 35 } 36 36 37 use strict;38 37 use classify; 39 38 use util; -
trunk/gsdl/bin/script/import.pl
r2766 r2785 81 81 &util::filename_cat ($ENV{'GSDLHOME'}, "collect") . ")\n"; 82 82 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"; 85 90 print STDOUT " [Type \"perl -S import.pl | more\" if this help text scrolled off your screen]"; 86 91 print STDOUT "\n" unless $ENV{'GSDLOS'} =~ /^windows$/i; … … 93 98 $removeold, $gzip, $groupsize, $OIDtype, $debug, 94 99 $maxdocs, $collection, $configfilename, $collectcfg, 95 $pluginfo, $sortmeta, $archive_info_filename, 96 $archive_info, $processor, $out, $faillog name, $collectdir);100 $pluginfo, $sortmeta, $archive_info_filename, $statsfile, 101 $archive_info, $processor, $out, $faillog, $collectdir); 97 102 98 103 # note that no defaults are passed for most options as they're set … … 112 117 'collectdir/.*/', \$collectdir, 113 118 'out/.*/STDERR', \$out, 114 'faillog/.*/', \$faillogname)) { 119 'statsfile/.*/STDERR', \$statsfile, 120 'faillog/.*/', \$faillog)) { 115 121 &print_usage(); 116 122 die "\n"; … … 133 139 die "\n"; 134 140 } 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); 159 148 160 149 # check sortmeta … … 256 245 257 246 # load all the plugins 258 $pluginfo = &plugin::load_plugins ($plugins, $verbosity, $out, $faillog name);247 $pluginfo = &plugin::load_plugins ($plugins, $verbosity, $out, $faillog); 259 248 if (scalar(@$pluginfo) == 0) { 260 249 print $out "No plugins were loaded.\n"; … … 290 279 291 280 &plugin::end($pluginfo, $processor); 292 281 293 282 # write out the archive information file 294 283 if (!$debug) { … … 296 285 $archive_info->save_info($archive_info_filename); 297 286 } 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 298 311 close OUT if $close_out; 312 close FAILLOG; 299 313 } 314 -
trunk/gsdl/bin/script/mirror.pl
r2472 r2785 48 48 } 49 49 50 use strict;51 50 use arcinfo; 52 51 use colcfg; -
trunk/gsdl/bin/script/nightly.pl
r1970 r2785 41 41 } 42 42 43 use strict;44 43 use arcinfo; 45 44 use colcfg; -
trunk/gsdl/bin/script/pluginfo.pl
r1970 r2785 36 36 } 37 37 38 use strict;39 38 use plugin; 40 39 use util; -
trunk/gsdl/bin/script/update.pl
r1970 r2785 46 46 } 47 47 48 use strict;49 48 use arcinfo; 50 49 use colcfg; -
trunk/gsdl/etc/main.cfg
r2731 r2785 74 74 spanish.dm dutch.dm port.dm russian.dm russian2.dm \ 75 75 italian.dm italian2.dm home.dm collect.dm docs.dm \ 76 hebrew.dm 77 76 hebrew.dm bsummary.dm 78 77 79 78 # Define the interface languages and encodings supported by this receptionist -
trunk/gsdl/macros/collect.dm
r2777 r2785 715 715 <p>_textbildsuc_ 716 716 717 <p>_textviewbildsummary_ 718 717 719 <p><center> 718 720 _collectorbar_ -
trunk/gsdl/macros/english.dm
r2765 r2785 62 62 _collectorextra_ { 63 63 <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. 64 65 } 65 66 -
trunk/gsdl/macros/english2.dm
r2784 r2785 470 470 _textseconds_ {seconds} 471 471 _textbildsuc_ {Collection built successfully.} 472 473 _textviewbildsummary_ { 474 You may <a href="_httppagex_(bsummary)&c=_cgiargbc1dirname_" target=_top>view the build 475 summary</a> of this collection for further details. 476 } 472 477 473 478 _textfailmsg11_ { … … 917 922 _textmus_ {main.cfg updated successfully} 918 923 924 925 ###################################################################### 926 # 'bsummary' pages 927 package 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 26 26 ########################################################################### 27 27 28 use strict;29 28 use diagnostics; 30 29 -
trunk/gsdl/perllib/mgbuilder.pm
r2772 r2785 62 62 my ($class, $collection, $source_dir, $build_dir, $verbosity, 63 63 $maxdocs, $debug, $keepold, $allclassifications, 64 $outhandle, $no_text ) = @_;64 $outhandle, $no_text, $failhandle) = @_; 65 65 66 66 $outhandle = STDERR unless defined $outhandle; 67 67 $no_text = 0 unless defined $no_text; 68 $failhandle = STDERR unless defined $failhandle; 68 69 69 70 # create an mgbuilder object … … 78 79 'outhandle'=>$outhandle, 79 80 'no_text'=>$no_text, 81 'failhandle'=>$failhandle, 80 82 'notbuilt'=>[] # indexes not built 81 83 }, $class; … … 134 136 135 137 # load all the plugins 136 $self->{'pluginfo'} = &plugin::load_plugins ($plugins, $verbosity, $outhandle );138 $self->{'pluginfo'} = &plugin::load_plugins ($plugins, $verbosity, $outhandle, $failhandle); 137 139 if (scalar(@{$self->{'pluginfo'}}) == 0) { 138 140 print $outhandle "No plugins were loaded.\n"; -
trunk/gsdl/perllib/plugin.pm
r2755 r2785 28 28 require util; 29 29 30 my $stats = {'num_processed' => 0, 31 'num_blocked' => 0, 32 'num_not_processed' => 0, 33 'num_archives' => 0 34 }; 35 30 36 sub load_plugins { 31 37 my ($plugin_list) = shift @_; 32 ($verbosity, $outhandle, $fail logname) = @_; # globals38 ($verbosity, $outhandle, $failhandle) = @_; # globals 33 39 my @plugin_objects = (); 34 40 35 41 $verbosity = 2 unless defined $verbosity; 36 42 $outhandle = STDERR unless defined $outhandle; 43 $failhandle = STDERR unless defined $failhandle; 37 44 38 45 foreach $pluginoptions (@$plugin_list) { … … 58 65 59 66 # initialize plugin 60 $plugobj->init($verbosity, $outhandle, $fail logname);67 $plugobj->init($verbosity, $outhandle, $failhandle); 61 68 62 69 # add this object to the list … … 94 101 return $rv if defined $rv; 95 102 } 103 104 if ($verbosity >= 2) { 105 print $outhandle "WARNING - no plugin could process $file\n"; 106 } 96 107 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 - 118 sub write_stats { 119 my ($pluginfo, $statshandle) = @_; 120 121 foreach $plugobj (@$pluginfo) { 122 $plugobj->compile_stats($stats); 100 123 } 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 102 151 } 103 152 -
trunk/gsdl/perllib/plugins/BasPlug.pm
r2755 r2785 142 142 143 143 $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; 144 149 145 150 # general options available to all plugins … … 175 180 sub init { 176 181 my $self = shift (@_); 177 my ($verbosity, $outhandle, $fail logname) = @_;182 my ($verbosity, $outhandle, $failhandle) = @_; 178 183 179 184 # verbosity is passed through from the processor 180 185 $self->{'verbosity'} = $verbosity; 181 186 182 # as is the outhandle ...187 # as are the outhandle and failhandle 183 188 $self->{'outhandle'} = $outhandle if defined $outhandle; 184 $self->{'fail logname'} = $faillogname;189 $self->{'failhandle'} = $failhandle; 185 190 186 191 # set process_exp and block_exp to defaults unless they were … … 258 263 259 264 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 } 261 269 if ($filename !~ /$self->{'process_exp'}/ || !-f $filename) { 262 270 return undef; … … 298 306 if (!length ($text)) { 299 307 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 300 313 return 0; 301 314 } … … 316 329 # process the document 317 330 $processor->process($doc_obj); 331 332 $self->{'num_processed'} ++; 318 333 319 334 return 1; # processed the file … … 671 686 } 672 687 688 sub 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 673 698 1; -
trunk/gsdl/perllib/plugins/ConvertToPlug.pm
r2755 r2785 48 48 # @ISA = ('BasPlug'); #, 'HTMLPlug', 'TEXTPlug'); 49 49 } 50 51 # use strict; # this breaks 'print $outhandle ' error msgs.52 50 53 51 sub print_usage { … … 146 144 my $outhandle = $self->{'outhandle'}; 147 145 my $convert_to = $self->{'convert_to'}; 146 my $failhandle = $self->{'failhandle'}; 148 147 149 148 # softlink to collection tmp dir … … 184 183 if ($output_type eq "fail") { 185 184 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") { 188 188 open(ERRLOG, "$errlog"); 189 print SAVELOG "$tailname$suffix (converting to $convert_to) failed:\n";190 189 while (<ERRLOG>) { 191 print SAVELOG"$_";190 print $outhandle "$_"; 192 191 } 192 print $outhandle "\n"; 193 193 close ERRLOG; 194 print SAVELOG "\n";195 close SAVELOG;196 194 } 197 195 &util::rm("$errlog") if (-e "$errlog"); … … 236 234 237 235 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 } 239 240 if ($filename !~ /$self->{'process_exp'}/ || !-f $filename) { 240 241 return undef; … … 299 300 $self->cleanup_tmp_area(); 300 301 302 $self->{'num_processed'} ++; 301 303 302 304 return 1; -
trunk/gsdl/perllib/plugins/PDFPlug.pm
r2661 r2785 63 63 64 64 my $outhandle = $self->{'outhandle'}; 65 print $outhandle "PDFPlug: passing $_[3] on to $self->{'convert_to'}Plug\n"65 print $outhandle "PDFPlug: passing $_[3] on to $self->{'convert_to'}Plug\n" 66 66 if $self->{'verbosity'} > 1; 67 67 … … 69 69 } 70 70 71 72 71 1; 73 74 75 76 -
trunk/gsdl/perllib/plugins/PSPlug.pm
r2451 r2785 33 33 } 34 34 35 use strict;36 37 38 35 sub new { 39 36 my $class = shift (@_); … … 65 62 print STDERR "using the PRESCRIPT package, which is available for download at\n http://www.nzdl.org/html/software.html\n\n"; 66 63 } 67 68 64 69 65 sub get_default_block_exp { … … 147 143 } 148 144 149 150 145 # do plugin specific processing of doc_obj for HTML type 151 146 sub process { … … 153 148 my ($trash, $trash2, $path, $file, $trash3, $doc) = @_; 154 149 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" 156 152 if $self->{'verbosity'} > 1; 157 153 -
trunk/gsdl/perllib/plugins/RTFPlug.pm
r2564 r2785 33 33 } 34 34 35 use strict;36 37 35 sub get_default_process_exp { 38 36 my $self = shift (@_); … … 42 40 sub process { 43 41 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" 45 45 if $self->{'verbosity'} > 1; 46 46 47 return ConvertToPlug::process_type($self,"rtf",@_); 47 48 } -
trunk/gsdl/perllib/plugins/WordPlug.pm
r2515 r2785 45 45 46 46 my $outhandle = $self->{'outhandle'}; 47 print $outhandle "WordPlug: passing $_[3] on to $self->{'convert_to'}Plug\n"47 print $outhandle "WordPlug: passing $_[3] on to $self->{'convert_to'}Plug\n" 48 48 if $self->{'verbosity'} > 1; 49 49 … … 51 51 } 52 52 53 54 53 1; 55 -
trunk/gsdl/perllib/plugins/ZIPPlug.pm
r2082 r2785 119 119 my $numdocs = &plugin::read ($pluginfo, "", $tmpdir, $metadata, $processor, $maxdocs); 120 120 &util::rm_r ($tmpdir); 121 122 $self->{'num_archives'} ++; 123 121 124 return $numdocs; 122 125 -
trunk/gsdl/src/recpt/collectoraction.cpp
r2774 r2785 1030 1030 // _faillog_ - set to last 6 lines of .bld file if build failed 1031 1031 // _gsdlhome_ - the gsdlhome path (dm_safe) 1032 1033 1032 // _sourcelist_ -- "input source" text boxes 1034 1033 // _badsources_ -- will be set to "1" if we've come from the … … 1154 1153 collectorbar += get_button (collector_page, "grey", "view", false); 1155 1154 } 1155 1156 collectorbar += "</tr></table>\n"; 1157 disp.setmacro ("collectorbar", "collector", collectorbar); 1156 1158 1157 1159 if (collector_page == "bildfail") { … … 1175 1177 disp.setmacro ("faillog", "collector", dm_safe(faillog)); 1176 1178 } 1177 1178 collectorbar += "</tr></table>\n";1179 disp.setmacro ("collectorbar", "collector", collectorbar);1180 1179 1181 1180 if (collector_page == "srce" || collector_page == "existing") … … 1659 1658 } 1660 1659 1660 text_t collectdir = get_collectdir (args); 1661 1661 1662 // set up build options 1662 1663 text_t options = "-make_writable -remove_import -out \""; 1663 1664 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") + "\""; 1665 1667 1666 1668 if (args["bc1esrce"] == 1) { -
trunk/gsdl/src/recpt/pageaction.cpp
r2782 r2785 28 28 #include "receptionist.h" 29 29 #include "fileutil.h" 30 #include "gsdltools.h" 30 31 #include <time.h> 31 32 … … 327 328 } 328 329 330 void pageaction::set_macro_to_file_contents (displayclass &disp, const text_t ¯oname, 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 329 350 void pageaction::define_internal_macros (displayclass &disp, cgiargsclass &args, 330 351 recptprotolistclass *protos, ostream &logout) { … … 383 404 // if page is "docs" 384 405 // _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 385 411 386 412 … … 418 444 //setting _queryformcontent_ so that the query interface is consistent. 419 445 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_"; 443 451 444 disp.setmacro("queryformcontent","query",current); 445 } 446 } 447 } 448 449 452 disp.setmacro("queryformcontent","query",current); 453 } 454 } 455 } 456 } 450 457 451 458 if (arg_p == "home") { … … 454 461 if (collector_disabled) disp.setmacro ("textgocollector", "home", ""); 455 462 } 456 457 458 459 463 460 464 else if (arg_p == "preferences") { … … 462 466 // _collectionoption_ 463 467 464 if ( args["ccs"] == "1" && collectproto != NULL&& (cinfo->ccsCols.size() > 1)) {468 if ((args["ccs"] == "1") && (cinfo->ccsCols.size() > 1)) { 465 469 text_t collectionoption = "_textcollectionoption_"; 466 470 text_tarray::const_iterator col_here = cinfo->ccsCols.begin(); … … 675 679 set_documentation_macro (disp); 676 680 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")); 677 687 } 678 688 } -
trunk/gsdl/src/recpt/pageaction.h
r2767 r2785 75 75 void set_documentation_macro (displayclass &disp); 76 76 77 void set_macro_to_file_contents (displayclass &disp, const text_t ¯oname, 78 const text_t &packagename, const text_t &filename); 79 77 80 bool status_disabled; 78 81 bool collector_disabled;
Note:
See TracChangeset
for help on using the changeset viewer.