Changeset 284


Ignore:
Timestamp:
1999-06-24T17:12:25+12:00 (25 years ago)
Author:
sjboddie
Message:

lots of small changes

Location:
trunk/gsdl/src/recpt
Files:
8 edited

Legend:

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

    r282 r284  
    1212/*
    1313   $Log$
     14   Revision 1.9  1999/06/24 05:12:15  sjboddie
     15   lots of small changes
     16
    1417   Revision 1.8  1999/06/17 03:06:53  sjboddie
    1518   got detach button working properly - the close book icon is now disabled
     
    268271}
    269272
     273// ouput_list_toc generates and outputs a List type table of contents
     274// it should only be called for classifications (i.e. when the "d"
     275// argument isn't set) as it doesn't make sense to display document
     276// level stuff in this way (I think !!)
     277void output_list_toc (const text_t &classifytitle, cgiargsclass &args,
     278              recptproto *collectproto, displayclass &disp,
     279              outconvertclass &outconvert, ostream &textout,
     280              ostream &logout) {
     281
     282  text_tarray metadata;
     283  FilterResponse_t response;
     284  text_t &arg_cl = args["cl"];
     285  text_t doclink = "<a href=\"_httpdocument_&cl=" + arg_cl + "&d=";
     286
     287  if (classifytitle != "Title") metadata.push_back (classifytitle);
     288  metadata.push_back ("Title");
     289
     290  if (get_children (arg_cl, args["c"], metadata, collectproto, response, logout)) {
     291
     292    textout
     293      << "\n<!-- Table of Contents produced by browsetools::output_list_toc "
     294      << "-->\n\n<table cellpadding=0 cellspacing=2>\n";
     295
     296    ResultDocInfo_tarray::const_iterator sechere = response.docInfo.begin();
     297    ResultDocInfo_tarray::const_iterator secend = response.docInfo.end();
     298
     299    while (sechere != secend) {
     300
     301      const text_t &ctitle = (*sechere).metadata[0].values[0];
     302      const text_t &title = (*sechere).metadata[1].values[0];
     303
     304      if (!ctitle.empty()) {
     305      textout << outconvert << disp << "<tr><td valign=top>" << doclink << (*sechere).OID
     306          << "\">_document:iconclosedbook_</a></td><td>"
     307          << ctitle << "</td><td>";
     308      } else if (!title.empty()) {
     309      textout << outconvert << disp << "<tr><td valign=top>" << doclink << (*sechere).OID
     310          << "\">_document:iconclosedbook_</a></td><td>" << title << "</td><td>";
     311      }
     312
     313      textout << "</td></tr>\n";
     314      sechere ++;
     315    }
     316    textout << "</table>\n<!-- end of Table of Contents -->\n";
     317  }
     318}
     319
    270320// ouput_azlist_toc generates and outputs an AZList type table of contents
    271321// it should only be called for classifications (i.e. when the "d"
     
    289339
    290340    textout
    291       << "\n<!-- Table of Contents produced by browsetools::output_list_toc "
     341      << "\n<!-- Table of Contents produced by browsetools::output_azlist_toc "
    292342      << "-->\n\n<table cellpadding=0 cellspacing=2>\n";
    293343
     
    303353    if (!creator.empty()) {
    304354      textout << outconvert << disp << "<tr><td valign=top>" << doclink << (*sechere).OID
    305           << "\">_iconclosedbook_</a></td><td>"
     355          << "\">_document:iconclosedbook_</a></td><td>"
    306356          << creator << "</td><td>";
    307357
     
    312362    if (!title.empty()) {
    313363      textout << outconvert << disp << "<tr><td valign=top>" << doclink << (*sechere).OID
    314           << "\">_iconclosedbook_</a></td><td>" << title << "</td><td>";
     364          << "\">_document:iconclosedbook_</a></td><td>" << title << "</td><td>";
    315365
    316366      if (!creator.empty())
     
    437487
    438488    // set up icon
    439     icon = "_iconsmalltext_";
     489    icon = "_document:iconsmalltext_";
    440490    if (is_top((*thissection).OID))
    441       if (classifytype == "Document") icon = "_iconopenbook_";
     491      if (classifytype == "Document") icon = "_document:iconopenbook_";
    442492      else
    443     if (doctype == "classify") icon = "_iconopenbookshelf_";
    444     else icon = "_iconclosedbook_";
     493    if (doctype == "classify") icon = "_document:iconopenbookshelf_";
     494    else icon = "_document:iconclosedbook_";
    445495    else if (haschildren)
    446       if (classifytype == "Document") icon = "_iconopenfolder_";
    447       else icon = "_iconopenbookshelf_";
     496      if (classifytype == "Document") icon = "_document:iconopenfolder_";
     497      else icon = "_document:iconopenbookshelf_";
    448498   
    449499    // set up tabbing
     
    457507
    458508    for (int i = 0; i < tabcols; i++)
    459       icontabs += "_icontab_";
     509      icontabs += "_document:icontab_";
    460510   
    461511    // set up pointer
    462512    if (classifytype == "Document" && !gt) {
    463       if ((*thissection).OID == OID) pointer = "_iconpointer_";
    464       else pointer = "_icontab_";
     513      if ((*thissection).OID == OID) pointer = "_document:iconpointer_";
     514      else pointer = "_document:icontab_";
    465515      tabcols ++;
    466516    }
     
    550600     
    551601      // set up icon for this parent
    552       icon = "_iconopenfolder_";
    553       if (doctype == "classify") icon = "_iconopenbookshelf_";
    554       else if (is_top(*thisparent)) icon = "_iconopenbook_";
     602      icon = "_document:iconopenfolder_";
     603      if (doctype == "classify") icon = "_document:iconopenbookshelf_";
     604      else if (is_top(*thisparent)) icon = "_document:iconopenbook_";
    555605
    556606      for (int j = 0; j < tabcount; j++)
    557     icontabs += "_icontab_";
     607    icontabs += "_document:icontab_";
    558608
    559609      if (doctype != "classify") {
    560610    if (*thisparent == args["d"]) {
    561       icontabs += "_iconpointer_";
     611      icontabs += "_document:iconpointer_";
    562612      if (is_top (*thisparent))
    563613        tabcount ++;
     
    624674
    625675    // set up icon for this sibling
    626     icon = "_iconclosedfolder_";
    627     if (doctype == "classify") icon = "_iconclosedbookshelf_";
    628     else if (is_top((*thissibling).OID)) icon = "_iconclosedbook_";
     676    icon = "_document:iconclosedfolder_";
     677    if (doctype == "classify") icon = "_document:iconclosedbookshelf_";
     678    else if (is_top((*thissibling).OID)) icon = "_document:iconclosedbook_";
    629679   
    630680    // fit pointer into tabbing if current section
    631681    // note that we don't want pointers at classification levels anymore
    632682    // (unless the classification contains text)
    633     pointer = "_icontab_";
     683    pointer = "_document:icontab_";
    634684    if (doctype == "classify") {
    635685      if ((*thissibling).OID == args["cl"] && hastxt)
    636     pointer = "_iconpointer_";
    637     } else if ((*thissibling).OID == args["d"]) pointer = "_iconpointer_";
     686    pointer = "_document:iconpointer_";
     687    } else if ((*thissibling).OID == args["d"]) pointer = "_document:iconpointer_";
    638688   
    639689    text_t thesetabs;
    640690    for (int j = 0; j < (tabcount - 1); j++)
    641       thesetabs += "_icontab_";
     691      thesetabs += "_document:icontab_";
    642692   
    643693    tab = "<td valign=top";
     
    647697    if (!haschildren) {
    648698      // sibling is text document
    649       icon = "_iconsmalltext_";
     699      icon = "_document:iconsmalltext_";
    650700      text_t link;
    651701      if (doctype == "classify") link = "&cl=" + (*thissibling).OID;
  • trunk/gsdl/src/recpt/browsetools.h

    r257 r284  
    3838              outconvertclass &outconvert, ostream &textout,
    3939              ostream &logout);
     40void output_list_toc (const text_t &classifytitle, cgiargsclass &args,
     41              recptproto *collectproto, displayclass &disp,
     42              outconvertclass &outconvert, ostream &textout,
     43              ostream &logout);
    4044void output_azlist_toc (const text_t &classifytitle, cgiargsclass &args,
    4145            recptproto *collectproto, displayclass &disp,
  • trunk/gsdl/src/recpt/cgiwrapper.cpp

    r248 r284  
    1212/*
    1313   $Log$
     14   Revision 1.13  1999/06/24 05:12:18  sjboddie
     15   lots of small changes
     16
    1417   Revision 1.12  1999/04/30 01:59:40  sjboddie
    1518   lots of stuff - getting documentaction working (documentaction replaces
     
    352355
    353356  pageaction apageaction;
     357  apageaction.set_receptionist (&recpt);
    354358  recpt.add_action (&apageaction);
    355359
  • trunk/gsdl/src/recpt/documentaction.cpp

    r282 r284  
    1212/*
    1313   $Log$
     14   Revision 1.8  1999/06/24 05:12:20  sjboddie
     15   lots of small changes
     16
    1417   Revision 1.7  1999/06/17 03:06:58  sjboddie
    1518   got detach button working properly - the close book icon is now disabled
     
    148151}
    149152
    150 bool documentaction::check_cgiargs (cgiargsinfoclass &/*argsinfo*/, cgiargsclass &/*args*/,
    151                     ostream &/*logout*/) {
    152   // don't want to check anything yet.
     153bool documentaction::check_cgiargs (cgiargsinfoclass &argsinfo, cgiargsclass &args,
     154                    ostream &logout) {
     155
     156  // note that "gp" argument gets checked in define_external_macros()
     157
     158  // check gc argument
     159  int arg_gc = args.getintarg("gc");
     160  if (arg_gc != 0 && arg_gc != 1) {
     161    logout << "Warning: \"gc\" argument out of range (" << arg_gc << ")\n";
     162    cgiarginfo *gcinfo = argsinfo.getarginfo ("gc");
     163    if (gcinfo != NULL) args["gc"] = gcinfo->argdefault;
     164  }
     165
     166  // check gt argument (may be either 0, 1 or 2)
     167  int arg_gt = args.getintarg("gt");
     168  if (arg_gt != 0 && arg_gt != 1 && arg_gt != 2) {
     169    logout << "Warning: \"gt\" argument out of range (" << arg_gt << ")\n";
     170    cgiarginfo *gtinfo = argsinfo.getarginfo ("gt");
     171    if (gtinfo != NULL) args["gt"] = gtinfo->argdefault;
     172  }
     173
     174  // check hl argument
     175  int arg_hl = args.getintarg("hl");
     176  if (arg_hl != 0 && arg_hl != 1) {
     177    logout << "Warning: \"hl\" argument out of range (" << arg_hl << ")\n";
     178    cgiarginfo *hlinfo = argsinfo.getarginfo ("hl");
     179    if (hlinfo != NULL) args["hl"] = hlinfo->argdefault;
     180  }
     181
     182  // check x argument
     183  int arg_x = args.getintarg("x");
     184  if (arg_x != 0 && arg_x != 1) {
     185    logout << "Warning: \"x\" argument out of range (" << arg_x << ")\n";
     186    cgiarginfo *xinfo = argsinfo.getarginfo ("x");
     187    if (xinfo != NULL) args["x"] = xinfo->argdefault;
     188  }
     189
    153190  return true;
    154191}
     
    380417
    381418      text_t pagetitle;
    382       text_tarray::const_iterator this_title = response.docInfo[0].metadata[0].values.begin();
    383       text_tarray::const_iterator end_title = response.docInfo[0].metadata[0].values.end();
    384       while (this_title != end_title) {
    385     if ((this_title + 1) == end_title) pagetitle += *this_title;
    386     else pagetitle += *this_title + ": ";
    387     this_title ++;
     419      if (args.getintarg("gt") == 2)
     420    pagetitle = *(response.docInfo[0].metadata[0].values.begin());
     421      else {
     422    text_tarray::const_iterator this_title = response.docInfo[0].metadata[0].values.begin();
     423    text_tarray::const_iterator end_title = response.docInfo[0].metadata[0].values.end();
     424    while (this_title != end_title) {
     425      if ((this_title + 1) == end_title) pagetitle += *this_title;
     426      else pagetitle += *this_title + ": ";
     427      this_title ++;
     428    }
    388429      }
    389430      disp.setmacro ("pagetitle", "document", pagetitle);
     
    423464    text_t &classifytype = response.docInfo[0].metadata[1].values[0];
    424465
    425     disp.setmacro ("imagethispage", "document",
    426                "_icon" + title + "page_");
     466    disp.setmacro ("pagetitle", "document", "_text" + title + "page_");
     467
     468    disp.setmacro ("imagethispage", "document", "_icon" + title + "page_");
    427469
    428470    // now get the metadata for each child of top level
     
    495537    text_tarray metadata;
    496538    FilterResponse_t response;
    497     FilterResponse_t queryresponse;
    498     DocumentRequest_t docrequest;
    499     DocumentResponse_t docresponse;
    500539    text_t topparent, classifytype, classifytitle;
    501     comerror_t err;
    502     bool highlight = false;
    503540   
    504541    text_t &arg_d = args["d"];
    505542    text_t &arg_cl = args["cl"];
    506     text_t &collection = args["c"];
    507543   
    508544    text_t OID = arg_d;
     
    515551      textout << outconvert << disp << "Document contains no data_document:footer_\n";
    516552      return true;
    517     }
    518    
    519     // if we have a query string and highlighting is turned on we need
    520     // to redo the query to get the terms for highlighting
    521     if (!args["q"].empty() && args.getintarg("hl")) {
    522       FilterRequest_t request;
    523       text_t quotedstring; // don't use this here
    524       request.filterResultOptions = FRmatchTerms;
    525       if (do_query (request, args, collectproto, quotedstring, queryresponse, logout))
    526     highlight = true;
    527553    }
    528554   
     
    531557    metadata.push_back ("Title");
    532558    metadata.push_back ("classifytype");
    533     if (get_info (topparent, collection, metadata, false, collectproto, response, logout)) {
     559    if (get_info (topparent, args["c"], metadata, false, collectproto, response, logout)) {
    534560      classifytitle = response.docInfo[0].metadata[0].values[0];
    535561      classifytype = response.docInfo[0].metadata[1].values[0];
    536562    }
    537563   
     564    // output the table of contents
    538565    if (!arg_d.empty()) {
    539566     
     
    542569                  outconvert, textout, logout);
    543570      else
    544     // Book is the default for a document level toc - AZList and Datelist don't
    545     // make sense for document level
     571    // Book is the default for a document level toc - AZList, List and
     572    // Datelist don't make sense for document level
    546573    output_book_toc (classifytitle, args, collectproto, disp,
    547574             outconvert, textout, logout);
     
    554581    output_datelist_toc (classifytitle, args, collectproto, disp,
    555582                 outconvert, textout, logout);
     583      else if (classifytype == "List")
     584    output_list_toc (classifytitle, args, collectproto, disp,
     585             outconvert, textout, logout);
    556586      else
    557587    // AZList is the default for a classification level toc - Book doesn't make
     
    560590               outconvert, textout, logout);
    561591    }
    562    
    563     // get info on this document
    564     metadata.erase (metadata.begin(), metadata.end());
    565     metadata.push_back("Title");
    566     metadata.push_back("hastxt");
    567     metadata.push_back("haschildren");
    568    
    569     if (get_info (OID, collection, metadata, false, collectproto, response, logout)) {
    570       text_t &title = response.docInfo[0].metadata[0].values[0];
    571       int hastxt = response.docInfo[0].metadata[1].values[0].getint();
    572       int haschildren = response.docInfo[0].metadata[2].values[0].getint();
     592
     593    // output the document text
     594    output_document (OID, args, collectproto, disp, outconvert, textout, logout);
     595
     596    textout << outconvert << disp << "_document:footer_\n";
     597  }
     598  return true;
     599}
     600
     601
     602void documentaction::output_document (const text_t &OID, cgiargsclass &args,
     603                      recptproto *collectproto, displayclass &disp,
     604                      outconvertclass &outconvert, ostream &textout,
     605                      ostream &logout) {
     606  FilterResponse_t inforesponse;
     607  DocumentRequest_t docrequest;
     608  DocumentResponse_t docresponse;
     609  FilterResponse_t queryresponse;
     610  comerror_t err;
     611  text_tarray metadata;
     612  bool highlight = false;
     613  int arg_gt = args.getintarg("gt");
     614  text_t &collection = args["c"];
     615   
     616  // if we have a query string and highlighting is turned on we need
     617  // to redo the query to get the terms for highlighting
     618  if (!args["q"].empty() && args.getintarg("hl")) {
     619    FilterRequest_t request;
     620    request.filterResultOptions = FRmatchTerms;
     621    text_t quotedquery; // not used
     622    if (do_query (request, args, collectproto, quotedquery, queryresponse, logout))
     623      highlight = true;
     624  }
     625
     626  // get info on this document
     627  metadata.push_back("Title");
     628  metadata.push_back("hastxt");
     629  metadata.push_back("haschildren");
     630   
     631  if (get_info (OID, collection, metadata, false, collectproto, inforesponse, logout)) {
     632    text_t title = inforesponse.docInfo[0].metadata[0].values[0];
     633    int hastxt = inforesponse.docInfo[0].metadata[1].values[0].getint();
     634    int haschildren = inforesponse.docInfo[0].metadata[2].values[0].getint();
    573635     
    574       int gt = args.getintarg("gt");
    575       if (gt == 0) {
    576     if (hastxt == 1) {
    577       // get the text
     636    if (arg_gt == 0) {
     637      if (hastxt == 1) {
     638    // get the text
     639    docrequest.OID = OID;
     640    collectproto->get_document (collection, docrequest, docresponse, err, logout);
     641     
     642    textout << outconvert << disp << "<p>\n<h3>" << title << "</h3>";
     643      if (highlight)
     644        highlighttext(docresponse.doc, queryresponse.termInfo, disp,
     645              outconvert, textout, logout);
     646      else
     647        textout << outconvert << disp << docresponse.doc;
     648      }
     649    } else {
     650   
     651      // text is to be expanded
     652      text_t exOID = OID;
     653      if (!haschildren) exOID = get_parent (OID);
     654   
     655      // if we're not in a document (i.e. we're in a top level classification)
     656      // we need to pass the "classify" string to get_contents so that it
     657      // doesn't recurse all the way through each document in the classification
     658      text_t classifytype;
     659      if (args["d"].empty()) classifytype = "classify";
     660
     661      int i; // not used
     662      get_contents (exOID, classifytype, i, collection, collectproto, inforesponse, logout);
     663   
     664      ResultDocInfo_tarray::const_iterator sechere = inforesponse.docInfo.begin();
     665      ResultDocInfo_tarray::const_iterator secend = inforesponse.docInfo.end();
     666   
     667      if (arg_gt == 1) {
     668    // check if there are more than 10 sections containing text to be expanded -
     669    // if there are output warning message - this isn't a great way to do this
     670    // since the sections may be very large or very small - one day I'll fix it
     671    // -- Stefan.
     672    int seccount = 0;
     673    while (sechere != secend) {
     674      if ((*sechere).metadata[3].values[0] == "1") seccount ++;
     675      if (seccount > 10) break;
     676      sechere ++;
     677    }
     678    if (seccount > 10) {
     679      // more than 10 sections so output warning message and text
     680      // for current section only
     681      textout << outconvert << disp << "_document:textltwarning_";
    578682      docrequest.OID = OID;
    579683      collectproto->get_document (collection, docrequest, docresponse, err, logout);
     
    586690        textout << outconvert << disp << docresponse.doc;
    587691    }
    588       } else {
    589    
    590     // text is to be expanded
    591     int tmp; // this doesn't get used here
    592     if (!haschildren)
    593       OID = get_parent (OID);
    594    
    595     get_contents (OID, classifytype, tmp, collection, collectproto, response, logout);
    596    
    597     ResultDocInfo_tarray::const_iterator sechere = response.docInfo.begin();
    598     ResultDocInfo_tarray::const_iterator secend = response.docInfo.end();
    599    
    600     if (gt == 1) {
    601       // check if there are more than 10 sections containing text to be expanded -
    602       // if there are output warning message - this isn't a great way to do this
    603       // since the sections may be very large or very small - one day I'll fix it
    604       // -- Stefan.
    605       int seccount = 0;
    606       while (sechere != secend) {
    607         if ((*sechere).metadata[3].values[0] == "1") seccount ++;
    608         if (seccount > 10) break;
    609         sechere ++;
     692    else arg_gt = 2;
     693      }
     694
     695      if (arg_gt == 2) {
     696    // get the text for each section
     697    sechere = inforesponse.docInfo.begin();
     698    int count = 0;
     699    while (sechere != secend) {
     700      textout << outconvert << disp << "\n<p><a name=" << count << "><h3>"
     701          << (*sechere).metadata[0].values[0] << "</h3></a>\n";
     702      if ((*sechere).metadata[3].values[0] == "1") {
     703        docrequest.OID = (*sechere).OID;
     704        collectproto->get_document (collection, docrequest, docresponse, err, logout);
     705        if (highlight)
     706          highlighttext(docresponse.doc, queryresponse.termInfo, disp,
     707                outconvert, textout, logout);
     708        else
     709          textout << outconvert << disp << docresponse.doc;
    610710      }
    611       if (seccount > 10) textout << outconvert << disp << "_document:textltwarning_";
    612       else gt = 2;
     711      count ++;
     712      sechere ++;
    613713    }
    614 
    615     if (gt == 2) {
    616     // get the text for each section
    617       sechere = response.docInfo.begin();
    618       int count = 0;
    619       while (sechere != secend) {
    620         textout << outconvert << disp << "\n<p><a name=" << count << "><h3>"
    621             << (*sechere).metadata[0].values[0] << "</h3></a>\n";
    622         if ((*sechere).metadata[3].values[0] == "1") {
    623           docrequest.OID = (*sechere).OID;
    624           collectproto->get_document (collection, docrequest, docresponse, err, logout);
    625           if (highlight)
    626         highlighttext(docresponse.doc, queryresponse.termInfo, disp,
    627                   outconvert, textout, logout);
    628           else
    629         textout << outconvert << disp << docresponse.doc;
    630         }
    631         count ++;
    632         sechere ++;
    633       }
    634     }
    635       }
    636     }
    637     textout << outconvert << disp << "_document:footer_\n";
    638   }
    639   return true;
    640 }
    641 
     714      }
     715    }
     716  }
     717}
    642718
    643719// highlighttext highlights query terms in text string and outputs the resulting text string
  • trunk/gsdl/src/recpt/documentaction.h

    r267 r284  
    2020
    2121protected:
     22  void output_document (const text_t &OID, cgiargsclass &args,
     23            recptproto *collectproto, displayclass &disp,
     24            outconvertclass &outconvert, ostream &textout,
     25            ostream &logout);
     26
    2227  void highlighttext(text_t &text, TermInfo_tarray &terms, displayclass &disp,
    2328             outconvertclass &outconvert, ostream &textout, ostream &logout);
  • trunk/gsdl/src/recpt/pageaction.cpp

    r266 r284  
    1212/*
    1313   $Log$
     14   Revision 1.7  1999/06/24 05:12:24  sjboddie
     15   lots of small changes
     16
    1417   Revision 1.6  1999/06/10 00:39:16  sjboddie
    1518   navigation bar is no longer written out for every page (it should
     
    4245#include "pageaction.h"
    4346#include "receptionist.h"
    44 
     47#include <time.h>
    4548
    4649pageaction::pageaction () {
     50
     51  recpt = NULL;
     52
    4753  // this action uses cgi variables "a" and "p"
    4854  cgiarginfo arg_ainfo;
     
    7985}
    8086
     87
     88void pageaction::define_internal_macros (displayclass &disp, cgiargsclass &args,
     89                     recptproto */*collectproto*/, ostream &logout) {
     90
     91  // define_internal_macros sets the following macros:
     92
     93  // _homeextra_   this is the list of available collections and collection info
     94  //               to be displayed on the home page
     95
     96  if (args["p"] == "home") {
     97    // make sure we know about a receptionist
     98    if (recpt == NULL) {
     99      logout << "The page action does not contain information\n"
     100         << "about any receptionists. The method set_receptionist\n"
     101         << "was probably not called from the module which instantiated\n"
     102         << "this page action.\n";
     103      return;
     104    }
     105
     106    unsigned long current_time = time(NULL);
     107    text_t homeextra;
     108
     109    recptprotolistclass *rprotolist = recpt->get_recptprotolist_ptr ();
     110    if (rprotolist == NULL) return;
     111
     112    recptprotolistclass::iterator rprotolist_here = rprotolist->begin();
     113    recptprotolistclass::iterator rprotolist_end = rprotolist->end();
     114    while (rprotolist_here != rprotolist_end) {
     115      if ((*rprotolist_here).p != NULL) {
     116    text_tarray collist;
     117    comerror_t err;
     118    (*rprotolist_here).p->get_collection_list (collist, err, logout);
     119    if (err == noError) {
     120      text_tarray::iterator collist_here = collist.begin();
     121      text_tarray::iterator collist_end = collist.end();
     122
     123      homeextra += "<dl>\n";
     124
     125      while (collist_here != collist_end) {
     126        ColInfoResponse_t collectinfo;
     127        (*rprotolist_here).p->get_collectinfo (*collist_here, collectinfo, err, logout);
     128        if (err == noError) {
     129
     130          homeextra += "<dt><a href=\"_httppagex_(about)&c=" + *collist_here + "\">"
     131        + *collist_here + "</a></dt>\n";
     132          homeextra += "<dd>";
     133          if (collectinfo.numDocs != 0) homeextra += text_t(collectinfo.numDocs) + "_documents_";
     134          if (collectinfo.numWords != 0) homeextra += text_t(collectinfo.numWords) + "_words_";
     135          unsigned long last_update = (current_time - collectinfo.buildDate) / 86400;
     136          homeextra += "_lastupdate_ " + text_t(last_update) + " _ago_</dd>\n";
     137        }
     138        collist_here ++;
     139      }
     140      homeextra += "</dl>\n";
     141      disp.setmacro ("homeextra", "home", homeextra);
     142    }
     143      }
     144      rprotolist_here ++;
     145    }
     146  }
     147}
     148
    81149bool pageaction::do_action (cgiargsclass &args, recptproto */*collectproto*/,
    82150                displayclass &disp, outconvertclass &outconvert,
  • trunk/gsdl/src/recpt/pageaction.h

    r261 r284  
    1717#include "gsdlconf.h"
    1818#include "action.h"
     19#include "receptionist.h"
    1920
    2021
    2122class pageaction : public action {
    2223 
     24protected:
     25  receptionist *recpt;
     26
    2327public:
    2428  pageaction ();
     
    2731  text_t get_action_name () {return "p";}
    2832
     33  void set_receptionist (receptionist *therecpt) {recpt=therecpt;}
    2934  bool check_cgiargs (cgiargsinfoclass &argsinfo, cgiargsclass &args,
    3035              ostream &logout);
     
    3237  void get_cgihead_info (cgiargsclass &args, response_t &response,
    3338             text_t &response_data, ostream &logout);
     39
     40  void define_internal_macros (displayclass &disp, cgiargsclass &args,
     41                   recptproto *collectproto, ostream &logout);
    3442
    3543  bool do_action (cgiargsclass &args, recptproto *collectproto,
  • trunk/gsdl/src/recpt/queryaction.cpp

    r279 r284  
    1212/*
    1313   $Log$
     14   Revision 1.6  1999/06/24 05:12:25  sjboddie
     15   lots of small changes
     16
    1417   Revision 1.5  1999/06/16 04:03:48  sjboddie
    1518   Now sets "cl" arg to "search" when going to a document from a search
     
    9093  argsinfo.addarginfo (NULL, arg_ainfo);
    9194
    92   // "t"
     95  // "t" - 1 = ranked 0 = boolean
    9396  arg_ainfo.shortname = "t";
    9497  arg_ainfo.longname = "search type";
    9598  arg_ainfo.multiplechar = false;
    9699  arg_ainfo.defaultstatus = cgiarginfo::weak;
    97   arg_ainfo.argdefault = "0";
     100  arg_ainfo.argdefault = "1";
    98101  arg_ainfo.savedarginfo = cgiarginfo::must;
    99102  argsinfo.addarginfo (NULL, arg_ainfo);
     
    160163  if (arg_t != 0 && arg_t != 1) {
    161164    logout << "Warning: \"t\" argument out of range (" << arg_t << ")\n";
    162     args["t"] = argsinfo["t"].argdefault;
     165    cgiarginfo *tinfo = argsinfo.getarginfo ("t");
     166    if (tinfo != NULL) args["t"] = tinfo->argdefault;
    163167  }
    164168
     
    167171  if (arg_k != 0 && arg_k != 1) {
    168172    logout << "Warning: \"k\" argument out of range (" << arg_k << ")\n";
    169     args["k"] = argsinfo["k"].argdefault;
     173    cgiarginfo *kinfo = argsinfo.getarginfo ("k");
     174    if (kinfo != NULL) args["k"] = kinfo->argdefault;
    170175  }
    171176
     
    174179  if (arg_s != 0 && arg_s != 1) {
    175180    logout << "Warning: \"s\" argument out of range (" << arg_s << ")\n";
    176     args["s"] = argsinfo["s"].argdefault;
     181    cgiarginfo *sinfo = argsinfo.getarginfo ("s");
     182    if (sinfo != NULL) args["s"] = sinfo->argdefault;
    177183  }
    178184
     
    181187  if (arg_m < 0) {
    182188    logout << "Warning: \"m\" argument less than 0 (" << arg_m << ")\n";
    183     args["m"] = argsinfo["m"].argdefault;
     189    cgiarginfo *minfo = argsinfo.getarginfo ("m");
     190    if (minfo != NULL) args["m"] = minfo->argdefault;
    184191  }
    185192
     
    188195  if (arg_o < 0) {
    189196    logout << "Warning: \"o\" argument less than 0 (" << arg_o << ")\n";
    190     args["o"] = argsinfo["o"].argdefault;
     197    cgiarginfo *oinfo = argsinfo.getarginfo ("o");
     198    if (oinfo != NULL) args["o"] = oinfo->argdefault;
    191199  }
    192200
     
    195203  if (arg_r < 1) {
    196204    logout << "Warning: \"r\" argument less than 1 (" << arg_r << ")\n";
    197     args["r"] = argsinfo["r"].argdefault;
     205    cgiarginfo *rinfo = argsinfo.getarginfo ("r");
     206    if (rinfo != NULL) args["r"] = rinfo->argdefault;
    198207  }
    199208
     
    387396
    388397  // can't use isApprox here as it will be false as long
    389   // as numDocs < MAXDOCS (currently 200). If arg_m is less
     398  // as numDocs < MAXDOCS (currently 500). If arg_m is less
    390399  // than MAXDOCS numDocs can be greater than arg_m while
    391400  // isApprox is false.
    392   if (response.numDocs >= numdocs) resline = "_textmorethan_";
     401  if (response.numDocs > numdocs ||
     402      ((response.numDocs == numdocs) && response.isApprox))
     403    resline = "_textmorethan_";
    393404  if (numdocs == 0) resline = "_textnodocs_";
    394405  else if (numdocs == 1) resline += "_text1doc_";
    395   else resline += text_t(numdocs) + "_textlotsdocs_";
     406  else resline += text_t(numdocs) + " _textlotsdocs_";
    396407
    397408  disp.setmacro("resultline", "query", resline);
Note: See TracChangeset for help on using the changeset viewer.