Changeset 624


Ignore:
Timestamp:
1999-09-23T22:09:17+12:00 (25 years ago)
Author:
sjboddie
Message:

made some changes so AZLists within other classifications are
handled properly

File:
1 edited

Legend:

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

    r541 r624  
    2828/*
    2929   $Log$
     30   Revision 1.23  1999/09/23 10:09:17  sjboddie
     31   made some changes so AZLists within other classifications are
     32   handled properly
     33
    3034   Revision 1.22  1999/09/07 23:06:58  rjmcnab
    3135   removed some compiler warnings.
     
    331335
    332336static void output_parents_toc (cgiargsclass &args, const FilterResponse_t &parents,
    333                 int &tabcount, displayclass &disp,
     337                int &tabcount, displayclass &disp, recptproto *collectproto,
    334338                format_t *formatlistptr, outconvertclass &outconvert,
    335339                ostream &textout, ostream &logout);
     
    345349                displayclass &disp, format_t *formatlistptr,
    346350                 outconvertclass &outconvert, ostream &textout);
     351
     352static void output_azlist (cgiargsclass &args, ResultDocInfo_tarray::const_iterator &here,
     353               ResultDocInfo_tarray::const_iterator &end, bool intable,
     354               displayclass &disp, format_t *formatlistptr,
     355               outconvertclass &outconvert, ostream &textout);
    347356
    348357static void output_datelist (cgiargsclass &args, ResultDocInfo_tarray::const_iterator &here,
     
    404413  text_t &arg_d = args["d"];
    405414  text_t OID = arg_d;
    406   if (OID.empty()) OID = args["cl"];
     415  if (OID.empty()) {
     416    // if classifytype is an AZList we need to jump to
     417    // the first child
     418    if (classifytype == "AZList") OID = args["cl"] + ".fc";
     419    else OID = args["cl"];
     420  }
     421
    407422  text_t &collection = args["c"];
    408423
     
    430445    if (!get_children (OID + ".pr", collection, metadata,
    431446               getParents, collectproto, fsiblings, logout))
    432     return;
     447      return;
    433448  }
    434449  if (!get_info (parents, collection, metadata, false, collectproto, fparents, logout)) return;
    435450 
    436451  if (!fparents.docInfo.empty())
    437     output_parents_toc(args, fparents, tabcount, disp,
     452    output_parents_toc(args, fparents, tabcount, disp, collectproto,
    438453               formatlistptr, outconvert, textout, logout);
    439454 
     
    444459
    445460void output_parents_toc (cgiargsclass &args, const FilterResponse_t &parents,
    446              int &tabcount, displayclass &disp,
     461             int &tabcount, displayclass &disp, recptproto *collectproto,
    447462             format_t *formatlistptr, outconvertclass &outconvert,
    448              ostream &textout, ostream &/*logout*/) { 
     463             ostream &textout, ostream &logout) { 
    449464
    450465  text_t tab, icon;
     
    459474
    460475  int len = (*thisparent).metadata.size();
    461   const text_t &classifytype = (*thisparent).metadata[len-1].values[0];
     476  //  const text_t &classifytype = (*thisparent).metadata[len-1].values[0];
    462477
    463478  // don't want top level of any classifications to be displayed
     
    465480
    466481  // don't want second level of classifications using classification links
    467   if ((classifytype == "AZList" || classifytype == "DateList") && (thisparent != end))
    468     {thisparent ++; numcols --;}
     482  //  if ((classifytype == "AZList" || classifytype == "DateList") && (thisparent != end))
     483  //    {thisparent ++; numcols --;}
    469484
    470485  // the tab line
     
    475490  }
    476491
     492  bool first = true;
    477493  while (thisparent != end) {
    478494
     495    text_t link;
     496    bool azlist = false;
     497    // set azlist if we're in an AZList section (i.e. immediate parent
     498    // has classifytype of AZList
     499    if (!first && (*(thisparent-1)).metadata[len-1].values[0] == "AZList")
     500      azlist = true;
     501 
    479502    const text_t &doctype = (*thisparent).metadata[len-2].values.back();
    480 
    481     // set up icon and pointer
    482     icon = "_document:icon";
    483     if ((doctype != "classify") && ((*thisparent).OID == arg_d))
    484       icon += "arrow";
    485     if (doctype == "classify") icon += "openbookshelf_";
    486     else if (is_top((*thisparent).OID)) icon += "openbook_";
    487     else icon += "openfolder_";
    488    
     503    bool thissection = false;
     504
     505    if (!azlist) {
     506      // set up icon and pointer
     507      icon = "_document:icon";
     508      if ((doctype != "classify") && ((*thisparent).OID == arg_d))
     509    icon += "arrow";
     510      if (doctype == "classify") icon += "openbookshelf_";
     511      else if (is_top((*thisparent).OID)) icon += "openbook_";
     512      else icon += "openfolder_";
     513   
     514      // set up the link
     515      link = "<a href=\"_httpdocument_";
     516      if (is_top((*thisparent).OID) && args.getintarg("x")) link = "<a name=top>";
     517      else
     518    if (doctype == "classify") link += "&cl=" + (*thisparent).OID + ".pr\">";
     519    else
     520      if (is_top ((*thisparent).OID))
     521        if (arg_cl.empty())
     522          link = "<a name=top>";
     523        else if (arg_cl == "search")
     524          link = "<a href=\"_httpquery_\">";
     525        else
     526          link += "&cl=" + arg_cl + "\">";
     527      else link += "&cl=" + arg_cl + "&d=" + (*thisparent).OID + ".pr\">";
     528    }
     529     
    489530    if (tabcount == 1) textout << "<td></td>\n";
    490531    else if (tabcount > 1) textout << "<td colspan=" << tabcount << "></td>";
    491    
    492     // set up the link
    493     text_t link = "<a href=\"_httpdocument_";
    494     if (is_top((*thisparent).OID) && args.getintarg("x")) link = "<a name=top>";
    495     else
    496       if (doctype == "classify") link += "&cl=" + (*thisparent).OID + ".pr\">";
    497       else
    498     if (is_top ((*thisparent).OID))
    499       if (arg_cl.empty())
    500         link = "<a name=top>";
    501       else if (arg_cl == "search")
    502         link = "<a href=\"_httpquery_\">";
    503       else
    504         link += "&cl=" + arg_cl + "\">";
    505     else link += "&cl=" + arg_cl + "&d=" + (*thisparent).OID + ".pr\">";
    506    
     532
    507533    if ((numcols-tabcount) == 1) textout << "<td>";
    508534    else if ((numcols-tabcount) > 1) textout << "<td colspan="
     
    510536
    511537    if (intable) textout << "<table><tr>";
    512    
    513     textout << outconvert << disp
    514         << get_formatted_string (*thisparent, formatlistptr, link, icon);
     538
     539    if (azlist) {
     540      FilterResponse_t response;
     541      // AZLists rely on Title metadata
     542      text_tarray metadata;
     543      metadata.push_back ("Title");
     544
     545      // need to get siblings of this classification
     546      if (get_children ((*(thisparent-1)).OID, args["c"], metadata, false,
     547            collectproto, response, logout)) {
     548
     549    ResultDocInfo_tarray::const_iterator thissib = response.docInfo.begin();
     550    ResultDocInfo_tarray::const_iterator endsib = response.docInfo.end();
     551
     552    while (thissib != endsib) {
     553      link = "<a href=\"_httpdocument_&cl=" + (*thissib).OID + "\">";
     554      const text_t &title = (*thissib).metadata[0].values.back();
     555      if ((*thissib).OID == (*thisparent).OID)
     556        textout << outconvert << disp << "<b>" << title << "</b>\n";
     557      else textout << outconvert << disp << link << title << "</a>\n";
     558      thissib ++;
     559    }
     560      }
     561    } else {
     562      textout << outconvert << disp
     563          << get_formatted_string (*thisparent, formatlistptr, link, icon);
     564    }
    515565   
    516566    if (intable) textout << "</tr></table>";
    517567    textout << "</td></tr>\n";
    518568
     569    first = false;
    519570    tabcount ++;
    520571    thisparent ++;
     
    606657}
    607658
     659
     660void output_azlist (cgiargsclass &args, ResultDocInfo_tarray::const_iterator &here,
     661            ResultDocInfo_tarray::const_iterator &end, bool intable,
     662            displayclass &disp, format_t *formatlistptr,
     663            outconvertclass &outconvert, ostream &textout) {
     664
     665  int count = 1;
     666  int gt = args.getintarg("gt");
     667  text_t &arg_cl = args["cl"];
     668  text_t &arg_d = args["d"];
     669  text_t link;
     670
     671  if (intable) textout << "<tr><td>";
     672
     673  while (here != end) {
     674
     675    bool thissec = false;
     676    int len = (*here).metadata.size();
     677    const text_t &doctype = (*here).metadata[len-2].values.back();
     678    const text_t &hastxt = (*here).metadata[len-4].values.back();
     679    // AZLists are assumed to use Title metadata
     680    const text_t &title = (*here).metadata[len-6].values.back();
     681
     682    // bail on this document if it has no title
     683    if (title.empty()) continue;
     684
     685    if (doctype == "classify") {
     686      if ((*here).OID == arg_cl) thissec = true;
     687    } else if ((*here).OID == arg_d) thissec = true;
     688   
     689    // set up link
     690    if (!thissec) {
     691      link = "<a href=\"_httpdocument_";
     692      if (doctype == "classify") link += "&cl=" + (*here).OID + "\">";
     693      else link += "&cl=" + arg_cl + "&d=" + (*here).OID + "\">";
     694      if (gt) {
     695    link = "<a href=\"#" + text_t(count) + "\">";
     696    count ++;
     697      }
     698    }
     699
     700    if (thissec)
     701      textout << outconvert << disp << "<b>" << title << "</b>\n";
     702    else
     703      textout << outconvert << disp << link << title << "</a>\n";
     704   
     705    here ++;
     706  }
     707
     708  if (intable) textout << "</td></tr>";
     709}
    608710
    609711void output_datelist (cgiargsclass &args, ResultDocInfo_tarray::const_iterator &here,
Note: See TracChangeset for help on using the changeset viewer.