Changeset 13366
- Timestamp:
- 2006-11-29T14:18:56+13:00 (17 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/queryaction.cpp
r13280 r13366 463 463 arg_ainfo.argdefault = "1"; 464 464 arg_ainfo.savedarginfo = cgiarginfo::mustnot; 465 argsinfo.addarginfo (NULL, arg_ainfo); 466 467 468 // "srn" - the next search result 469 arg_ainfo.shortname = "srn"; 470 arg_ainfo.longname = "the next search result"; 471 arg_ainfo.multiplechar = false; 472 arg_ainfo.defaultstatus = cgiarginfo::weak; 473 arg_ainfo.argdefault = "0"; 474 arg_ainfo.savedarginfo = cgiarginfo::must; 475 argsinfo.addarginfo (NULL, arg_ainfo); 476 477 // "srp" - the previous search result 478 arg_ainfo.shortname = "srp"; 479 arg_ainfo.longname = "the previous search result"; 480 arg_ainfo.multiplechar = false; 481 arg_ainfo.defaultstatus = cgiarginfo::weak; 482 arg_ainfo.argdefault = "0"; 483 arg_ainfo.savedarginfo = cgiarginfo::must; 465 484 argsinfo.addarginfo (NULL, arg_ainfo); 466 485 … … 1322 1341 if (response.numDocs > 0) { 1323 1342 numdocs += response.numDocs; 1324 1343 1325 1344 QueryResult_t thisresult; 1326 1345 thisresult.collection = *col_here; … … 1335 1354 ++col_here; 1336 1355 } // for each coll 1356 1357 text_t numdocs_t = numdocs; 1358 args["nmd"] = numdocs_t; 1337 1359 1338 1360 disp.setmacro ("freqmsg", "query", freqmsg); … … 1367 1389 if (count < firstdoc) {++count; ++res_here; continue;} 1368 1390 if (count > thislast) break; 1391 1369 1392 formatlistptr = colinfomap[(*res_here).collection].formatlistptr; 1370 1393 browserptr = colinfomap[(*res_here).collection].browserptr; … … 1443 1466 FilterRequest_t request; 1444 1467 FilterResponse_t response; 1468 1469 text_t maxDoc_old = args["o"]; 1470 text_t starts_old = args["r"]; 1471 1472 //if the "ifl" argument is set ignore the "r" and "o" arg 1473 if(!args["ifl"].empty()){ 1474 args["r"] = 1; 1475 args["o"] = args["m"]; 1476 } 1477 1478 1445 1479 bptr->set_filter_options (request, args); 1446 1480 bptr->load_metadata_defaults (request.fields); … … 1453 1487 text_t formattedstring = ""; 1454 1488 get_formatted_query_string(formattedstring, segment, args, disp, logout); 1455 1489 1490 1456 1491 if (!formattedstring.empty()) { // do the query 1457 1492 // note! formattedstring is in unicode! mg and mgpp must convert! 1458 1493 set_queryfilter_options (request, formattedstring, args); 1494 1459 1495 collectproto->filter (collection, request, response, err, logout); 1496 1460 1497 if (err != noError) { 1461 1498 outconvertclass text_t2ascii; … … 1468 1505 // Perform the "I'm feeling lucky" trick if the "ifl" argument is set 1469 1506 if (err == noError && !args["ifl"].empty()) { 1470 // Find the search result specified by the ifln argument 1507 //Restore the "r" and "o" arg 1508 args["r"] = starts_old; 1509 args["o"] = maxDoc_old ; 1510 1511 //Find whether DocumentSearchResultLinks is enabled 1512 bool show_links = false; 1513 text_tmap::const_iterator format_here = cinfo->format.begin(); 1514 text_tmap::const_iterator format_end = cinfo->format.end(); 1515 1516 while (format_here != format_end) { 1517 if (((*format_here).first == "DocumentSearchResultLinks") && 1518 ((*format_here).second == "true")){ 1519 show_links = true; 1520 break; 1521 } 1522 ++format_here; 1523 } 1524 1525 // Find the search result specified by the ifln argument 1526 ResultDocInfo_tarray::iterator thissection = response.docInfo.begin(); 1471 1527 int section_number = 1; 1472 ResultDocInfo_tarray::iterator thissection = response.docInfo.begin();1473 while (section_number != args["ifln"] && thissection != response.docInfo.end()) {1474 section_number++; 1528 int ifln = args["ifln"].getint(); 1529 1530 while (section_number != ifln && thissection != response.docInfo.end()) { 1475 1531 thissection++; 1532 section_number++; 1476 1533 } 1477 1478 1534 // If the search result exists, go directly to it 1479 if (section_number == args["ifln"]&& thissection != response.docInfo.end()) {1535 if (section_number == ifln && thissection != response.docInfo.end()) { 1480 1536 // Location response (this URL must have "&" and not "&"!) 1481 textout << outconvert << disp << "Location: _gwcgi_?e=_compressedoptions_&a=d&c=" << collection << "&d=" << (*thissection).OID << "\n\n"; 1537 int num_docs = response.numDocs; 1538 int srn = 0; 1539 int srp = 0; 1540 if (show_links && section_number < num_docs ) { 1541 srn = section_number + 1; 1542 } 1543 if (show_links && section_number > 1 ) { 1544 srp = section_number - 1; 1545 } 1546 1547 textout << outconvert << disp << "Location: _gwcgi_?e=_compressedoptions_&a=d&c=" << collection << "&d=" << (*thissection).OID <<"&srn="<<srn<<"&srp="<<srp<< "\n\n"; 1482 1548 textout << flush; 1483 1549 return true; 1484 1550 } 1485 1551 1486 1552 // There weren't enough (or any) matching documents 1487 1553 // We'll just carry on as if ifl wasn't set. The only catch is that get_cgihead_info won't have 1488 1554 // done the right thing (because ifl was set), so we need to make sure the output is html 1489 1555 textout << "Content-type: text/html\n\n"; 1556 1490 1557 } 1491 1558 … … 1517 1584 if (err == noError) { 1518 1585 // output the results 1586 text_t numdocs_t = response.numDocs; 1587 args["nmd"] = numdocs_t; 1519 1588 bool use_table = is_table_content (formatlistptr); 1520 1589 bptr->output_section_group (response, args, collection, 0, formatlistptr, -
trunk/gsdl/src/recpt/vlistbrowserclass.cpp
r12488 r13366 61 61 "<td valign=\"top\">[highlight]{Or}{[dls.Title],[dc.Title],[Title],Untitled}[/highlight]" 62 62 "{If}{[Source],<br><i>([Source])</i>}</td>"; 63 } 64 65 bool 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; 63 84 } 64 85 … … 74 95 text_t link, icon; 75 96 text_t collink = collection; 97 bool show_links = show_search_result_links(collectproto,collection,logout); 98 76 99 77 100 #ifndef DOCHANDLE … … 79 102 #endif 80 103 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 82 108 bool highlight = false; 83 109 if (!args["d"].empty()) { … … 133 159 text_t &arg_d = args["d"]; 134 160 text_t &arg_cl = args["cl"]; 135 161 136 162 text_t collink = collection; 163 bool show_links = show_search_result_links(collectproto,collection,logout); 164 137 165 #ifndef DOCHANDLE 138 166 if (!collink.empty()) collink = "&c=" + collink; … … 183 211 } 184 212 213 int count = 0; 214 185 215 while (thissection != endsection) { 186 216 ++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); 188 219 bool highlight = false; 189 220 if (!arg_d.empty()) { … … 227 258 // [modification to allow default document detach settings -- kjdon] 228 259 void vlistbrowserclass::get_link_icon (ResultDocInfo_t §ion, 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 230 263 231 264 #ifndef DOCHANDLE … … 236 269 237 270 text_t link_end = "\">"; 271 238 272 #ifndef DOCHANDLE 239 273 text_t detach_link_end = "&x=1\" target=\\_blank>"; // to detach the link, and x=1 signifies it is a detached page … … 252 286 doctype = section.metadata["doctype"].values[0]; 253 287 288 254 289 text_t &arg_d = args["d"]; 255 290 text_t &arg_cl = args["cl"]; 256 291 292 257 293 if (args["a"] == "q") { 258 294 // query results list 259 295 #ifndef DOCHANDLE 260 link += "&cl=search&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 +="&srp="+srp_t; 310 link +="&srn="+srn_t; 311 link +="&cl=search&d=" + section.OID; 261 312 #else 262 313 link += "," + section.OID+")"; 263 314 #endif 315 316 264 317 if (args["xx"] == "1") { 265 318 link += detach_link_end; -
trunk/gsdl/src/recpt/vlistbrowserclass.h
r7432 r13366 62 62 protected: 63 63 64 64 65 virtual void get_link_icon (ResultDocInfo_t §ion, cgiargsclass &args, 65 const text_t &collink, text_t &link, text_t &icon); 66 const text_t &collink, text_t &link, text_t &icon, bool showresultlinks); 67 68 virtual bool show_search_result_links (recptproto * collectproto,const text_t &collection,ostream& logout); 66 69 67 70 receptionist *recpt;
Note:
See TracChangeset
for help on using the changeset viewer.