Changeset 9931 for trunk/gsdl/src/recpt
- Timestamp:
- 2005-05-23T16:36:40+12:00 (19 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/collectoraction.cpp
r9620 r9931 797 797 text_tarray::iterator collist_here = collist.begin(); 798 798 text_tarray::iterator collist_end = collist.end(); 799 FilterResponse_t response;800 text_tset metadata;801 metadata.insert ("collectionname");802 799 while (collist_here != collist_end) { 803 800 ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr ((*rprotolist_here).p, *collist_here, logout); 804 801 if (cinfo != NULL) { 805 text_t collectionname = *collist_here; 806 if (!cinfo->collectionmeta["collectionname"].empty()) { 807 // get collection name from the collection cfg file 808 collectionname = cinfo->collectionmeta["collectionname"]; 809 } else if (get_info ("collection", *collist_here, args["l"], metadata, false, 810 (*rprotolist_here).p, response, logout)) { 811 // get collection name from gdbm file 812 collectionname = response.docInfo[0].metadata["collectionname"].values[0]; 802 text_t collectionname = cinfo->get_collectionmeta("collectionname", args["l"]); 803 if (collectionname.empty()) { 804 collectionname = *collist_here; 813 805 } 814 806 dirnames.push_back(*collist_here); -
trunk/gsdl/src/recpt/extlinkaction.cpp
r9620 r9931 217 217 218 218 recptproto *collectproto = protos->getrecptproto (*col_here, logout); 219 220 219 if (get_info (args["href"], *col_here, args["l"], metadata, false, collectproto, response, logout)) { 221 220 if (!response.docInfo[0].metadata["section"].values[0].empty()) { 222 text_t collectionname = *col_here; 223 metadata.erase (metadata.begin(), metadata.end()); 224 metadata.insert ("collectionname"); 225 FilterResponse_t nresponse; 226 if (get_info ("collection", *col_here, args["l"], metadata, false, collectproto, nresponse, logout)) { 227 if (!nresponse.docInfo[0].metadata["collectionname"].values[0].empty()) 228 collectionname = nresponse.docInfo[0].metadata["collectionname"].values[0]; 221 ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr (collectproto, *col_here, logout); 222 text_t collectionname = cinfo->get_collectionmeta("collectionname", args["l"]); // 223 if (collectionname.empty()) { 224 collectionname = *col_here; 229 225 } 230 226 textout << outconvert << disp << ("_extlink:header_\n") -
trunk/gsdl/src/recpt/extlinkaction.h
r7371 r9931 31 31 32 32 #include "action.h" 33 #include "receptionist.h" 33 34 34 35 class extlinkaction : public action { … … 38 39 extlinkaction (); 39 40 virtual ~extlinkaction (); 41 42 void set_receptionist (receptionist *therecpt) {recpt=therecpt;} 40 43 41 44 text_t get_action_name () {return "extlink";} … … 55 58 56 59 protected: 60 61 receptionist *recpt; 62 57 63 bool get_link (cgiargsclass &args, recptprotolistclass *protos, 58 64 text_t &link, ostream &logout); -
trunk/gsdl/src/recpt/librarymain.cpp
r8073 r9931 182 182 183 183 #ifdef GSDL_USE_EXTLINK_ACTION 184 recpt.add_action (new extlinkaction()); 184 extlinkaction *aextlinkaction = new extlinkaction(); 185 aextlinkaction->set_receptionist(&recpt); 186 recpt.add_action (aextlinkaction); 185 187 #endif 186 188 -
trunk/gsdl/src/recpt/pageaction.cpp
r9676 r9931 219 219 coll_type += "0"; 220 220 } 221 222 FilterResponse_t response; 223 text_tset metadata; 224 metadata.insert ("collectionname"); 225 text_t lang = args["l"]; 226 if (!lang.empty()) { 227 metadata.insert ("collectionname:"+lang); 228 } 229 text_t collectionname = *collist_here; 230 231 if (get_info ("collection", *collist_here, "", metadata, false, 232 (*rprotolist_here).p, response, logout)) { 233 if (!lang.empty() && !response.docInfo[0].metadata["collectionname:"+lang].values[0].empty()) { 234 collectionname = response.docInfo[0].metadata["collectionname:"+lang].values[0]; 235 } else if (!response.docInfo[0].metadata["collectionname"].values[0].empty()) { 236 collectionname = response.docInfo[0].metadata["collectionname"].values[0]; 237 } 221 text_t collectionname = cinfo->get_collectionmeta("collectionname", args["l"]); 222 if (collectionname.empty()) { 223 collectionname = *collist_here; 238 224 } 239 225 … … 351 337 352 338 found_valid_col = true; 353 FilterResponse_t response; 354 text_tset metadata; 355 metadata.insert ("collectionname"); 356 metadata.insert ("iconcollection"); 357 metadata.insert ("iconcollectionsmall"); 358 // also look for lang specific values 359 text_t lang = args["l"]; 360 if (!lang.empty()) { 361 metadata.insert ("collectionname:"+lang); 362 metadata.insert ("iconcollection:"+lang); 363 metadata.insert ("iconcollectionsmall:"+lang); 339 text_t collectionname = *collist_here; 340 text_t alt = cinfo->get_collectionmeta("collectionname", args["l"]); 341 if (alt.empty()) { 342 alt = collectionname; 364 343 } 365 text_t collectionname = *collist_here; 366 text_t alt = collectionname; 367 368 if (get_info ("collection", *collist_here, "", metadata, false, 369 (*rprotolist_here).p, response, logout)) { 370 // get the "collectionname" 371 if (!lang.empty() && !response.docInfo[0].metadata["collectionname:"+lang].values[0].empty()) { 372 alt = response.docInfo[0].metadata["collectionname:"+lang].values[0]; 373 } else if (!response.docInfo[0].metadata["collectionname"].values[0].empty()) { 374 alt = response.docInfo[0].metadata["collectionname"].values[0]; 344 345 // url to image: try iconcollectionsmall, then iconcollection 346 text_t iconurl = cinfo->get_collectionmeta("iconcollectionsmall", args["l"]); 347 if (iconurl.empty()) { 348 iconurl = cinfo->get_collectionmeta("iconcollection", args["l"]); 349 } 350 351 if (!iconurl.empty()) { 352 353 // check to see URL is local to colserver 354 text_t::iterator iconurl_head = iconurl.begin(); 355 text_t iconhead = substr(iconurl_head,iconurl_head+16); 356 if (iconhead=="_httpcollection_") { 357 358 // local and using _httpcollection_ 359 text_t icontail = substr(iconurl_head+16,iconurl.end()); 360 iconurl = "http://" + cinfo->httpdomain 361 + cinfo->httpprefix + "/collect/" 362 + *collist_here + "/" + icontail; 363 } 364 else if (iconurl[0]=='/') { 365 366 // local but with full path 367 iconurl = "http://" + cinfo->httpdomain + iconurl; 375 368 } 376 369 377 text_t iconurl; 378 iconurl.clear(); 379 380 if (!lang.empty() &&!response.docInfo[0].metadata["iconcollectionsmall:"+lang].values[0].empty()) { 381 iconurl = response.docInfo[0].metadata["iconcollectionsmall:"+lang].values[0]; 382 } else if (!response.docInfo[0].metadata["iconcollectionsmall"].values[0].empty()) { 383 iconurl = response.docInfo[0].metadata["iconcollectionsmall"].values[0]; 384 } else if (!lang.empty() && !response.docInfo[0].metadata["iconcollection:"+lang].values[0].empty()) { 385 iconurl = response.docInfo[0].metadata["iconcollection:"+lang].values[0]; 386 } else if (!response.docInfo[0].metadata["iconcollection"].values[0].empty()) { 387 iconurl = response.docInfo[0].metadata["iconcollection"].values[0]; 388 } 389 390 if (!iconurl.empty()) 391 { 392 // check to see URL is local to colserver 393 text_t::iterator iconurl_head = iconurl.begin(); 394 text_t iconhead = substr(iconurl_head,iconurl_head+16); 395 if (iconhead=="_httpcollection_") 396 { 397 // local and using _httpcollection_ 398 text_t icontail = substr(iconurl_head+16,iconurl.end()); 399 iconurl = "http://" + cinfo->httpdomain 400 + cinfo->httpprefix + "/collect/" 401 + *collist_here + "/" + icontail; 402 } 403 else if (iconurl[0]=='/') 404 { 405 // local but with full path 406 iconurl = "http://" + cinfo->httpdomain + iconurl; 407 } 408 409 collectionname 410 = "<img width=150 border=1 src=\"" + iconurl + "\" alt=\"" + alt + "\">"; 411 } 412 else 413 { 414 collectionname = alt; 415 } 416 370 collectionname 371 = "<img width=150 border=1 src=\"" + iconurl + "\" alt=\"" + alt + "\">"; 372 } else { 373 collectionname = alt; 417 374 } 375 418 376 if ((count%configinfo.HomePageCols == 0) && (!first)) 419 377 homeextra += "</tr><tr valign=top>\n"; … … 426 384 text_t link = "<a href=\"_gwcgi_?"+optsite+"a=p&p=about&c=" + *collist_here + coll_type; 427 385 link += "&l=" + args["l"] + "&w=" + args["w"] + "\">"; 428 386 429 387 if (!cinfo->receptionist.empty()) 430 388 link = "<a href=\"" + cinfo->receptionist + "\">"; … … 453 411 } 454 412 455 void pageaction::set_collectionlist_macro (displayclass &disp, recptprotolistclass *protos, 413 void pageaction::set_collectionlist_macro (displayclass &disp, 414 recptprotolistclass *protos, 415 cgiargsclass &args, 456 416 ostream &logout) { 457 417 … … 522 482 coll_type += "0"; 523 483 } 524 FilterResponse_t response; 525 text_tset metadata; 526 metadata.insert ("collectionname"); 527 text_t collectionname = *collist_here; 528 529 if (get_info ("collection", *collist_here, "", metadata, false, 530 (*rprotolist_here).p, response, logout)) { 531 if (!response.docInfo[0].metadata["collectionname"].values[0].empty()) { 532 collectionname = response.docInfo[0].metadata["collectionname"].values[0]; 533 } 484 text_t collectionname = cinfo->get_collectionmeta("collectionname", args["l"]); 485 if (collectionname.empty()) { 486 collectionname = *collist_here; 534 487 } 535 488 … … 836 789 } 837 790 } 838 791 792 839 793 if (arg_p == "home" || arg_p == "homehelp") { 840 794 if (status_disabled) disp.setmacro ("textgoadmin", "home", ""); … … 845 799 homepagestyle (disp, protos, args, logout); 846 800 } else if (arg_p == "homehelp") { 847 set_collectionlist_macro (disp, protos, logout);801 set_collectionlist_macro (disp, protos, args, logout); 848 802 } 849 803 … … 878 832 text_t colname; 879 833 if (*col_here == arg_c) { 880 colname = cinfo-> collectionmeta["collectionname"];834 colname = cinfo->get_collectionmeta("collectionname", args["l"]); 881 835 } else { 882 836 ColInfoResponse_t *this_cinfo = recpt->get_collectinfo_ptr (collectproto, *col_here, logout); 883 837 if (this_cinfo == NULL) {++col_here; continue;} 884 colname = this_cinfo-> collectionmeta["collectionname"];838 colname = this_cinfo->get_collectionmeta("collectionname", args["l"]); 885 839 } 886 840 if (colname.empty()) { 841 colname = *col_here; 842 } 887 843 ++count; 888 844 collectionoption += "<input type=checkbox name=\"cc\" value=\"" + … … 1003 959 if (*here == arg_c) { 1004 960 if (!first) textsubcollections += "<br>"; 1005 textsubcollections += "\n" + cinfo-> collectionmeta["collectionname"]+ "\n";961 textsubcollections += "\n" + cinfo->get_collectionmeta("collectionname", args["l"]) + "\n"; 1006 962 } else { 1007 963 ColInfoResponse_t *this_cinfo = recpt->get_collectinfo_ptr (collectproto, *here, logout); 1008 964 if (this_cinfo == NULL) {++here; continue;} 1009 965 if (!first) textsubcollections += "<br>"; 1010 textsubcollections += "\n" + this_cinfo-> collectionmeta["collectionname"]+ "\n";966 textsubcollections += "\n" + this_cinfo->get_collectionmeta("collectionname", args["l"]) + "\n"; 1011 967 } 1012 968 ++count; -
trunk/gsdl/src/recpt/pageaction.h
r7762 r9931 48 48 49 49 text_t get_action_name () {return "p";} 50 50 51 51 bool check_cgiargs (cgiargsinfoclass &argsinfo, cgiargsclass &args, 52 52 recptprotolistclass *protos, ostream &logout); … … 80 80 81 81 void set_collectionlist_macro (displayclass &disp, recptprotolistclass *protos, 82 ostream &logout);82 cgiargsclass &args, ostream &logout); 83 83 84 84 void set_documentation_macro (displayclass &disp); -
trunk/gsdl/src/recpt/queryaction.cpp
r9698 r9931 975 975 text_tset::const_iterator t = collections.find (*collist_here); 976 976 if (t != collections.end()) textout << outconvert << " checked"; 977 978 textout << outconvert979 << " name=cc value=\"" << *collist_here << "\">";980 977 981 if (!cinfo->collectionmeta["collectionname"].empty()) 982 textout << outconvert << disp << cinfo->collectionmeta["collectionname"]; 983 else 984 textout << outconvert << *collist_here; 985 986 textout << outconvert << "<br>\n"; 978 text_t collectionname = cinfo->get_collectionmeta("collectionname", args["l"]); 979 if (collectionname.empty()) { 980 collectionname = *collist_here; 981 } 982 textout << outconvert << disp 983 << " name=cc value=\"" << *collist_here << "\">" 984 << collectionname << "<br>\n"; 985 987 986 988 987 } -
trunk/gsdl/src/recpt/receptionist.cpp
r9674 r9931 1396 1396 disp.setmacro ("httpprefix", displayclass::defaultpackage, configinfo.httpprefix); 1397 1397 1398 // get relevant info from the collection1399 if (!collection.empty()) {1400 ColInfoResponse_t cinfo;1401 comerror_t err;1402 recptproto *collectproto = protocols.getrecptproto (collection, logout);1403 if (collectproto != NULL) {1404 collectproto->get_collectinfo (collection, cinfo, err, logout);1405 text_t httpcollection;1406 if (!cinfo.httpdomain.empty()) httpcollection = "http://";1407 httpcollection += cinfo.httpdomain + cinfo.httpprefix + "/collect/"1408 + collection;1409 disp.setmacro ("httpcollection", displayclass::defaultpackage,1410 httpcollection);1411 // as of gsdl 2.53, collect.cfg can specify macros1412 if (cinfo.collection_macros.size() > 0) {1413 macros_map::const_iterator this_macro=cinfo.collection_macros.begin();1414 macros_map::const_iterator done_macro=cinfo.collection_macros.end();1415 while (this_macro != done_macro) {1416 1417 disp.setcollectionmacro("Global", // package1418 this_macro->first, // macro name1419 this_macro->second.first, // params1420 this_macro->second.second); // value1421 ++this_macro;1422 }1423 } // col macros1424 } // collectproto != NULL1425 }1426 1398 1427 1399 text_t compressedoptions = get_compressed_arg(args, logout); … … 1498 1470 if (!lang.empty()) { 1499 1471 if (args["l"]==lang) { 1500 disp.set macro (name, displayclass::defaultpackage, (*here).second.values[0]);1472 disp.setcollectionmacro(displayclass::defaultpackage, name, "", (*here).second.values[0]); 1501 1473 } 1502 1474 } 1503 1475 else { // the default one 1504 disp.set macro ((*here).first, displayclass::defaultpackage, (*here).second.values[0]);1476 disp.setcollectionmacro(displayclass::defaultpackage, (*here).first, "", (*here).second.values[0]); 1505 1477 } 1506 1478 } … … 1525 1497 } 1526 1498 } 1499 1500 if (!collection.empty()) { 1501 ColInfoResponse_t cinfo; 1502 comerror_t err; 1503 recptproto *collectproto = protocols.getrecptproto (collection, logout); 1504 if (collectproto != NULL) { 1505 collectproto->get_collectinfo (collection, cinfo, err, logout); 1506 text_t httpcollection; 1507 if (!cinfo.httpdomain.empty()) httpcollection = "http://"; 1508 httpcollection += cinfo.httpdomain + cinfo.httpprefix + "/collect/" 1509 + collection; 1510 disp.setmacro ("httpcollection", displayclass::defaultpackage, 1511 httpcollection); 1512 // as of gsdl 2.53, collect.cfg can specify macros 1513 if (cinfo.collection_macros.size() > 0) { 1514 macros_map::const_iterator this_macro=cinfo.collection_macros.begin(); 1515 macros_map::const_iterator done_macro=cinfo.collection_macros.end(); 1516 while (this_macro != done_macro) { 1517 1518 disp.setcollectionmacro("Global", // package 1519 this_macro->first, // macro name 1520 this_macro->second.first, // params 1521 this_macro->second.second); // value 1522 ++this_macro; 1523 } 1524 } // col macros 1525 } // collectproto != NULL 1526 } 1527 1527 1528 } 1528 1529 -
trunk/gsdl/src/recpt/statusaction.cpp
r9620 r9931 52 52 } 53 53 54 void statusaction::output_welcome (cgiargsclass & /*args*/, recptprotolistclass *protos,54 void statusaction::output_welcome (cgiargsclass &args, recptprotolistclass *protos, 55 55 displayclass &disp, outconvertclass &outconvert, 56 56 ostream &textout, ostream &logout) { … … 90 90 ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr ((*rprotolist_here).p, *collist_here, logout); 91 91 if (cinfo != NULL) { 92 text_t collname = *collist_here; 93 text_tmap::iterator it = cinfo->collectionmeta.find("collectionname"); 94 if (it != cinfo->collectionmeta.end()) collname = (*it).second; 92 text_t collname = cinfo->get_collectionmeta("collectionname", args["l"]); 93 if (collname.empty()) { 94 collname = *collist_here; 95 } 95 96 96 97 textout << "<td>"; … … 594 595 595 596 textout << "<tr><th valign=top>collection metadata</th><td><table>\n"; 596 text_tmap::iterator meta_here = collectinfo->collectionmeta.begin(); 597 text_tmap::iterator meta_end = collectinfo->collectionmeta.end(); 597 collectionmeta_map::iterator meta_here = collectinfo->collectionmeta.begin(); 598 collectionmeta_map::iterator meta_end = collectinfo->collectionmeta.end(); 599 598 600 while (meta_here != meta_end) { 599 textout << outconvert << "<tr><td>" << (*meta_here).first 600 << "</td><td>" << (*meta_here).second << "</td></tr>\n"; 601 textout << outconvert << "<tr><td valign=top>" << (*meta_here).first 602 << "</td><td><table>" ; 603 text_tmap lang_map = (*meta_here).second; 604 text_tmap::iterator lang_here = lang_map.begin(); 605 text_tmap::iterator lang_end = lang_map.end(); 606 while (lang_here != lang_end) { 607 textout << outconvert << "<tr><td>" << (*lang_here).first 608 << "</td><td>" << (*lang_here).second << "</td></tr>\n"; 609 610 ++lang_here; 611 } 612 textout << outconvert << "</table></td></tr>\n"; 601 613 ++meta_here; 602 614 } … … 607 619 text_tmap::iterator format_end = collectinfo->format.end(); 608 620 while (format_here != format_end) { 609 textout << outconvert << "<tr><td >" << (*format_here).first621 textout << outconvert << "<tr><td valign=top>" << (*format_here).first 610 622 << "</td><td>" << html_safe((*format_here).second) << "</td></tr>\n"; 611 623 ++format_here;
Note:
See TracChangeset
for help on using the changeset viewer.