Ignore:
Timestamp:
2001-04-20T13:19:37+12:00 (23 years ago)
Author:
sjboddie
Message:

Added a "help" link to the default home page

File:
1 edited

Legend:

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

    r2113 r2329  
    197197}
    198198
     199void pageaction::set_collectionlist_macro (displayclass &disp, recptprotolistclass *protos,
     200                       ostream &logout) {
     201
     202  text_t collectionlist;
     203  int count = 0;
     204 
     205  recptprotolistclass::iterator rprotolist_here = protos->begin();
     206  recptprotolistclass::iterator rprotolist_end = protos->end();
     207  while (rprotolist_here != rprotolist_end) {
     208    if ((*rprotolist_here).p != NULL) {
     209
     210      text_tarray collist;
     211      comerror_t err;
     212      (*rprotolist_here).p->get_collection_list (collist, err, logout);
     213      if (err == noError) {
     214    text_tarray::iterator collist_here = collist.begin();
     215    text_tarray::iterator collist_end = collist.end();
     216
     217    while (collist_here != collist_end) {
     218      ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr ((*rprotolist_here).p, *collist_here, logout);
     219     
     220      if (cinfo != NULL) {
     221        if (cinfo->isPublic && (cinfo->buildDate > 0)) {
     222
     223          count ++;
     224
     225          text_t coll_type = "&ct=";
     226          if (cinfo->buildType == "mgpp") {
     227        coll_type += "1";
     228          }
     229          else {
     230        coll_type += "0";
     231          }
     232          FilterResponse_t response;
     233          text_tset metadata;
     234          metadata.insert ("collectionname");
     235          text_t collectionname = *collist_here;
     236
     237          if (get_info ("collection", *collist_here, metadata, false,
     238                (*rprotolist_here).p, response, logout)) {
     239        if (!response.docInfo[0].metadata["collectionname"].values[0].empty()) {
     240          collectionname = response.docInfo[0].metadata["collectionname"].values[0];
     241        }
     242          }
     243         
     244          comerror_t err;
     245          text_t optsite = "";
     246          text_t site_name = (*rprotolist_here).p->get_site_name (err);
     247          if (!site_name.empty()) { optsite = "site="+site_name+"&"; }
     248
     249          text_t link = "<a href=\"_gwcgi_?"+optsite+"a=p&p=about&c=" + *collist_here + coll_type+"\">";
     250
     251          if (!cinfo->receptionist.empty())
     252        link = "<a href=\"" + cinfo->receptionist + "\">";
     253         
     254         collectionlist += "<li>" + link + collectionname + "</a>\n";
     255        }
     256      }
     257      collist_here ++;
     258    }
     259      }
     260    }
     261    rprotolist_here ++;
     262  }
     263
     264  if (count == 1) {
     265    collectionlist = "<p>This Greenstone installation contains 1 collection\n<ul>" +
     266      collectionlist + "</ul>\n";
     267  } else if (count > 1) {
     268    collectionlist = "<p>This Greenstone installation contains " + text_t(count) +
     269      " collections\n<ul>" + collectionlist + "</ul>\n";
     270  }
     271
     272  disp.setmacro ("collectionlist", "homehelp", collectionlist);
     273}
     274
    199275void pageaction::define_internal_macros (displayclass &disp, cgiargsclass &args,
    200276                     recptprotolistclass *protos, ostream &logout) {
     
    243319  // _textgoadmin_         set to "" if status is disabled in main.cfg
    244320
     321
     322  // if page is "homehelp"
     323  // _collectionlist_      list of available collections to be displayed on the homehelp page
    245324 
    246325  if (recpt == NULL) {
     
    475554      }
    476555    }
     556
     557  } else if (arg_p == "homehelp") {
     558   
     559    set_collectionlist_macro (disp, protos, logout);
     560
    477561  }
    478562}
Note: See TracChangeset for help on using the changeset viewer.