Ignore:
Timestamp:
1999-08-25T16:48:43+12:00 (25 years ago)
Author:
sjboddie
Message:

changes to the home and about pages

File:
1 edited

Legend:

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

    r452 r471  
    1212/*
    1313   $Log$
     14   Revision 1.11  1999/08/25 04:48:43  sjboddie
     15   changes to the home and about pages
     16
    1417   Revision 1.10  1999/08/11 23:29:43  sjboddie
    1518   added support for html classifier (i.e. the hp argument)
     
    5154 */
    5255
    53 
     56#include "OIDtools.h"
    5457#include "pageaction.h"
    5558#include "receptionist.h"
     
    111114
    112115
    113 void pageaction::define_internal_macros (const ColInfoResponse_t &/*collectinfo*/, displayclass &disp,
    114                      cgiargsclass &args, recptproto */*collectproto*/,
     116void pageaction::define_internal_macros (const ColInfoResponse_t &collectinfo, displayclass &disp,
     117                     cgiargsclass &args, recptproto *collectproto,
    115118                     ostream &logout) {
    116119
    117120  // define_internal_macros sets the following macros:
    118121
    119   // _homeextra_   this is the list of available collections and collection info
    120   //               to be displayed on the home page
    121 
    122   if (args["p"] == "home") {
     122  // if page is "home"
     123  // _homeextra_           this is the list of available collections and collection info
     124  //                       to be displayed on the home page
     125
     126
     127  // if page is "about"
     128  // _numdocs_             the number of documents in the collection
     129
     130  // _builddate_           the date last built
     131
     132  // _textbrowseoptions_   the 'how to find information' text in the about and help pages
     133
     134  // _numbrowseoptions_    the number of browsing options
     135
     136
     137  // if page is "help"
     138  // _textbrowseoptions_   the 'how to find information' text in the about and help pages
     139
     140  // _numbrowseoptions_    the number of browsing options
     141
     142 
     143  text_t &arg_p = args["p"];
     144
     145  if (arg_p == "home") {
    123146    // make sure we know about a receptionist
    124147    if (recpt == NULL) {
     
    149172      homeextra += "<dl>\n";
    150173
     174      FilterResponse_t response;
     175      text_tarray metadata;
     176      metadata.push_back ("collectionname");
     177
    151178      while (collist_here != collist_end) {
     179        text_t collectionname = *collist_here;
     180        if (get_info ("collection", *collist_here, metadata, false, (*rprotolist_here).p, response, logout))
     181          collectionname = response.docInfo[0].metadata[0].values[0];
     182       
    152183        ColInfoResponse_t cinfo;
    153184        (*rprotolist_here).p->get_collectinfo (*collist_here, cinfo, err, logout);
    154185        if (err == noError) {
    155           text_t link = "<a href=\"_gwcgi_?a=q&c=" + *collist_here + "\">";
     186          text_t link = "<a href=\"_gwcgi_?a=p&p=about&c=" + *collist_here + "\">";
    156187          if (!cinfo.receptionist.empty())
    157         link = "<a href=\"" + cinfo.receptionist + "?a=q&c=" + *collist_here + "\">";
     188        link = "<a href=\"" + cinfo.receptionist + "?a=p&p=about&c=" + *collist_here + "\">";
    158189         
    159           homeextra += "<dt>" + link + *collist_here + "</a></dt>\n";
     190          homeextra += "<dt>" + link + collectionname + "</a></dt>\n";
    160191          homeextra += "<dd>";
    161192          if (cinfo.numDocs != 0) homeextra += text_t(cinfo.numDocs) + "_documents_";
     
    172203      rprotolist_here ++;
    173204    }
     205  } else if (arg_p == "about") {
     206    disp.setmacro ("numdocs", "about", collectinfo.numDocs);
     207    unsigned long current_time = time(NULL);
     208    unsigned long builddate = (current_time - collectinfo.buildDate) / 86400;
     209    disp.setmacro ("builddate", "about", builddate);
     210  }
     211
     212  if (arg_p == "about" || arg_p == "help") {
     213
     214    // _textbrowseoptions_ and _numbrowseoptions_
     215
     216    FilterResponse_t response;
     217    text_tarray metadata;
     218    metadata.push_back ("Title");
     219    bool getParents = false;
     220    get_children ("", args["c"], metadata, getParents, collectproto, response, logout);
     221
     222    disp.setmacro ("numbrowseoptions", "help", response.docInfo.size()+1);
     223
     224    ResultDocInfo_tarray::const_iterator here = response.docInfo.begin();
     225    ResultDocInfo_tarray::const_iterator end = response.docInfo.end();
     226
     227    // we're assuming that we've always got a search button
     228    text_t shorttext = "<ul><li>_textSearchshort_\n";
     229    text_t longtext = "_textSearchlong_";
     230
     231    while (here != end) {
     232      const text_t &title = (*here).metadata[0].values[0];
     233      shorttext += "<li>_text" + title + "short_\n";
     234      longtext += "_text" + title + "long_";
     235      here ++;
     236    }
     237    shorttext += "</ul>\n";
     238    disp.setmacro ("textbrowseoptions", "help", shorttext + longtext);
    174239  }
    175240}
Note: See TracChangeset for help on using the changeset viewer.