Ignore:
Timestamp:
1999-11-02T10:54:27+13:00 (25 years ago)
Author:
sjboddie
Message:

changes for cross-collection searching - changes to arguments
of many functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/documentaction.cpp

    r738 r758  
    2828/*
    2929   $Log$
     30   Revision 1.30  1999/11/01 21:54:27  sjboddie
     31   changes for cross-collection searching - changes to arguments
     32   of many functions
     33
    3034   Revision 1.29  1999/10/24 07:23:40  sjboddie
    3135   added FullTOC option
     
    288292}
    289293
    290 void documentaction::get_cgihead_info (cgiargsclass &args, response_t &response,
    291                        text_t &response_data, ostream &logout) {
    292 
    293   if ((!args["d"].empty()) && (args["il"] == "w"))
    294     {
    295       text_t &oid = args["d"];
    296       text_t &collection = args["c"];
    297 
    298       recptprotolistclass* protocols = recpt->get_recptprotolist_ptr();
    299       recptproto* collectproto = protocols->getrecptproto (collection, logout);
    300 
     294void documentaction::get_cgihead_info (cgiargsclass &args, recptprotolistclass *protos,
     295                       response_t &response,text_t &response_data,
     296                       ostream &logout) {
     297
     298  if ((args["il"] == "w") && (!args["d"].empty())) {
     299
     300    recptproto* collectproto = protos->getrecptproto (args["c"], logout);
     301    if (collectproto != NULL) {
     302     
    301303      text_tset metadata;
    302304      FilterResponse_t filt_response;
     305      text_t top;
    303306
    304307      metadata.insert ("URL");
    305    
    306       // get metadata for this document and it's parents
    307       if (get_info (oid, collection, metadata, true, collectproto, filt_response, logout))
    308     {
    309       text_t url = *(filt_response.docInfo[0].metadata[0].values.begin());
    310 
    311       response = location;
    312       response_data = url;
    313     }
    314       else
    315     {
    316       // error, no URL
    317       logout << "Error: documentaction::get_cgihead_info failed on get_info" << endl;
    318     }
    319     }
    320   else
    321     {
    322       response = content;
    323       response_data = "text/html";
    324     }
     308     
     309      // get metadata for parent document
     310      get_top (args["d"], top);
     311      if (get_info (top, args["c"], metadata, false, collectproto, filt_response, logout)) {
     312    text_t url = filt_response.docInfo[0].metadata[0].values[0];
     313   
     314    response = location;
     315    response_data = url;
     316    return;
     317      } else {
     318    // error, no URL
     319    logout << "Error: documentaction::get_cgihead_info failed on get_info" << endl;
     320      }
     321    }
     322  }
     323  response = content;
     324  response_data = "text/html";
    325325}
    326326
     
    420420// define all the macros which might be used by other actions
    421421// to produce pages.
    422 void documentaction::define_external_macros (const ColInfoResponse_t &/*collectinfo*/,
    423                          displayclass &disp, cgiargsclass &args,
    424                          recptproto *collectproto, ostream &logout) {
     422void documentaction::define_external_macros (displayclass &disp, cgiargsclass &args,
     423                         recptprotolistclass *protos, ostream &logout) {
    425424 
    426425  // define_external_macros sets the following macros:
     
    443442 
    444443
    445   // can't do anything if collectproto is null (i.e. no collection was specified)
     444  // must have a valid collection server to continue
     445  text_t &collection = args["c"];
     446  if (collection.empty()) return;
     447  recptproto *collectproto = protos->getrecptproto (collection, logout);
    446448  if (collectproto == NULL) return;
    447 
     449 
    448450  outconvertclass text_t2ascii;
    449451  comerror_t err;
     
    451453  FilterResponse_t response;
    452454  text_tset metadata;
    453   text_t &collection = args["c"];
    454455
    455456  // don't want navigation bar if page is 'detached'
     
    557558// by this action. we also load up the formatinfo structure
    558559// here (it's used in do_action as well as here)
    559 void documentaction::define_internal_macros (const ColInfoResponse_t &collectinfo,
    560                          displayclass &disp, cgiargsclass &args,
    561                          recptproto *collectproto, ostream &logout) {
     560void documentaction::define_internal_macros (displayclass &disp, cgiargsclass &args,
     561                         recptprotolistclass *protos, ostream &logout) {
    562562 
    563563  // define_internal_macros sets the following macros:
     
    579579  //                        to the archivedir metadata element
    580580
    581   // can't do anything if collectproto is null (i.e. no collection was specified)
     581
     582  // must have a valid collection server to continue
     583  text_t &collection = args["c"];
     584  if (collection.empty()) return;
     585  recptproto *collectproto = protos->getrecptproto (collection, logout);
    582586  if (collectproto == NULL) return;
    583  
     587
    584588  text_tset metadata;
    585589  FilterResponse_t response;
    586590  text_t &arg_d = args["d"];
    587591  text_t &arg_cl = args["cl"];
    588   text_t &collection = args["c"];
    589592  int gt = args.getintarg("gt");
    590   load_formatinfo (collectinfo.format, gt);
     593
     594  // get info on current collection and load up formatinfo
     595  ColInfoResponse_t cinfo;
     596  comerror_t err;
     597  collectproto->get_collectinfo (collection, cinfo, err, logout);
     598  load_formatinfo (cinfo.format, gt);
    591599
    592600  if (!formatinfo.DocumentArrowsBottom)
     
    677685
    678686
    679 bool documentaction::do_action (cgiargsclass &args, const ColInfoResponse_t &/*collectinfo*/,
    680                 recptproto *collectproto, displayclass &disp,
     687bool documentaction::do_action (cgiargsclass &args, recptprotolistclass *protos,
     688                browsermapclass *browsers, displayclass &disp,
    681689                outconvertclass &outconvert, ostream &textout,
    682690                ostream &logout) {
    683691
     692
     693  // must have a valid collection server
     694  recptproto *collectproto = protos->getrecptproto (args["c"], logout);
    684695  if (collectproto == NULL) {
    685696    logout << "documentaction::do_action called with NULL collectproto\n";
     
    688699        << "_document:footer_\n";
    689700  } else { 
    690 
     701   
    691702    text_t OID = args["d"];
    692703    if (OID.empty()) OID = args["cl"];
     
    700711   
    701712    // output the table of contents
    702     output_toc (args, recpt->get_browsermap_ptr(), formatinfo,
    703         collectproto, disp, outconvert, textout, logout);
     713    output_toc (args, browsers, formatinfo, collectproto,
     714        disp, outconvert, textout, logout);
    704715
    705716    // output the document text
     
    768779  if (!args["q"].empty() && args.getintarg("hl")) {
    769780    FilterRequest_t request;
     781    comerror_t err;
    770782    request.filterResultOptions = FRmatchTerms;
    771     if (do_query (request, args, collectproto, queryresponse, logout))
     783    text_t formattedstring = args["q"];
     784    format_querystring (formattedstring, args.getintarg("b"));
     785    set_queryfilter_options (request, formattedstring, args);
     786    collectproto->filter (args["c"], request, queryresponse, err, logout);
     787    if (err != noError) {
     788      outconvertclass text_t2ascii;
     789      logout << text_t2ascii
     790         << "documentaction::output_document: call to QueryFilter failed "
     791         << "for " << args["c"] << " collection (" << get_comerror_string (err) << ")\n";
     792      highlight = false;
     793    } else {
    772794      highlight = true;
     795    }
    773796  }
    774797
Note: See TracChangeset for help on using the changeset viewer.