Ignore:
Timestamp:
2006-11-29T14:18:56+13:00 (17 years ago)
Author:
shaoqun
Message:

added code to support the display of previous and next search result links in a document page

File:
1 edited

Legend:

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

    r12488 r13366  
    6161    "<td valign=\"top\">[highlight]{Or}{[dls.Title],[dc.Title],[Title],Untitled}[/highlight]"
    6262    "{If}{[Source],<br><i>([Source])</i>}</td>";
     63}
     64
     65bool vlistbrowserclass::show_search_result_links(recptproto * collectproto,const text_t &collection,ostream& logout){
     66     ColInfoResponse_t cinfo;
     67     comerror_t err;
     68     collectproto->get_collectinfo (collection, cinfo, err, logout);
     69     bool show_links = false;
     70
     71     text_tmap::const_iterator format_here = cinfo.format.begin();
     72     text_tmap::const_iterator format_end = cinfo.format.end();
     73     
     74     while (format_here != format_end) {
     75       if (((*format_here).first == "DocumentSearchResultLinks") &&
     76       ((*format_here).second == "true")){
     77     show_links = true;
     78         break;
     79       }
     80       ++format_here;
     81     }
     82     
     83     return show_links;
    6384}
    6485
     
    7495  text_t link, icon;
    7596  text_t collink = collection;
     97  bool show_links = show_search_result_links(collectproto,collection,logout);
     98
    7699
    77100#ifndef DOCHANDLE
     
    79102#endif
    80103
    81   get_link_icon (section, args, collink, link, icon);
     104  get_link_icon (section, args, collink, link, icon, show_links);
     105
     106  //get_link_icon (section, args, collink, link, icon);
     107
    82108  bool highlight = false;
    83109  if (!args["d"].empty()) {
     
    133159  text_t &arg_d = args["d"];
    134160  text_t &arg_cl = args["cl"];
    135 
     161 
    136162  text_t collink = collection;
     163  bool show_links = show_search_result_links(collectproto,collection,logout);
     164
    137165#ifndef DOCHANDLE
    138166  if (!collink.empty()) collink = "&amp;c=" + collink;
     
    183211  }
    184212
     213  int count = 0;
     214
    185215  while (thissection != endsection) {
    186216    ++item;
    187     get_link_icon (*thissection, args, collink, link, icon);
     217    get_link_icon (*thissection, args, collink, link, icon,show_links);
     218    //get_link_icon (*thissection, args, collink, link, icon);
    188219    bool highlight = false;
    189220    if (!arg_d.empty()) {
     
    227258// [modification to allow default document detach settings -- kjdon]
    228259void vlistbrowserclass::get_link_icon (ResultDocInfo_t &section, cgiargsclass &args,
    229                        const text_t &collink, text_t &link, text_t &icon) {
     260                       const text_t &collink, text_t &link, text_t &icon, bool showresultlinks) {
     261
     262 
    230263
    231264#ifndef DOCHANDLE
     
    236269
    237270  text_t link_end = "\">";
     271
    238272#ifndef DOCHANDLE
    239273  text_t detach_link_end = "&amp;x=1\" target=\\_blank>"; // to detach the link, and x=1 signifies it is a detached page
     
    252286    doctype = section.metadata["doctype"].values[0];
    253287
     288
    254289  text_t &arg_d = args["d"];
    255290  text_t &arg_cl = args["cl"];
    256 
     291 
     292 
    257293  if (args["a"] == "q") {
    258294    // query results list
    259295#ifndef DOCHANDLE
    260     link += "&amp;cl=search&amp;d=" + section.OID;
     296    int result_num = section.result_num;
     297    int num_docs = args["nmd"].getint();
     298    int srn = 0;
     299    int srp = 0;
     300    if (showresultlinks && result_num < num_docs) {
     301      srn = result_num  + 1;
     302    }   
     303    if (showresultlinks && result_num > 1 ) {
     304      srp = result_num  - 1;
     305    }   
     306       
     307    text_t srp_t = srp;
     308    text_t srn_t = srn;
     309    link +="&amp;srp="+srp_t;
     310    link +="&amp;srn="+srn_t;
     311    link +="&amp;cl=search&amp;d=" + section.OID;
    261312#else
    262313    link += "," + section.OID+")";
    263314#endif
     315
     316 
    264317    if (args["xx"] == "1") {
    265318      link += detach_link_end;
Note: See TracChangeset for help on using the changeset viewer.