Changeset 669


Ignore:
Timestamp:
1999-10-15T12:00:53+13:00 (25 years ago)
Author:
sjboddie
Message:

finished changes to browsing support

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

Legend:

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

    r649 r669  
    2828/*
    2929   $Log$
     30   Revision 1.27  1999/10/14 23:00:53  sjboddie
     31   finished changes to browsing support
     32
    3033   Revision 1.26  1999/10/10 08:14:06  sjboddie
    3134   - metadata now returns mp rather than array
     
    438441    ((*format_here).second == "true"))
    439442      formatinfo.DocumentImages = true;
     443    else if (((*format_here).first == "DocumentTitles") &&
     444         ((*format_here).second == "false"))
     445      formatinfo.DocumentTitles = false;
    440446    else if ((*format_here).first == "DocumentHeading")
    441447      formatinfo.DocumentHeading = (*format_here).second;
    442     else if (((*format_here).first == "DocumentArrowsTop") &&
     448    else if (((*format_here).first == "DocumentContents") &&
    443449         ((*format_here).second == "false"))
    444       formatinfo.DocumentArrowsTop = false;
     450      formatinfo.DocumentContents = false;
    445451    else if (((*format_here).first == "DocumentArrowsBottom") &&
    446452         ((*format_here).second == "false"))
    447453      formatinfo.DocumentArrowsBottom = false;
    448     else if (((*format_here).first == "DocumentGoTo") &&
    449          ((*format_here).second == "false"))
    450       formatinfo.DocumentGoTo = false;
    451454    else if ((*format_here).first == "DocumentButtons")
    452455      splitchar ((*format_here).second.begin(), (*format_here).second.end(),
     
    461464
    462465  // never want arrows when text is expanded
    463   if (gt) {
     466  if (gt)
    464467    formatinfo.DocumentArrowsBottom = false;
    465     formatinfo.DocumentArrowsTop = false;
    466   }
    467468}
    468469
     
    555556      disp.setmacro ("header", "document", "_textheader_");
    556557
    557       text_t pagetitle = response.docInfo[0].metadata["Title"].values[0];
     558      text_tarray pagetitlearray;
     559      if (!response.docInfo[0].metadata["Title"].values[0].empty())
     560    pagetitlearray.push_back (response.docInfo[0].metadata["Title"].values[0]);
    558561      if (!gt) {
    559     MetadataInfo_t *parent = response.docInfo[0].metadata["Title"].parent;
    560     while (parent != NULL) {
    561       pagetitle += ": " + parent->values[0];
    562       parent = parent->parent;
     562    MetadataInfo_t *parenttitle = response.docInfo[0].metadata["Title"].parent;
     563    while (parenttitle != NULL) {
     564      if (!parenttitle->values[0].empty())
     565        pagetitlearray.push_back (parenttitle->values[0]);
     566      parenttitle = parenttitle->parent;
    563567    }
    564568      }
     569      reverse (pagetitlearray.begin(), pagetitlearray.end());
     570      text_t pagetitle;
     571      joinchar (pagetitlearray, ": ", pagetitle);
    565572      disp.setmacro ("pagetitle", "document", pagetitle);
    566       disp.setmacro ("thisOID", "Global", response.docInfo[0].metadata["archivedir"].values[0]);
     573
     574      if (is_top (arg_d))
     575    disp.setmacro ("thisOID", "Global", response.docInfo[0].metadata["archivedir"].values[0]);
     576      else {
     577    MetadataInfo_t *parentad = response.docInfo[0].metadata["archivedir"].parent;
     578    text_t thisOID;
     579    while (parentad != NULL) {
     580      thisOID = parentad->values[0];
     581      parentad = parentad->parent;
     582    }
     583    disp.setmacro ("thisOID", "Global", thisOID);
     584      }
    567585     
    568586      if (args["u"] != "1")
     
    712730  }
    713731   
    714   int metasize = metadata.size();
    715 
    716732  if (get_info (OID, collection, metadata, getParents, collectproto, inforesponse, logout)) {
    717733    int hastxt = inforesponse.docInfo[0].metadata["hastxt"].values[0].getint();
    718734    int haschildren = inforesponse.docInfo[0].metadata["haschildren"].values[0].getint();
    719 
     735   
    720736    if (arg_gt == 0) {
    721737      output_text (inforesponse.docInfo[0], formatlistptr, queryresponse.termInfo,
  • trunk/gsdl/src/recpt/receptionist.cpp

    r649 r669  
    2828/*
    2929   $Log$
     30   Revision 1.34  1999/10/14 23:00:52  sjboddie
     31   finished changes to browsing support
     32
    3033   Revision 1.33  1999/10/10 08:14:10  sjboddie
    3134   - metadata now returns mp rather than array
     
    830833  outconverter->reset();
    831834
    832   // decide on the protocol used for communicating with
    833   // the collection server
    834835  text_t &collection = args["c"];
    835836  recptproto *collectproto = NULL;
    836837  if (!collection.empty()) {
     838    // decide on the protocol used for communicating with
     839    // the collection server
    837840    collectproto = protocols.getrecptproto (collection, logout);
    838   }
    839 
    840   // get collection information
    841   collectinfo.clear();
    842   if (!collection.empty()) {
    843     comerror_t err;
    844     collectproto->get_collectinfo (collection, collectinfo, err, logout);
    845     if (err != noError) collectinfo.clear();
    846   }
    847 
    848   // get browsers to process OID
    849   text_t OID = args["d"];
    850   if (OID.empty()) OID = args["cl"];
    851   text_tset metadata;
    852   FilterResponse_t response;
    853   metadata.insert ("classifytype");
    854   if (get_info (OID + ".pr", args["c"], metadata, false, collectproto, response, logout)) {
    855     browserclass *b =
    856       browsers.getbrowser (response.docInfo[0].metadata["classifytype"].values[0]);
    857     b->processOID (args);
    858   }
    859 
    860   // translate "d", "cl", and "hp" arguments if required
    861   translate_OIDs (args, collectproto, logout);
     841
     842    // get collection information
     843    collectinfo.clear();
     844    if (!collection.empty()) {
     845      comerror_t err;
     846      collectproto->get_collectinfo (collection, collectinfo, err, logout);
     847      if (err != noError) collectinfo.clear();
     848    }
     849
     850    // get browsers to process OID
     851    text_t OID = args["d"];
     852    if (OID.empty()) OID = args["cl"];
     853    if (!OID.empty()) {
     854      text_tset metadata;
     855      text_tarray OIDs;
     856      OIDs.push_back (OID);
     857      if (!is_top(OID)) OIDs.push_back (OID + ".pr");
     858      FilterResponse_t response;
     859      metadata.insert ("childtype");
     860      if (get_info (OIDs, args["c"], metadata, false, collectproto, response, logout)) {
     861    text_t classifytype = response.docInfo[0].metadata["childtype"].values[0];
     862    if (classifytype.empty())
     863      classifytype = response.docInfo[1].metadata["childtype"].values[0];
     864    browserclass *b = browsers.getbrowser (classifytype);
     865    b->processOID (args, collectproto, logout);
     866      }
     867    }
     868
     869    // translate "d", "cl", and "hp" arguments if required
     870    translate_OIDs (args, collectproto, logout);
     871  }
    862872
    863873  // produce the page using the desired action
     
    10031013
    10041014// translate_OIDs translates the "d", "cl", and "hp" arguments to their correct values
    1005 // if they use the tricky ".fc", ".lc" type syntax. also sorts out the "d" argument
    1006 // if the goto page ("gp") argument was used
     1015// if they use the tricky ".fc", ".lc" type syntax.
    10071016void receptionist::translate_OIDs (cgiargsclass &args, recptproto *collectproto,
    10081017                   ostream &logout) {
     
    10151024  text_t &arg_hp = args["hp"];
    10161025  text_t &collection = args["c"];
    1017   text_t &arg_gp = args["gp"];
    10181026 
    10191027  // do a call to translate OIDs if required
     
    10441052    collectproto->filter (collection, request, response, err, logout);
    10451053    arg_hp = response.docInfo[0].OID;
    1046   }
    1047 
    1048   // if the "gp" (go to page) argument is set we need to set
    1049   // the "d" argument to the corresponding page
    1050   if ((!arg_d.empty()) && (!arg_gp.empty()) && (is_number (arg_gp))) {
    1051     text_t top;
    1052     get_top (arg_d, top);
    1053     text_tset metadata;
    1054     metadata.insert ("Title");
    1055     bool getParents = false;
    1056     get_children (top, collection, metadata, getParents, collectproto, response, logout);
    1057     ResultDocInfo_tarray::iterator dochere = response.docInfo.begin();
    1058     ResultDocInfo_tarray::iterator docend = response.docInfo.end();
    1059     while (dochere != docend) {
    1060       if ((*dochere).metadata["Title"].values[0] == arg_gp) {
    1061     arg_d = (*dochere).OID;
    1062     break;
    1063       }
    1064       dochere ++;
    1065     }
    10661054  }
    10671055}
Note: See TracChangeset for help on using the changeset viewer.