Changeset 257 for trunk/gsdl/src/recpt/documentaction.cpp
- Timestamp:
- 1999-05-10T15:40:44+12:00 (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/documentaction.cpp
r248 r257 12 12 /* 13 13 $Log$ 14 Revision 1.2 1999/05/10 03:40:35 sjboddie 15 lots of changes - slowly getting document action sorted out 16 14 17 Revision 1.1 1999/04/30 01:59:40 sjboddie 15 18 lots of stuff - getting documentaction working (documentaction replaces … … 34 37 documentaction::documentaction () { 35 38 // this action uses cgi variables "a", "d", "cl", 36 // "x", "gc", and "gt"39 // "x", "gc", "gt", "gp", and "hl" 37 40 cgiarginfo arg_ainfo; 38 41 arg_ainfo.shortname = "a"; … … 71 74 72 75 // in this action "gt" controls the expand/contract 73 // text function 76 // text function 0 = not expanded, 1 = expand unless 77 // there are more than 10 sections containing text, 78 // 2 = expand all 74 79 arg_ainfo.shortname = "gt"; 75 80 arg_ainfo.longname = "expand text"; … … 88 93 arg_ainfo.argdefault = ""; 89 94 arg_ainfo.savedarginfo = cgiarginfo::mustnot; 95 argsinfo.addarginfo (NULL, arg_ainfo); 96 97 // in this action "hl" is the "highlighting on/ 98 // highlighting off control 99 arg_ainfo.shortname = "hl"; 100 arg_ainfo.longname = "highlighting on/off"; 101 arg_ainfo.multiplechar = false; 102 arg_ainfo.defaultstatus = cgiarginfo::weak; 103 arg_ainfo.argdefault = "1"; 104 arg_ainfo.savedarginfo = cgiarginfo::must; 90 105 argsinfo.addarginfo (NULL, arg_ainfo); 91 106 … … 199 214 200 215 metadata.push_back ("Title"); 216 metadata.push_back ("classifytype"); 201 217 get_children ("", args["c"], metadata, collectproto, response, logout); 202 218 … … 236 252 dochere = response.docInfo.begin(); 237 253 while (dochere != docend) { 254 const text_t &title = (*dochere).metadata[0].values[0]; 255 const text_t &classifytype = (*dochere).metadata[1].values[0]; 256 238 257 // if we're inside a document all the classification buttons should be enabled 239 258 if (args["d"].empty() && ((*dochere).OID == topparent)) 240 navigationbar += "_imagespacer__icontab" + (*dochere).metadata[0].values[0]+ "green_";259 navigationbar += "_imagespacer__icontab" + title + "green_"; 241 260 else { 242 navigationbar += "_imagespacer__image" + (*dochere).metadata[0].values[0]+ "_";261 navigationbar += "_imagespacer__image" + title + "_"; 243 262 244 263 // set the _httpbrowseXXX_ macro for this classification 245 disp.setmacro ("httpbrowse" + (*dochere).metadata[0].values[0], 246 "Global", "_httpdocument_&cl=" + (*dochere).OID + ".fc"); 264 text_t link = (*dochere).OID; 265 if (classifytype == "AZList" || classifytype == "Datelist") link += ".fc"; 266 disp.setmacro ("httpbrowse" + title, "Global", 267 "_httpdocument_&cl=" + link); 247 268 } 248 javaimagesnavbar += "_java" + (*dochere).metadata[0].values[0]+ "_";269 javaimagesnavbar += "_java" + title + "_"; 249 270 dochere ++; 250 271 } … … 277 298 278 299 // _httpprevarrow_ these are set if next or previous arrows 279 // _httpnextarrow_ are to be used - (i.e. if it's a 300 // _httpnextarrow_ are to be used - (i.e. if it's an AZList or a Datelist 280 301 // classifytype at a top level or if it's a Book or a 281 302 // Hierarchy classifytype at document level … … 283 304 // _header_ the header macro is overridden if we're not at a top level 284 305 // classification to remove the title block 306 307 // _javaimagescontent_ this is the javascript code to shove in to make the 308 // flashy buttons work 309 285 310 286 311 text_tarray metadata; … … 292 317 if (!args["d"].empty()) { 293 318 // we're at document level 319 text_t javaimagescontent; 294 320 295 321 // get metadata for top level of document 296 text_t doctop = args["d"]; 297 text_t classifytype; 322 text_t doctop; 298 323 get_top (args["d"], doctop); 299 324 if (get_info (doctop, args["c"], metadata, collectproto, response, logout)) { 300 325 disp.setmacro ("header", "document", "_textheader_"); 301 classifytype = response.docInfo[0].metadata[1].values[0];326 text_t &classifytype = response.docInfo[0].metadata[1].values[0]; 302 327 if (classifytype.empty()) classifytype = "Book"; // defaults to Book 303 328 if ((classifytype == "Book") || (classifytype == "Hierarchy")) 304 329 set_arrow_macros (args["d"], classifytype, disp, collectproto, args["c"], logout); 330 331 if (args["u"] != "1") { 332 javaimagescontent += "_javadetach_"; 333 if (args["gt"] == "1") 334 javaimagescontent += "_javacontracttext__javacontinue_"; 335 else 336 javaimagescontent += "_javaexpandtext_"; 337 if (classifytype == "Hierarchy") 338 if (args["gc"] == "1") 339 javaimagescontent += "_javacontractcontents_"; 340 else 341 javaimagescontent += "_javaexpandcontents_"; 342 if (args["hl"] != "1") 343 javaimagescontent += "_javahighlighting_"; 344 else 345 javaimagescontent += "_javanohighlighting_"; 346 disp.setmacro ("javaimagescontent", "document", javaimagescontent); 347 } 305 348 } 306 349 } else { … … 308 351 309 352 // get metadata for top level classification 310 text_t classtop = args["cl"];353 text_t classtop; 311 354 get_top (args["cl"], classtop); 312 355 if (get_info (classtop, args["c"], metadata, collectproto, response, logout)) { 313 356 357 text_t &title = response.docInfo[0].metadata[0].values[0]; 358 text_t &classifytype = response.docInfo[0].metadata[1].values[0]; 359 314 360 disp.setmacro ("imagethispage", "document", 315 "_icon" + response.docInfo[0].metadata[0].values[0]+ "page_");361 "_icon" + title + "page_"); 316 362 317 363 // now get the metadata for each child of top level … … 319 365 // (if they're required by the current classification type) 320 366 321 if ((response.docInfo[0].metadata[1].values[0] == "List") || 322 (response.docInfo[0].metadata[1].values[0] == "Datelist")) { 367 if ((classifytype == "AZList") || (classifytype == "Datelist")) { 323 368 324 369 text_t classificationlinks, navarrows; … … 378 423 text_tarray metadata; 379 424 FilterResponse_t response; 425 DocumentRequest_t docrequest; 426 DocumentResponse_t docresponse; 380 427 text_t topparent, classifytype, classifytitle; 428 comerror_t err; 429 430 text_t &arg_d = args["d"]; 431 text_t &arg_cl = args["cl"]; 432 text_t &collection = args["c"]; 433 434 text_t OID = arg_d; 435 if (arg_d.empty()) OID = arg_cl; 381 436 382 437 textout << outconvert << disp << "_document:header_\n" 383 438 << "_document:content_\n"; 384 439 385 if (args["d"].empty() && args["cl"].empty()) 386 textout << outconvert << "Document contains no data\n"; 387 else { 388 389 if (!args["d"].empty()) get_top (args["d"], topparent); 390 else get_top (args["cl"], topparent); 391 392 // get the classifytitle and classifytype 393 metadata.push_back ("Title"); 394 metadata.push_back ("classifytype"); 395 if (get_info (topparent, args["c"], metadata, collectproto, response, logout)) { 396 classifytitle = response.docInfo[0].metadata[0].values[0]; 397 classifytype = response.docInfo[0].metadata[1].values[0]; 440 if (arg_d.empty() && arg_cl.empty()) { 441 textout << outconvert << "Document contains no data_document:footer_\n"; 442 return true; 443 } 444 445 // get the classifytitle and classifytype 446 get_top (OID, topparent); 447 metadata.push_back ("Title"); 448 metadata.push_back ("classifytype"); 449 if (get_info (topparent, collection, metadata, collectproto, response, logout)) { 450 classifytitle = response.docInfo[0].metadata[0].values[0]; 451 classifytype = response.docInfo[0].metadata[1].values[0]; 452 } 453 454 if (!arg_d.empty()) { 455 456 if (classifytype == "Hierarchy") 457 output_hierarchy_toc (classifytitle, args, collectproto, disp, 458 outconvert, textout, logout); 459 else 460 // Book is the default for a document level toc - AZList and Datelist don't 461 // make sense for document level 462 output_book_toc (classifytitle, args, collectproto, disp, 463 outconvert, textout, logout); 464 } else { 465 466 if (classifytype == "Hierarchy") 467 output_hierarchy_toc (classifytitle, args, collectproto, disp, 468 outconvert, textout, logout); 469 else if (classifytype == "Datelist") 470 output_datelist_toc (classifytitle, args, collectproto, disp, 471 outconvert, textout, logout); 472 else 473 // AZList is the default for a classification level toc - Book doesn't make 474 // sense for classification level 475 output_azlist_toc (classifytitle, args, collectproto, disp, 476 outconvert, textout, logout); 477 } 478 479 // get info on this document 480 metadata.erase (metadata.begin(), metadata.end()); 481 metadata.push_back("Title"); 482 metadata.push_back("hastxt"); 483 metadata.push_back("haschildren"); 484 485 if (get_info (OID, collection, metadata, collectproto, response, logout)) { 486 text_t &title = response.docInfo[0].metadata[0].values[0]; 487 int hastxt = response.docInfo[0].metadata[1].values[0].getint(); 488 int haschildren = response.docInfo[0].metadata[2].values[0].getint(); 489 490 int gt = args.getintarg("gt"); 491 if (gt == 0) { 492 if (hastxt == 1) { 493 // get the text 494 docrequest.OID = OID; 495 collectproto->get_document (collection, docrequest, docresponse, err, logout); 496 497 textout << outconvert << disp 498 << "<p>\n<h3>" << title << "</h3>" << docresponse.doc; 499 } 500 } else { 501 502 // text is to be expanded 503 int tmp; // this doesn't get used here 504 if (!haschildren) 505 OID = get_parent (OID); 506 507 get_contents (OID, classifytype, tmp, collection, collectproto, response, logout); 508 509 ResultDocInfo_tarray::const_iterator sechere = response.docInfo.begin(); 510 ResultDocInfo_tarray::const_iterator secend = response.docInfo.end(); 511 512 if (gt == 1) { 513 // check if there are more than 10 sections containing text to be expanded - 514 // if there are output warning message - this isn't a great way to do this 515 // since the sections may be very large or very small - one day I'll fix it 516 // -- Stefan. 517 int seccount = 0; 518 while (sechere != secend) { 519 if ((*sechere).metadata[3].values[0] == "1") seccount ++; 520 if (seccount > 10) break; 521 sechere ++; 522 } 523 if (seccount > 10) textout << outconvert << disp << "_document:textltwarning_"; 524 else gt = 2; 525 } 526 527 if (gt == 2) { 528 // get the text for each section 529 sechere = response.docInfo.begin(); 530 int count = 0; 531 while (sechere != secend) { 532 textout << outconvert << disp << "\n<p><a name=" << count << "><h3>" 533 << (*sechere).metadata[0].values[0] << "</h3></a>\n"; 534 if ((*sechere).metadata[3].values[0] == "1") { 535 docrequest.OID = (*sechere).OID; 536 collectproto->get_document (collection, docrequest, docresponse, err, logout); 537 textout << outconvert << disp << docresponse.doc; 538 } 539 count ++; 540 sechere ++; 541 } 542 } 398 543 } 399 400 if (!args["d"].empty()) {401 402 if (classifytype == "Hierarchy")403 output_hierarchy_toc (classifytitle, args, collectproto, disp,404 outconvert, textout, logout);405 else406 // Book is the default for a document level toc - List and Datelist don't407 // make sense for document level408 output_book_toc (classifytitle, args, collectproto, disp,409 outconvert, textout, logout);410 } else {411 412 if (classifytype == "Hierarchy")413 output_hierarchy_toc (classifytitle, args, collectproto, disp,414 outconvert, textout, logout);415 else if (classifytype == "Datelist")416 output_datelist_toc (classifytitle, args, collectproto, disp,417 outconvert, textout, logout);418 else419 // List is the default for a classification level toc - Book doesn't make420 // sense for classification level421 output_list_toc (classifytitle, args, collectproto, disp,422 outconvert, textout, logout);423 }424 425 544 } 426 545 textout << outconvert << disp << "_document:footer_\n";
Note:
See TracChangeset
for help on using the changeset viewer.