Changeset 138 for trunk/gsdl/src/library
- Timestamp:
- 1999-02-03T14:13:30+13:00 (25 years ago)
- Location:
- trunk/gsdl/src/library
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/library/libinterface.cpp
r137 r138 12 12 /* 13 13 $Log$ 14 Revision 1.18 1999/02/03 01:13:29 sjboddie 15 16 Got interface to handle subcollections and language subcollections - 17 committed changes made to some of the collections 18 14 19 Revision 1.17 1999/02/02 10:01:11 rjmcnab 15 20 … … 255 260 cfgline.erase(cfgline.begin()); 256 261 if (key == "maintainer") cfg_info.maintainer = cfgline[0]; 257 else if (key == "indexes") cfg_info.indexes = cfgline;262 // else if (key == "indexes") cfg_info.indexes = cfgline; 258 263 else if (key == "defaultindex") cfg_info.defaultindex = cfgline[0]; 259 264 else if (key == "macrofiles") cfg_info.macrofiles = cfgline; 260 265 else if (key == "builddate") cfg_info.builddate = cfgline[0]; 261 266 else if (key == "indexmap") cfg_info.indexmap = cfgline; 267 else if (key == "subcollectionmap") 268 cfg_info.subcollectionmap = cfgline; 269 else if (key == "languagemap") cfg_info.languagemap = cfgline; 262 270 else if (key == "numbytes") cfg_info.numbytes = (double)cfgline[0].getint(); 263 271 else if (key == "numdocs") cfg_info.numdocs = (double)cfgline[0].getint(); … … 318 326 default_index.clear(); 319 327 } else if (cfg_info.defaultindex.empty() || 320 !isrealindex (cfg_info.indexmap, cfg_info.defaultindex)) { 328 !isrealindex (cfg_info.indexmap, cfg_info.subcollectionmap, 329 cfg_info.languagemap, cfg_info.defaultindex)) { 321 330 logout << "warning: the default index has been reset to the first index\n"; 322 getrealdirindex (cfg_info.indexmap[0], cfg_info.defaultindex, default_index); 331 text_t subcollection, language; 332 if (!cfg_info.subcollectionmap.empty()) 333 subcollection = cfg_info.subcollectionmap[0]; 334 if (!cfg_info.languagemap.empty()) 335 language = cfg_info.languagemap[0]; 336 getrealdirindex (cfg_info.indexmap[0], subcollection, 337 language, cfg_info.defaultindex, default_index); 323 338 } else { 324 default_index = real2dirindex (cfg_info.indexmap, cfg_info.defaultindex); 339 default_index = real2dirindex (cfg_info.indexmap, cfg_info.subcollectionmap, 340 cfg_info.languagemap, cfg_info.defaultindex); 325 341 } 326 342 … … 328 344 // retrieving documents). 329 345 text_default_index = default_index; 330 if (!isdoclevelindex (cfg_info.defaultindex)) {331 text_default_index = real2dirindex (cfg_info.indexmap,332 333 }346 //if (!isdoclevelindex (cfg_info.defaultindex)) { 347 // text_default_index = real2dirindex (cfg_info.indexmap, cfg_info.subcollectionmap, 348 // cfg_info.languagemap, getdoclevelindex (cfg_info.indexmap)); 349 //} 334 350 335 351 // load up the default macro files, the collection directory … … 371 387 372 388 parse_cgi_args (argstr, args); 389 373 390 expand_compressed_args (args); 374 391 add_default_args (args); … … 574 591 if (args["p"].empty()) args.setarg("p", cfg_info.defaultpage); 575 592 if (args["w"].empty()) args.setarg("w", cfg_info.defaultencoding); 576 if (args["i"].empty()) args.setarg("i", default_index); 593 594 // override those parts of the index that need it 595 int indexsize = args["i"].size(); 596 if ((indexsize < 3) || (indexsize > 7)) { 597 args["i"] = args["h"] + args["i"] + args["n"]; 598 } else { 599 if (args["h"].size() == 3) { 600 args["i"][0] = args["h"][0]; 601 args["i"][1] = args["h"][1]; 602 args["i"][2] = args["h"][2]; 603 } 604 605 if (args["j"].size() == 2) { 606 if (indexsize >= 5) { 607 args["i"][3] = args["j"][0]; 608 args["i"][4] = args["j"][1]; 609 } else { 610 args["i"] += args["j"]; 611 } 612 } 613 if (args["n"].size() == 2) { 614 if (cfg_info.subcollectionmap.empty()) { 615 if (args["i"].size() >= 5) { 616 args["i"][3] = args["n"][0]; 617 args["i"][4] = args["n"][1]; 618 } else { 619 args["i"] += args["n"]; 620 } 621 } else { 622 if (args["i"].size() == 7) { 623 args["i"][5] = args["n"][0]; 624 args["i"][6] = args["n"][1]; 625 } else { 626 args["i"] += args["n"]; 627 } 628 } 629 } 630 } 631 if ((args["i"].size() < 3) || (args["i"].size() > 7)) 632 args.setarg("i", default_index); 633 577 634 } 578 635 … … 627 684 disp.setmacro("g", "Global", args["g"]); 628 685 629 // set the selection macros 630 631 text_t indexselect; 632 text_t maprealindex, mapdirindex; 633 if (cfg_info.indexmap.size() == 1) { 634 getrealdirindex (cfg_info.indexmap[0], maprealindex, mapdirindex); 635 indexselect += "<input type=hidden name=\"i\" value=\""; 636 indexselect += mapdirindex; 637 indexselect += "\">_query:"; 638 indexselect += real2macroindex (maprealindex); 639 indexselect += "_\n"; 640 641 } else { 642 text_t &arg_i = args["i"]; 643 text_tarray::const_iterator maphere = cfg_info.indexmap.begin(); 644 text_tarray::const_iterator mapend = cfg_info.indexmap.end(); 645 646 indexselect += "<select name=\"i\">\n"; 647 while (maphere != mapend) { 648 getrealdirindex (*maphere, maprealindex, mapdirindex); 649 indexselect += "<option value=\""; 650 indexselect += mapdirindex; 651 indexselect += "\""; 652 if (arg_i == mapdirindex) indexselect += " selected"; 653 indexselect += ">_query:"; 654 indexselect += real2macroindex (maprealindex); 655 indexselect += "_\n"; 656 657 maphere++; 658 } 659 indexselect += "</select>\n"; 660 } 661 662 disp.setmacro("indexselection", "query", indexselect); 686 // set the selection macros 687 688 text_t index, subcollection, language; 689 getdirindexparts (cfg_info.indexmap, cfg_info.subcollectionmap, 690 cfg_info.languagemap, args["i"], index, 691 subcollection, language); 692 693 // main part of index 694 set_selection_macro (cfg_info.indexmap, index, "h"); 695 696 // subcollection part of index 697 if (!cfg_info.subcollectionmap.empty()) 698 set_selection_macro (cfg_info.subcollectionmap, subcollection, "j"); 699 700 // language part of index 701 if (!cfg_info.languagemap.empty()) 702 set_selection_macro (cfg_info.languagemap, language, "n"); 703 663 704 664 705 text_t qtselect; … … 675 716 676 717 disp.setmacro("querytypeselection", "query", qtselect); 718 } 719 720 void libinterface::set_selection_macro (const text_tarray &map, const text_t &indexarg, 721 const text_t &index) { 722 723 text_t maprealindex, mapdirindex, indexselect; 724 725 if (map.size() == 1) { 726 getrealdir (map[0], maprealindex, mapdirindex); 727 indexselect += "<input type=hidden name=\"" + index + "\" value=\""; 728 indexselect += mapdirindex + "\">_query:"; 729 indexselect += real2macroindex (maprealindex); 730 indexselect += "_\n"; 731 732 } else { 733 text_tarray::const_iterator maphere = map.begin(); 734 text_tarray::const_iterator mapend = map.end(); 735 736 indexselect += "<select name=\"" + index +"\">\n"; 737 while (maphere != mapend) { 738 getrealdir (*maphere, maprealindex, mapdirindex); 739 indexselect += "<option value=\""; 740 indexselect += mapdirindex; 741 indexselect += "\""; 742 if (indexarg == mapdirindex) indexselect += " selected"; 743 indexselect += ">_query:"; 744 indexselect += real2macroindex (maprealindex); 745 indexselect += "_\n"; 746 747 maphere++; 748 } 749 indexselect += "</select>\n"; 750 } 751 disp.setmacro(index + "selection", "query", indexselect); 677 752 } 678 753 … … 1216 1291 caseoption += "\n<input type=radio name=k value=1"; 1217 1292 if (arg_k) caseoption += " checked"; 1218 caseoption += "> ignore case differences<br>\n";1293 caseoption += ">_textignorecase_<br>\n"; 1219 1294 caseoption += "<input type=radio name=k value=0"; 1220 1295 if (!arg_k) caseoption += " checked"; 1221 caseoption += "> upper/lower case must match\n";1296 caseoption += ">_textmatchcase_\n"; 1222 1297 1223 1298 disp.setmacro ("caseoption", "preferences", caseoption); … … 1229 1304 stemoption += "\n<input type=radio name=s value=1"; 1230 1305 if (arg_s) stemoption += " checked"; 1231 stemoption += "> ignore word endings<br>\n";1306 stemoption += ">_textstem_<br>\n"; 1232 1307 stemoption += "<input type=radio name=s value=0"; 1233 1308 if (!arg_s) stemoption += " checked"; 1234 stemoption += "> whole word must match\n";1309 stemoption += ">_textnostem_\n"; 1235 1310 1236 1311 disp.setmacro ("stemoption", "preferences", stemoption); -
trunk/gsdl/src/library/libinterface.h
r137 r138 55 55 56 56 text_t maintainer; 57 text_tarray indexes;57 // text_tarray indexes; 58 58 text_t defaultindex; 59 59 text_tarray macrofiles; 60 60 text_t builddate; 61 61 text_tarray indexmap; 62 text_tarray subcollectionmap; 63 text_tarray languagemap; 62 64 double numbytes; 63 65 double numdocs; … … 156 158 virtual void define_general_macros (cgiargsclass &args, outconvertclass &outconvert, 157 159 ostream &logout); 160 161 virtual void set_selection_macro (const text_tarray &map, const text_t &indexarg, 162 const text_t &index); 163 158 164 virtual void prepare_page (cgiargsclass &args, outconvertclass &outconvert, 159 165 ostream &logout);
Note:
See TracChangeset
for help on using the changeset viewer.