Ignore:
Timestamp:
2001-10-09T17:21:29+13:00 (23 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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.