Changeset 13967
- Timestamp:
- 2007-03-12T16:14:41+13:00 (17 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/documentaction.cpp
r12943 r13967 987 987 ostream &logout) 988 988 { 989 if ((args["book"] == "flashxml") && (!args["d"].empty())) 990 { 991 return do_action_flashxml(args,protos,browsers,disp,outconvert,textout,logout); 992 } 993 else if ((args["book"] == "on") && (!args["d"].empty())) 994 { 995 return do_action_book(args,protos,browsers,disp,outconvert,textout,logout); 996 } 997 else 998 { 999 return do_action_html(args,protos,browsers,disp,outconvert,textout,logout); 1000 } 1001 1002 } 1003 1004 //displaying the normal display when bookswitch=0(html) 1005 bool documentaction::do_action_html(cgiargsclass &args, recptprotolistclass *protos, 1006 browsermapclass *browsers, displayclass &disp, 1007 outconvertclass &outconvert, ostream &textout, 1008 ostream &logout) 1009 { 989 1010 // must have a valid collection server 990 1011 recptproto *collectproto = protos->getrecptproto (args["c"], logout); … … 1057 1078 } 1058 1079 1080 //displaying the book display when bookswitch=on 1081 bool documentaction::do_action_book(cgiargsclass &args, recptprotolistclass *protos, 1082 browsermapclass *browsers, displayclass &disp, 1083 outconvertclass &outconvert, ostream &textout, 1084 ostream &logout) 1085 { 1086 // must have a valid collection server 1087 recptproto *collectproto = protos->getrecptproto (args["c"], logout); 1088 if (collectproto == NULL) 1089 { 1090 logout << "documentaction::do_action called with NULL collectproto\n"; 1091 textout << outconvert << disp << "_document:header_\n" 1092 << "Error: Attempt to get document without setting collection\n"; 1093 } 1094 else 1095 { 1096 text_t OID = args["d"]; 1097 if (OID.empty()) OID = args["cl"]; 1098 if (OID.empty()) 1099 { 1100 textout << outconvert << disp << "Document contains no data\n"; 1101 return true; 1102 } 1103 1104 if (formatinfo.DocumentUseHTML && !args["d"].empty()) 1105 { 1106 if (args["f"] == "1") 1107 { 1108 textout << outconvert << disp 1109 << "<html><head></head>\n" 1110 << "<frameset rows=\"68,*\" noresize border=0>\n" 1111 << "<frame scrolling=no frameborder=0 src=\"_gwcgi_?_optsite_e=_compressedoptions_&a=p&p=nav\">\n" 1112 #ifndef DOCHANDLE 1113 << "<frame name=\"documenttop\" frameborder=0 src=\"_gwcgi_?_optsite_e=_compressedoptions_&a=d&d=" 1114 << args["d"] << "\">" 1115 #else 1116 << "<frame name=\"documenttop\" frameborder=0 src=\"_httpdocumenthandle_(" 1117 << args["c"] << "," << args["d"] << ")\">" 1118 #endif 1119 << "<noframes>\n" 1120 << "<p>You must have a frame enabled browser to view this.</p>\n" 1121 << "</noframes>\n" 1122 << "</frameset>\n" 1123 << "</html>\n"; 1124 } 1125 else 1126 { 1127 output_document (OID, args, collectproto, browsers, disp, outconvert, textout, logout); 1128 } 1129 1130 return true; 1131 } 1132 1133 1134 //the header bit and the navigation button 1135 textout << outconvert << disp << "_document:header_\n" << "_document:content_\n"; 1136 1137 //display the book 1138 textout << outconvert << disp << "_document:flashbook_\n"; 1139 1140 //the footer bit without the document arrow 1141 textout << outconvert << disp << "</div> <!-- id=document -->\n"; 1142 textout << outconvert << disp << "_endspacer__htmlfooter_\n"; 1143 } 1144 1145 return true; 1146 } 1147 1148 //Displaying the xml when bookswitch=flashxml 1149 bool documentaction::do_action_flashxml(cgiargsclass &args, recptprotolistclass *protos, 1150 browsermapclass *browsers, displayclass &disp, 1151 outconvertclass &outconvert, ostream &textout, 1152 ostream &logout) 1153 { 1154 // must have a valid collection server 1155 recptproto *collectproto = protos->getrecptproto (args["c"], logout); 1156 if (collectproto == NULL) 1157 { 1158 logout << "documentaction::do_action called with NULL collectproto\n"; 1159 textout << outconvert << disp 1160 << "<Message>\n" 1161 << " Error: Attempt to get document without setting collection\n" 1162 << "</Message>\n"; 1163 } 1164 else 1165 { 1166 text_t OID = args["d"]; 1167 if (OID.empty()) OID = args["cl"]; 1168 if (OID.empty()) 1169 { 1170 textout << outconvert << disp 1171 << "<Message>\n" 1172 << " Document contains no data\n" 1173 << "</Message>\n"; 1174 return true; 1175 } 1176 1177 if (formatinfo.DocumentUseHTML && !args["d"].empty()) 1178 { 1179 if (args["f"] == "1") 1180 { 1181 textout << outconvert << disp 1182 << "<Message>\n" 1183 << " Using frames makes no sense for XML output\n" 1184 << "</Message>\n"; 1185 } 1186 else 1187 { 1188 output_document_flashxml (OID, args, collectproto, browsers, disp, outconvert, textout, logout); 1189 } 1190 1191 return true; 1192 } 1193 1194 // output the document text 1195 if (!args["d"].empty()) 1196 { 1197 output_document_flashxml (OID, args, collectproto, browsers, disp, outconvert, textout, logout); 1198 } 1199 } 1200 1201 return true; 1202 } 1203 1204 1205 1059 1206 void documentaction::output_text (ResultDocInfo_t &docinfo, format_t *formatlistptr, 1060 1207 const TermInfo_tarray &terminfo, const text_t &OID, … … 1244 1391 textout << outconvert << "</div>\n"; 1245 1392 delete formatlistptr; 1393 } 1394 1395 void documentaction::output_document_flashxml(const text_t &OID, cgiargsclass &args, 1396 recptproto *collectproto, browsermapclass *browsermap, 1397 displayclass &disp, outconvertclass &outconvert, 1398 ostream &textout, ostream &logout) { 1399 //if this is not at the document level --> do Nothing!! 1400 if (args["d"].empty()) 1401 return; 1402 1403 //if we have a query string and highlighting is turned on we need 1404 //to redo the query to get the terms for highlighting 1405 FilterResponse_t queryresponse; 1406 bool highlight = false; 1407 if (!args["q"].empty() && args.getintarg("hl")) 1408 { 1409 text_t &collection = args["c"]; 1410 ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr (collectproto, collection, logout); 1411 bool segment = false; 1412 if (cinfo != NULL) 1413 { 1414 segment = cinfo->isSegmented; 1415 } 1416 FilterRequest_t request; 1417 comerror_t err; 1418 request.filterResultOptions = FRmatchTerms; 1419 text_t formattedstring = args["q"]; 1420 format_querystring (formattedstring, args.getintarg("b"), segment); 1421 set_queryfilter_options (request, formattedstring, args); 1422 args["q"] = formattedstring; //need to set this here for phrase 1423 //highlighting, where we look at the querystring 1424 collectproto->filter (args["c"], request, queryresponse, err, logout); 1425 if (err != noError) 1426 { 1427 outconvertclass text_t2ascii; 1428 logout << text_t2ascii 1429 << "documentaction::output_document: call to QueryFilter failed " 1430 << "for " << args["c"] << " collection (" << get_comerror_string (err) << ")\n"; 1431 highlight = false; 1432 } 1433 else 1434 { 1435 highlight = true; 1436 } 1437 } 1438 1439 FilterResponse_t response; 1440 bool getParents = false; 1441 text_tset metadata; 1442 text_t classifytype, classification, formatstring; 1443 1444 //metadata elements needed by recurse_contents 1445 metadata.insert ("Title"); 1446 metadata.insert ("haschildren"); 1447 1448 //protocol call 1449 if (!get_info (OID, args["c"], args["l"], metadata, getParents, collectproto, response, logout)) 1450 return; 1451 1452 recurse_contents (response.docInfo[0], args, metadata, 1453 getParents, collectproto, disp, outconvert, textout, logout, highlight, queryresponse.termInfo); 1454 } 1455 1456 void documentaction::recurse_contents(ResultDocInfo_t §ion, cgiargsclass &args, 1457 text_tset &metadata, bool &getParents, 1458 recptproto *collectproto, displayclass &disp, 1459 outconvertclass &outconvert, ostream &textout, ostream &logout, 1460 bool highlight, const TermInfo_tarray &terminfo) 1461 { 1462 text_t formatstring; 1463 1464 bool is_classify = false; 1465 1466 //output this section 1467 text_t classification = "Document"; 1468 1469 textout << outconvert << disp << "<Section>\n"; 1470 1471 //get the title 1472 textout << outconvert << disp << "<Description>\n<Metadata name=\"Title\">"; 1473 text_t t_title = section.metadata["Title"].values[0]; 1474 //if it is highlighted 1475 /*if (highlight == true) 1476 { 1477 highlighttext(t_title, args, terminfo, disp, outconvert, textout); 1478 } 1479 else 1480 {*/ 1481 textout << outconvert << disp << t_title; 1482 //} 1483 textout << outconvert << disp << "</Metadata>\n</Description>\n"; 1484 1485 //get the text 1486 DocumentRequest_t docrequest; 1487 DocumentResponse_t docresponse; 1488 comerror_t err; 1489 docrequest.OID = section.OID; 1490 text_t &collection = args["c"]; 1491 collectproto->get_document(collection, docrequest, docresponse, err, logout); 1492 //if it is highlighted 1493 if (highlight == true) 1494 { 1495 highlighttext(docresponse.doc, args, terminfo, disp, outconvert, textout); 1496 } 1497 else 1498 { 1499 textout << outconvert << disp << docresponse.doc; 1500 } 1501 textout << outconvert << disp << "\n"; 1502 1503 int haschildren = section.metadata["haschildren"].values[0].getint(); 1504 1505 // recurse through children 1506 if (haschildren == 1) 1507 { 1508 FilterResponse_t tmp; 1509 get_children (section.OID, args["c"], args["l"], metadata, getParents, collectproto, tmp, logout); 1510 ResultDocInfo_tarray::iterator thisdoc = tmp.docInfo.begin(); 1511 ResultDocInfo_tarray::iterator lastdoc = tmp.docInfo.end(); 1512 1513 while (thisdoc != lastdoc) 1514 { 1515 recurse_contents (*thisdoc, args, metadata, getParents, collectproto, disp, outconvert, textout, logout, highlight, terminfo); 1516 ++thisdoc; 1517 } 1518 } 1519 1520 textout << outconvert << disp << "</Section>\n"; 1246 1521 } 1247 1522 -
trunk/gsdl/src/recpt/documentaction.h
r4936 r13967 40 40 receptionist *recpt; 41 41 42 formatinfo_t formatinfo; 43 typedef map<text_t, format_t*, lttext_t> format_tmap; 44 42 45 bool get_link (cgiargsclass &args, recptprotolistclass *protos, 43 46 const text_t &inlink, text_t &outlink, ostream &logout); … … 65 68 ostream &textout, ostream &logout); 66 69 70 71 virtual void output_document_flashxml (const text_t &OID, cgiargsclass &args, 72 recptproto *collectproto, browsermapclass *browsers, 73 displayclass &disp, outconvertclass &outconvert, 74 ostream &textout, ostream &logout); 75 76 virtual void recurse_contents(ResultDocInfo_t §ion, cgiargsclass &args, 77 text_tset &metadata, bool &getParents, 78 recptproto *collectproto, displayclass &disp, 79 outconvertclass &outconvert, ostream &textout, ostream &logout, 80 bool highlight, const TermInfo_tarray &terminfo); 81 67 82 void set_arrow_macros (cgiargsclass &args, recptproto *collectproto, 68 83 displayclass &disp, ostream &logout); 69 70 formatinfo_t formatinfo;71 84 72 85 public: … … 96 109 ostream &logout); 97 110 111 bool do_action_html(cgiargsclass &args, recptprotolistclass *protos, 112 browsermapclass *browsers, displayclass &disp, 113 outconvertclass &outconvert, ostream &textout, 114 ostream &logout); 115 116 bool do_action_flashxml(cgiargsclass &args, recptprotolistclass *protos, 117 browsermapclass *browsers, displayclass &disp, 118 outconvertclass &outconvert, ostream &textout, 119 ostream &logout); 120 121 bool do_action_book(cgiargsclass &args, recptprotolistclass *protos, 122 browsermapclass *browsers, displayclass &disp, 123 outconvertclass &outconvert, ostream &textout, 124 ostream &logout); 98 125 }; 99 126 -
trunk/gsdl/src/recpt/pageaction.cpp
r13966 r13967 94 94 arg_ainfo.savedarginfo = cgiarginfo::mustnot; 95 95 argsinfo.addarginfo (NULL, arg_ainfo); 96 97 arg_ainfo.shortname = "book"; 98 arg_ainfo.longname = "book switch"; 99 arg_ainfo.multiplechar = true; 100 arg_ainfo.defaultstatus = cgiarginfo::weak; 101 arg_ainfo.argdefault = "off"; 102 arg_ainfo.savedarginfo = cgiarginfo::must; 103 argsinfo.addarginfo (NULL, arg_ainfo); 104 96 105 } 97 106
Note:
See TracChangeset
for help on using the changeset viewer.