Changeset 911 for trunk/cstr
- Timestamp:
- 2000-02-07T10:27:04+13:00 (24 years ago)
- Location:
- trunk/cstr
- Files:
-
- 2 added
- 4 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cstr/perllib/classify/CSTRList.pm
r891 r911 80 80 81 81 # organise into classification structure 82 my %classifyinfo = ('classifytype'=>'List', 82 my %classifyinfo = ('thistype'=>'Invisible', 83 'childtype'=>'VList', 83 84 'Title'=>'Browse', 84 85 'contains'=>[]); -
trunk/cstr/src/recpt/Makefile.in
r891 r911 64 64 65 65 66 HEADERS = cstrbrowsetools.h cstrdocaction.h cstrqueryaction.h \ 67 cstrquerytools.h 66 HEADERS = cstrdocaction.h cstrbrowsetools.h cstrpagedbrowserclass.h 68 67 69 SOURCES = cstrlibrarymain.cpp cstr browsetools.cpp cstrdocaction.cpp \70 cstr queryaction.cpp cstrquerytools.cpp68 SOURCES = cstrlibrarymain.cpp cstrdocaction.cpp cstrbrowsetools.cpp \ 69 cstrpagedbrowserclass.cpp 71 70 72 71 73 OBJECTS = cstrlibrarymain.o cstr browsetools.o cstrdocaction.o \74 cstr queryaction.o cstrquerytools.o72 OBJECTS = cstrlibrarymain.o cstrdocaction.o cstrbrowsetools.o \ 73 cstrpagedbrowserclass.o 75 74 76 75 … … 79 78 all : $(EXEC) 80 79 81 install: $(EXEC)82 cp $(EXEC) /home/nzdl/nzdl-1.2/cgi-bin;83 # strip /home/httpd/cgi-bin/$(EXEC)80 install: 81 cp $(EXEC) $(GD)/fast-cgi-bin/$(EXEC); \ 82 strip $(GD)/fast-cgi-bin/$(EXEC) 84 83 85 84 clean: … … 94 93 95 94 CSTRLIBRARY_OBJS = $(OBJECTS) \ 95 $(MAINRECPTDIR)/querytools.o \ 96 $(MAINRECPTDIR)/browsetools.o \ 97 $(MAINRECPTDIR)/browserclass.o \ 98 $(MAINRECPTDIR)/vlistbrowserclass.o \ 99 $(MAINRECPTDIR)/hlistbrowserclass.o \ 100 $(MAINRECPTDIR)/datelistbrowserclass.o \ 101 $(MAINRECPTDIR)/invbrowserclass.o \ 102 $(MAINRECPTDIR)/pagedbrowserclass.o \ 103 $(MAINRECPTDIR)/htmlbrowserclass.o \ 96 104 $(MAINRECPTDIR)/receptionist.o \ 97 105 $(MAINRECPTDIR)/recptconfig.o \ -
trunk/cstr/src/recpt/cstrbrowsetools.cpp
r891 r911 26 26 *********************************************************************/ 27 27 28 /*29 $Log$30 Revision 1.1 2000/02/01 22:32:37 sjboddie31 Initial revision32 33 Revision 1.1 1999/09/07 21:49:41 sjboddie34 new cstr receptionist35 36 */37 38 39 28 #include "cstrbrowsetools.h" 40 29 #include "OIDtools.h" 41 30 #include "cgiutils.h" 42 43 // simply checks to see if formatstring begins with a <td> tag 44 static bool is_table_content (const text_t &formatstring) { 45 text_t::const_iterator here = formatstring.begin(); 46 text_t::const_iterator end = formatstring.end(); 47 48 while (here != end) { 49 if (*here != ' ') { 50 if (*here == '<') { 51 if ((*(here+1) == 't' || *(here+1) == 'T') && 52 (*(here+2) == 'd' || *(here+2) == 'D') && 53 (*(here+3) == '>' || *(here+3) == ' ')) 54 return true; 55 } else return false; 56 } 57 here ++; 58 } 59 return false; 60 } 61 62 static bool is_table_content (const format_t *formatlistptr) { 63 64 if (formatlistptr == NULL) return false; 65 66 if (formatlistptr->command == comText) 67 return is_table_content (formatlistptr->text); 68 69 return false; 70 } 71 72 73 // output_controls displays the detach, expand/contract contents, 74 // expand/contract text and highlighting/no highlighting buttons 75 static void output_controls (cgiargsclass &args, const text_tarray &ibuttons, 76 recptproto */*collectproto*/, displayclass &disp, 77 outconvertclass &outconvert, ostream &textout, 78 ostream &/*logout*/) { 79 80 if (args["u"] != "1") { 81 82 FilterResponse_t response; 83 text_tset metadata; 84 text_tarray buttons; 85 86 text_t &arg_gg = args["gg"]; 87 88 text_tarray::const_iterator here = ibuttons.begin(); 89 text_tarray::const_iterator end = ibuttons.end(); 90 91 while (here != end) { 92 93 if (*here == "Detach") 94 buttons.push_back ("_document:imagedetach_"); 95 else if (*here == "Highlight" && arg_gg == "text") { 96 if (args["hl"] == "1") 97 buttons.push_back ("_document:imagenohighlight_"); 98 else 99 buttons.push_back ("_document:imagehighlight_"); 100 // } else if (*here == "Expand Contents") { 101 // if (args["gc"] == "1") 102 // buttons.push_back ("_document:imagecontracttoc_"); 103 // else 104 // buttons.push_back ("_document:imageexpandtoc_"); 105 } else if (*here == "Expand Text" && arg_gg == "text") { 106 if (args.getintarg("gt")) 107 buttons.push_back ("_document:imagecontracttext_"); 108 else 109 buttons.push_back ("_document:imageexpandtext_"); 110 } 111 here ++; 112 } 113 114 here = buttons.begin(); 115 end = buttons.end(); 116 int count = 0; 117 while (here != end) { 118 if ((count != 0) && ((count % 3) == 0)) textout << "<br>\n"; 119 textout << outconvert << disp << *here; 120 count ++; 121 here ++; 122 } 123 } 124 } 125 31 #include "browsetools.h" 32 33 34 35 // outputs the postscript, abstract, figures etc buttons 126 36 static void output_cstr_controls (cgiargsclass &args, const text_t &source, 127 37 const text_t &description, const text_t &figures, … … 156 66 } 157 67 158 /*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 159 Functions for generating a document type tables of contents. These aren't really tables of 160 contents at all, just a title, some navigation buttons and arrows and maybe a page ? of ? 161 type thing. These should only be called for document level tocs (i.e. when the "d" argument 162 is set) as I don't think it makes sense to display top level classifications in this way. 163 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ 164 165 void output_document_toc (cgiargsclass &args, const formatinfo_t &formatinfo, 166 recptproto *collectproto, displayclass &disp, 167 outconvertclass &outconvert, ostream &textout, 168 ostream &logout) { 169 68 69 70 void output_cstr_toc (cgiargsclass &args, browsermapclass *browsermap, 71 formatinfo_t &formatinfo, recptproto *collectproto, 72 displayclass &disp, outconvertclass &outconvert, 73 ostream &textout, ostream &logout) { 74 75 int tabcount = 0; 76 bool havecontrols = false; 77 bool fulltoc = false; 78 79 80 if (args["cl"] != "search") { 81 // see if there's a FullTOC string 82 text_t cl_top, full_toc; 83 get_top (args["cl"], cl_top); 84 if (get_formatstring (cl_top, "FullTOC", formatinfo.formatstrings, full_toc)) 85 if (full_toc == "true") fulltoc = true; 86 } 170 87 text_t &arg_d = args["d"]; 171 if (arg_d.empty()) return; 172 173 text_tset metadata; 174 FilterResponse_t response; 175 ResultDocInfo_t docinfo; 176 text_t booktop, facsimiles, figures, description, source, summary; 177 text_t &collection = args["c"]; 178 179 metadata.insert ("Title"); 180 if (get_info (arg_d, collection, metadata, false, collectproto, response, logout)) { 181 182 metadata.erase (metadata.begin(), metadata.end()); 183 docinfo = response.docInfo[0]; 184 185 textout 186 << "\n<!-- Table of Contents produced by cstrbrowsetools::output_document_toc -->\n\n"; 187 188 // get title and author of book 189 get_top (arg_d, booktop); 190 metadata.insert ("facsimiles"); 191 metadata.insert ("figures"); 192 metadata.insert ("Description"); 193 metadata.insert ("Source"); 194 metadata.insert ("Summary"); 195 get_info (booktop, collection, metadata, false, collectproto, response, logout); 196 facsimiles = response.docInfo[0].metadata[0].values[0]; 197 figures = response.docInfo[0].metadata[1].values[0]; 198 description = response.docInfo[0].metadata[2].values[0]; 199 source = response.docInfo[0].metadata[3].values[0]; 200 summary = response.docInfo[0].metadata[4].values[0]; 201 202 metadata.erase (metadata.begin(), metadata.end()); 88 // get the facsimile image (if there is one) and the control buttons 89 // if we're inside a book 90 if ((!fulltoc) && (!arg_d.empty())) { 91 92 // this code from old cstr browsetools outputdocument_toc 93 text_tset metadata; 94 FilterResponse_t response; 95 ResultDocInfo_t docinfo; 96 text_t booktop, facsimiles, figures, description, source, summary; 97 text_t &collection = args["c"]; 98 99 metadata.insert ("Title"); 100 if (get_info (arg_d, collection, metadata, false, collectproto, response, logout)) { 101 102 metadata.erase (metadata.begin(), metadata.end()); 103 docinfo = response.docInfo[0]; 104 105 textout 106 << "\n<!-- Table of Contents produced by cstrbrowsetools::output_document_toc -->\n\n"; 107 108 // get title and author of book 109 get_top (arg_d, booktop); 110 metadata.insert ("facsimiles"); 111 metadata.insert ("figures"); 112 metadata.insert ("Description"); 113 metadata.insert ("Source"); 114 metadata.insert ("Summary"); 115 get_info (booktop, collection, metadata, false, collectproto, response, logout); 116 facsimiles = response.docInfo[0].metadata["facsimiles"].values[0]; 117 figures = response.docInfo[0].metadata["figures"].values[0]; 118 description = response.docInfo[0].metadata["Description"].values[0]; 119 source = response.docInfo[0].metadata["Source"].values[0]; 120 summary = response.docInfo[0].metadata["Summary"].values[0]; 121 122 metadata.erase (metadata.begin(), metadata.end()); 203 123 204 textout << outconvert << disp 205 << "<p><center>\n" 206 << "<table cellpadding=0 cellspacing=0 width=_pagewidth_>\n" 207 << "<tr valign=top><td>\n"; 208 209 // don't want arrows and page number if text expanded 210 if (formatinfo.DocumentArrowsBottom && !args.getintarg ("gt")) { 124 textout << outconvert << disp 125 << "<p><center>\n" 126 << "<table cellpadding=0 cellspacing=0 width=_pagewidth_>\n" 127 << "<tr valign=top><td>\n"; 128 129 /* 130 // don't want arrows and page number if text expanded 131 if (formatinfo.DocumentArrowsBottom && !args.getintarg ("gt")) { 211 132 212 213 214 133 // previous arrow 134 textout << outconvert << disp << "<table><tr valign=top>\n" 135 << "<td align=left>_document:prevarrow_</td>\n"; 215 136 216 // page ? of ? text 217 textout << "<td align=center>\n"; 218 219 if (is_number (docinfo.metadata[0].values[0])) { 220 text_t doctop; 221 metadata.insert ("Title"); 222 get_top (arg_d, doctop); 223 // get title of last sibling 224 if (get_info (doctop + ".lc", collection, metadata, false, collectproto, response, logout)) { 225 if (is_number (response.docInfo[0].metadata[0].values[0])) { 226 textout << outconvert << disp << "_document:page_" << docinfo.metadata[0].values[0] 227 << "_document:of_" << response.docInfo[0].metadata[0].values[0]; 228 } else { 229 textout << outconvert << docinfo.metadata[0].values[0]; 137 // page ? of ? text 138 textout << "<td align=center>\n"; 139 140 if (is_number (docinfo.metadata["Title"].values[0])) { 141 text_t doctop; 142 metadata.insert ("Title"); 143 get_top (arg_d, doctop); 144 // get title of last sibling 145 if (get_info (doctop + ".lc", collection, metadata, false, collectproto, response, logout)) { 146 if (is_number (response.docInfo[0].metadata["Title"].values[0])) { 147 textout << outconvert << disp << "_document:page_" << docinfo.metadata["Title"].values[0] 148 << "_document:of_" << response.docInfo[0].metadata["Title"].values[0]; 149 } else { 150 textout << outconvert << docinfo.metadata["Title"].values[0]; 151 } 230 152 } 231 } 232 } else { 233 textout << outconvert << docinfo.metadata[0].values[0]; 153 } else { 154 textout << outconvert << docinfo.metadata["Title"].values[0]; 234 155 } 235 156 236 // next arrow 237 textout << outconvert << disp << "</td>\n<td align=right>_document:nextarrow_</td>\n</table>\n"; 157 // next arrow 158 textout << outconvert << disp << "</td>\n<td align=right>_document:nextarrow_</td>\n</table>\n"; 159 } 160 161 // goto line ****** ???????????? 162 //if (formatinfo.DocumentGoTo) 163 textout << outconvert << disp << "_document:gotoform_"; 164 */ 165 166 //if (formatinfo.DocumentArrowsBottom && !args.getintarg ("gt")) { 167 if (args.getintarg("gc") == 1) { 168 169 // expanded table of contents 170 expanded_contents (args, tabcount, fulltoc, browsermap, formatinfo, 171 collectproto, disp, outconvert, textout, logout); 172 } else { 173 174 // contracted table of contents 175 contracted_contents (args, tabcount, fulltoc, browsermap, formatinfo, 176 collectproto, disp, outconvert, textout, logout); 177 } 178 // } 179 // control buttons 180 output_controls (args, formatinfo.DocumentButtons, collectproto, 181 disp, outconvert, textout, logout); 182 textout << "</td><td valign=top>\n"; 183 184 if (!summary.empty()) 185 textout << outconvert << summary << "\n"; 186 187 output_cstr_controls (args, source, description, figures, 188 disp, outconvert, textout); 189 190 textout << "</td>\n"; 191 192 // facsimile image 193 // only want the first facsimile (some documents have two) 194 if (!facsimiles.empty()) { 195 text_t::const_iterator fbegin = facsimiles.begin(); 196 facsimiles = substr (fbegin, findchar (fbegin, facsimiles.end(), ',')); 197 textout << outconvert << disp << "<td valign=top><a href=\"_httpcurrentdocument_&gg=facsimiles\">" 198 << "<img src=\"_httpcollimg_/_thisOID_/" 199 << facsimiles << "\" width=150 height=250></a>" << "</td>\n"; 200 } 201 202 203 textout << "</td></tr></table></center>\n"; 204 textout << "\n<!-- end of Table of Contents -->\n"; 205 238 206 } 239 207 240 // goto line ****** ???????????? 241 //if (formatinfo.DocumentGoTo) 242 // textout << outconvert << disp << "_document:gotoform_"; 243 244 // control buttons 245 output_controls (args, formatinfo.DocumentButtons, collectproto, 246 disp, outconvert, textout, logout); 208 /* textout << "<p><table cellpadding=0 cellspacing=0><tr>\n"; 209 textout << "<td valign=top"; 210 if (formatinfo.DocumentContents) textout << " width=200>\n"; 211 else textout << " width=100%>\n"; 212 if (formatinfo.DocumentImages) 213 output_cover_image (args, collectproto, disp, outconvert, textout, logout); 214 else if (formatinfo.DocumentTitles) 215 output_titles (args, collectproto, formatinfo, disp, outconvert, textout, logout); 216 output_controls (args, formatinfo.DocumentButtons, collectproto, disp, 217 outconvert, textout, logout); 247 218 textout << "</td><td valign=top>\n"; 248 249 if (!summary.empty()) 250 textout << outconvert << summary << "\n"; 251 252 output_cstr_controls (args, source, description, figures, 253 disp, outconvert, textout); 254 255 textout << "</td>\n"; 256 257 // facsimile image 258 // only want the first facsimile (some documents have two) 259 if (!facsimiles.empty()) { 260 text_t::const_iterator fbegin = facsimiles.begin(); 261 facsimiles = substr (fbegin, findchar (fbegin, facsimiles.end(), ',')); 262 textout << outconvert << disp << "<td valign=top><a href=\"_httpcurrentdocument_&gg=facsimiles\">" 263 << "<img src=\"_httpcollection_/archives/_thisOID_/" 264 << facsimiles << "\" width=150 height=250></a>" << "</td>\n"; 219 havecontrols = true; */ 220 } 221 /* 222 if (formatinfo.DocumentContents || args["d"].empty()) { 223 if (args.getintarg("gc") == 1) { 224 225 // expanded table of contents 226 expanded_contents (args, tabcount, fulltoc, browsermap, formatinfo, 227 collectproto, disp, outconvert, textout, logout); 228 } else { 229 230 // contracted table of contents 231 contracted_contents (args, tabcount, fulltoc, browsermap, formatinfo, 232 collectproto, disp, outconvert, textout, logout); 265 233 } 266 267 268 textout << "</td></tr></table></center>\n"; 269 textout << "\n<!-- end of Table of Contents -->\n"; 270 271 } 234 } 235 */ 236 if (havecontrols) textout << "</td></tr></table>\n"; 272 237 } 273 238 274 239 275 /*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 276 Functions for generating a "Hierarchy" type table of contents. These can be used either 277 at top classification level or at document level (the difference being that a cover 278 image and control buttons may be displayed at document level). 279 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ 280 281 // prototypes 282 283 static void output_contracted_hierarchy_toc (const text_t &classifytype, text_t &formatstring, 284 cgiargsclass &args, recptproto *collectproto, 285 displayclass &disp, outconvertclass &outconvert, 286 ostream &textout, ostream &logout); 287 288 static void output_expanded_hierarchy_toc (cgiargsclass &args, recptproto *collectproto, 289 displayclass &disp, outconvertclass &outconvert, 290 ostream &textout, ostream &logout); 291 292 static void output_parents_toc (cgiargsclass &args, const FilterResponse_t &parents, 293 int &tabcount, displayclass &disp, 294 format_t *formatlistptr, outconvertclass &outconvert, 295 ostream &textout, ostream &logout); 296 297 static void output_siblings_toc (const text_t &classifytype, cgiargsclass &args, 298 const FilterResponse_t &siblings, int &tabcount, 299 displayclass &disp, format_t *formatlistptr, 300 outconvertclass &outconvert, ostream &textout, 301 ostream &logout); 302 303 static void output_stdlist (cgiargsclass &args, ResultDocInfo_tarray::iterator &here, 304 ResultDocInfo_tarray::iterator &end, bool intable, 305 displayclass &disp, format_t *formatlistptr, 306 outconvertclass &outconvert, ostream &textout); 307 308 static void output_datelist (cgiargsclass &args, ResultDocInfo_tarray::iterator &here, 309 ResultDocInfo_tarray::iterator &end, bool intable, 310 displayclass &disp, format_t *formatlistptr, 311 outconvertclass &outconvert, ostream &textout); 312 313 314 void output_standard_toc (const text_t &classifytype, const formatinfo_t &formatinfo, 315 text_t &formatstring, cgiargsclass &args, 316 recptproto *collectproto, displayclass &disp, 317 outconvertclass &outconvert, ostream &textout, 318 ostream &logout) { 319 320 bool havecontrols = false; 321 322 textout << "\n<!-- Table of Contents produced by cstrbrowsetools::output_standard_toc -->\n\n"; 323 324 // get the cover image (if there is one) and the control buttons 325 // if we're inside a book 326 if (!args["d"].empty()) { 327 textout << "<p><table cellpadding=0 cellspacing=0><tr>\n"; 328 textout << "<td valign=top width=200>\n"; 329 // if (cover) output_cover_image (args, collectproto, disp, outconvert, textout, logout); 330 output_controls (args, formatinfo.DocumentButtons, collectproto, disp, outconvert, textout, logout); 331 textout << "</td><td valign=top>\n"; 332 havecontrols = true; 333 } 334 335 // get table of contents 336 textout << "<table>\n"; 337 338 if (args.getintarg("gc")) 339 output_expanded_hierarchy_toc(args, collectproto, disp, outconvert, textout, logout); 340 else 341 output_contracted_hierarchy_toc(classifytype, formatstring, args, collectproto, 342 disp, outconvert, textout, logout); 343 344 textout << "</table>\n"; 345 346 if (havecontrols) textout << "</td></tr></table>\n"; 347 348 textout << "\n<!-- end of Table of Contents -->\n"; 349 } 350 351 352 void output_contracted_hierarchy_toc (const text_t &classifytype, text_t &formatstring, 353 cgiargsclass &args, recptproto *collectproto, 354 displayclass &disp, outconvertclass &outconvert, 355 ostream &textout, ostream &logout) { 356 357 int tabcount = 0; 358 text_tarray parents; 359 text_tset metadata; 360 FilterResponse_t fsiblings, fparents; 361 bool getParents = false; 362 363 text_t &arg_d = args["d"]; 364 text_t OID = arg_d; 365 if (OID.empty()) OID = args["cl"]; 366 text_t &collection = args["c"]; 367 368 // if format string is empty use the default 369 if (formatstring.empty()) 370 formatstring = "<td valign=top nowrap>[link][icon][/link]</td><td>{Or}{[Title],Untitled}</td>"; 371 372 format_t *formatlistptr = new format_t(); 373 parse_formatstring (formatstring, formatlistptr, metadata, getParents); 374 375 metadata.insert ("Date"); 376 metadata.insert ("hastxt"); 377 metadata.insert ("haschildren"); 378 metadata.insert ("doctype"); 379 metadata.insert ("classifytype"); 380 381 if (has_children (OID, collection, collectproto, logout)) { 382 get_parents_array (OID + ".fc", parents); 383 384 if (!get_children (OID, collection, metadata, getParents, 385 collectproto, fsiblings, logout)) 386 return; 387 } else { 388 get_parents_array (OID, parents); 389 if (!get_children (OID + ".pr", collection, metadata, 390 getParents, collectproto, fsiblings, logout)) 391 return; 392 } 393 if (!get_info (parents, collection, metadata, false, collectproto, fparents, logout)) return; 394 395 if (!fparents.docInfo.empty()) 396 output_parents_toc(args, fparents, tabcount, disp, 397 formatlistptr, outconvert, textout, logout); 398 399 if (!fsiblings.docInfo.empty()) 400 output_siblings_toc (classifytype, args, fsiblings, tabcount, disp, 401 formatlistptr, outconvert, textout, logout); 402 } 403 void output_parents_toc (cgiargsclass &args, const FilterResponse_t &parents, 404 int &tabcount, displayclass &disp, 405 format_t *formatlistptr, outconvertclass &outconvert, 406 ostream &textout, ostream &/*logout*/) { 407 408 text_t tab, icon; 409 text_t &arg_cl = args["cl"]; 410 text_t &arg_d = args["d"]; 411 int numcols = parents.docInfo.size() + 1; 412 413 bool intable = is_table_content (formatlistptr); 414 415 ResultDocInfo_tarray::iterator thisparent = parents.docInfo.begin(); 416 ResultDocInfo_tarray::iterator end = parents.docInfo.end(); 417 418 int len = (*thisparent).metadata.size(); 419 const text_t &classifytype = (*thisparent).metadata[len-1].values[0]; 420 421 // don't want top level of any classifications to be displayed 422 if (arg_d.empty() && thisparent != end) {thisparent ++; numcols --;} 423 424 // don't want second level of classifications using classification links 425 if ((classifytype == "AZList" || classifytype == "DateList") && (thisparent != end)) 426 {thisparent ++; numcols --;} 427 428 // the tab line 429 if (thisparent != end) { 430 text_t coltabs; 431 for (int i = 0; i < numcols; i ++) coltabs += "_document:tab_"; 432 textout << outconvert << disp << "<tr>" << coltabs << "<td></td></tr>\n"; 433 } 434 435 while (thisparent != end) { 436 437 const text_t &doctype = (*thisparent).metadata[len-2].values.back(); 438 439 // set up icon and pointer 440 icon = "_document:icon"; 441 if ((doctype != "classify") && ((*thisparent).OID == arg_d)) 442 icon += "arrow"; 443 if (doctype == "classify") icon += "openbookshelf_"; 444 else if (is_top((*thisparent).OID)) icon += "openbook_"; 445 else icon += "openfolder_"; 446 447 if (tabcount == 1) textout << "<td></td>\n"; 448 else if (tabcount > 1) textout << "<td colspan=" << tabcount << "></td>"; 449 450 // set up the link 451 text_t link = "<a href=\"_httpdocument_"; 452 if (is_top((*thisparent).OID) && args.getintarg("x")) link = "<a name=top>"; 453 else 454 if (doctype == "classify") link += "&cl=" + (*thisparent).OID + ".pr\">"; 455 else 456 if (is_top ((*thisparent).OID)) 457 if (arg_cl.empty()) 458 link = "<a name=top>"; 459 else if (arg_cl == "search") 460 link = "<a href=\"_httpquery_\">"; 461 else 462 link += "&cl=" + arg_cl + "\">"; 463 else link += "&cl=" + arg_cl + "&d=" + (*thisparent).OID + ".pr\">"; 464 465 if ((numcols-tabcount) == 1) textout << "<td>"; 466 else if ((numcols-tabcount) > 1) textout << "<td colspan=" 467 << (numcols-tabcount) << ">"; 468 469 if (intable) textout << "<table><tr>"; 470 471 textout << outconvert << disp 472 << get_formatted_string (*thisparent, formatlistptr, link, icon); 473 474 if (intable) textout << "</tr></table>"; 475 textout << "</td></tr>\n"; 476 477 tabcount ++; 478 thisparent ++; 479 } 480 } 481 482 483 void output_siblings_toc (const text_t &classifytype, cgiargsclass &args, 484 const FilterResponse_t &siblings, int &tabcount, 485 displayclass &disp, format_t *formatlistptr, 486 outconvertclass &outconvert, ostream &textout, 487 ostream &/*logout*/) { 488 489 bool intable = is_table_content (formatlistptr); 490 491 ResultDocInfo_tarray::const_iterator thissibling = siblings.docInfo.begin(); 492 ResultDocInfo_tarray::const_iterator sibend = siblings.docInfo.end(); 493 494 if (thissibling == sibend) return; 495 496 // tabbing 497 if (tabcount) { 498 if (tabcount == 1) textout << "<tr><td></td>\n"; 499 else if (tabcount > 1) textout << "<tr><td colspan=" << tabcount << "></td>"; 500 textout << "<td><table>\n"; 501 } 502 503 if (!intable) textout << "<tr><td>\n"; 504 505 if (classifytype == "DateList") 506 output_datelist (args, thissibling, sibend, intable, disp, 507 formatlistptr, outconvert, textout); 508 else 509 output_stdlist (args, thissibling, sibend, intable, disp, 510 formatlistptr, outconvert, textout); 511 512 if (!intable) textout << "</td></tr></table>\n"; 513 if (tabcount) textout << "</table></td></tr>\n"; 514 } 515 516 void output_stdlist (cgiargsclass &args, ResultDocInfo_tarray::iterator &here, 517 ResultDocInfo_tarray::iterator &end, bool intable, 518 displayclass &disp, format_t *formatlistptr, 519 outconvertclass &outconvert, ostream &textout) { 520 521 text_t icon; 522 int count = 1; 523 int gt = args.getintarg("gt"); 524 text_t &arg_cl = args["cl"]; 525 text_t &arg_d = args["d"]; 526 527 while (here != end) { 528 529 int len = (*here).metadata.size(); 530 const text_t &doctype = (*here).metadata[len-2].values.back(); 531 const text_t &hastxt = (*here).metadata[len-4].values.back(); 532 const text_t &haschildren = (*here).metadata[len-3].values.back(); 533 534 // set up icon and pointer 535 icon = "_document:icon"; 536 if (doctype == "classify") { 537 if (((*here).OID == arg_cl) && (hastxt == "1")) 538 icon += "arrow"; 539 } else if ((*here).OID == arg_d) icon += "arrow"; 540 541 if (haschildren == "0") icon += "smalltext_"; 542 else if (doctype == "classify") icon += "closedbookshelf_"; 543 else if (is_top((*here).OID)) icon += "closedbook_"; 544 else icon += "closedfolder_"; 545 546 // set up link 547 text_t link = "<a href=\"_httpdocument_"; 548 if (doctype == "classify") link += "&cl=" + (*here).OID + "\">"; 549 else link += "&cl=" + arg_cl + "&d=" + (*here).OID + "\">"; 550 if (gt) { 551 link = "<a href=\"#" + text_t(count) + "\">"; 552 count ++; 553 } 554 555 if (intable) textout << "<tr>"; 556 557 textout << outconvert << disp 558 << get_formatted_string (*here, formatlistptr, link, icon) << "\n"; 559 560 if (intable) textout << "</tr>"; 561 562 here ++; 563 } 564 } 565 566 567 void output_datelist (cgiargsclass &args, ResultDocInfo_tarray::iterator &here, 568 ResultDocInfo_tarray::iterator &end, bool intable, 569 displayclass &disp, format_t *formatlistptr, 570 outconvertclass &outconvert, ostream &textout) { 571 572 text_t lastyear = "0000"; 573 text_t lastmonth = "00"; 574 575 while (here != end) { 576 577 int len = (*here).metadata.size(); 578 const text_t &doctype = (*here).metadata[len-2].values.back(); 579 const text_t &date = (*here).metadata[len-5].values.back(); 580 581 // bail on this document if it has no date 582 if (date.empty()) continue; 583 584 text_t::const_iterator datebegin = date.begin(); 585 586 text_t link = "<a href=\"_httpdocument_&cl="; 587 text_t icon = "_document:iconclosedbook_"; 588 589 if (doctype == "classify") { 590 icon = "_document:iconclosedbookshelf_"; 591 link += (*here).OID + "\">"; 592 } else link += args["cl"] + "&d=" + (*here).OID + "\">"; 593 594 text_t thisyear = substr (datebegin, datebegin+4); 595 text_t thismonth = substr (datebegin+4, datebegin+6); 596 597 textout << "<tr>\n"; 598 599 if (thisyear != lastyear) { 600 textout << outconvert << "<td><b>" << thisyear << "</b></td>"; 601 lastyear = thisyear; 602 } else 603 textout << "<td></td>"; 604 605 if (thismonth != lastmonth) { 606 textout << outconvert << disp << ("<td><b>_textmonth" + thismonth + "_</b></td>"); 607 lastmonth = thismonth; 608 } else 609 textout << "<td></td>"; 610 611 if (!intable) textout << "<td>\n"; 612 613 textout << outconvert << disp 614 << get_formatted_string (*here, formatlistptr, link, icon) << "\n"; 615 616 if (!intable) textout << "</td>"; 617 618 textout << "</tr>\n"; 619 620 here ++; 621 } 622 } 623 624 void output_expanded_hierarchy_toc (cgiargsclass &args, recptproto *collectproto, 625 displayclass &disp, outconvertclass &outconvert, 626 ostream &textout, ostream &logout) { 627 628 text_t OID, topOID, icon; 629 bool is_classify; 630 FilterResponse_t response; 631 int tabcols=0, totalcols=0, lasttabcols=0; 632 633 int gt = args.getintarg("gt"); 634 text_t doclink = "<a href=\"_httpdocument_&cl="; 635 636 text_t &arg_d = args["d"]; 637 text_t &arg_cl = args["cl"]; 638 639 if (arg_d.empty()) { 640 if (arg_cl.empty()) return; 641 OID = arg_cl; 642 topOID = OID; // don't always want to expand from top if expanding classifications 643 is_classify=true; 644 } else { 645 OID = arg_d; 646 get_top (arg_d, topOID); 647 is_classify=false; 648 } 649 650 // Get OIDs and metadata of all topOIDs contents (and topOID itself) 651 text_tset metadata; 652 metadata.insert ("Title"); 653 metadata.insert ("haschildren"); 654 metadata.insert ("doctype"); 655 // metadata.insert ("hastxt"); 656 657 get_contents (topOID, is_classify, metadata, totalcols, 658 args["c"], collectproto, response, logout); 659 int excess = countchar (topOID.begin(), topOID.end(), '.'); 660 totalcols -= excess; 661 662 // allow for pointer 663 if (!is_classify && !gt) totalcols += 2; 664 else totalcols += 1; 665 666 ResultDocInfo_tarray::iterator thissection = response.docInfo.begin(); 667 ResultDocInfo_tarray::iterator lastsection = response.docInfo.end(); 668 669 int count = 1; 670 while (thissection != lastsection) { 671 672 const text_t &title = (*thissection).metadata[0].values[0]; 673 const int haschildren = (*thissection).metadata[1].values[0].getint(); 674 const text_t &doctype = (*thissection).metadata[2].values[0]; 675 676 text_t icontabs, tab, pointer; 677 678 // set up icon 679 icon = "_document:iconsmalltext_"; 680 if (is_top((*thissection).OID)) 681 if (classifytype == "Document") icon = "_document:iconopenbook_"; 682 else 683 if (doctype == "classify") icon = "_document:iconopenbookshelf_"; 684 else icon = "_document:iconclosedbook_"; 685 else if (haschildren) 686 if (classifytype == "Document") icon = "_document:iconopenfolder_"; 687 else icon = "_document:iconopenbookshelf_"; 688 689 // set up tabbing 690 if ((classifytype == "classify") && (doctype != "classify")) 691 tabcols = lasttabcols + 1; 692 else { 693 tabcols = countchar ((*thissection).OID.begin(), (*thissection).OID.end(), '.'); 694 lasttabcols = tabcols; 695 } 696 tabcols -= excess; 697 698 for (int i = 0; i < tabcols; i++) 699 icontabs += "_document:icontab_"; 700 701 // set up pointer 702 if (classifytype == "Document" && !gt) { 703 if ((*thissection).OID == OID) pointer = "_document:iconpointer_"; 704 else pointer = "_document:icontab_"; 705 tabcols ++; 706 } 707 708 int colsremaining = totalcols - tabcols; 709 710 if (tabcols > 0) { 711 tab = "<td"; 712 if (tabcols > 1) tab += " colspan=" + text_t(tabcols); 713 tab += ">" + icontabs + pointer + "</td>"; 714 } 715 716 textout << outconvert << disp << "<tr>" << tab << "<td>"; 717 718 if ((classifytype == "Document") && (is_top((*thissection).OID)) && 719 (args.getintarg("x"))) 720 textout << outconvert << disp << icon << "</td><td"; 721 722 else { 723 if (!gt) { 724 const text_t &thisOID = (*thissection).OID; 725 text_t link; 726 if (is_top (thisOID)) 727 if (classifytype == "classify") 728 link = doclink + arg_cl + "&d=" + thisOID + "\">"; 729 else 730 if (arg_cl.empty()) 731 link.clear(); 732 else if (arg_cl == "search") 733 link = "<a href=\"_httpquery_\">"; 734 else 735 link = doclink + arg_cl + "\">"; 736 else 737 if (haschildren) 738 if (classifytype == "classify") 739 link = doclink + thisOID + ".pr\">"; 740 else 741 link = doclink + arg_cl + "&d=" + thisOID + ".pr\">"; 742 else 743 if (classifytype == "classify") 744 link = doclink + thisOID + "\">"; 745 else 746 link = doclink + arg_cl + "&d=" + thisOID + "\">"; 747 748 textout << outconvert << disp << link; 749 } else { 750 textout << "<a href=\"#" << count << "\">"; 751 count ++; 752 } 753 754 textout << outconvert << disp << icon << "</a></td><td"; 755 } 756 if (colsremaining > 1) textout << " colspan=" << colsremaining; 757 textout << outconvert << disp << ">" << title << "</td></tr>\n"; 758 759 thissection ++; 760 } 761 } 762 763 /*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 764 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ 765 766 // set_arrow_macros sets the _httpprevarrow_ and _httpnextarrow_ macros 767 // it shouldn't be called if OID is the top level of a book 768 // as the "hasprevious" and "hasnext" metadata won't be set 769 // when the filter can't get OIDs parent info - one day I'll 770 // fix this ;-) 771 void set_arrow_macros (const text_t &OID, const text_t &classifytype, 772 bool showtoppage, displayclass &disp, 773 recptproto *collectproto, const text_t &collection, 774 ostream &logout) { 775 776 if (OID.empty()) return; 777 778 text_tset metadata; 779 FilterResponse_t response; 780 781 metadata.insert ("haschildren"); 782 metadata.insert ("hasnext"); 783 metadata.insert ("hasprevious"); 784 // get "haschildren", "hasnext" and "hasprevious" metadata for OID 785 if (get_info (OID, collection, metadata, false, collectproto, response, logout)) { 786 787 text_t haschildren = response.docInfo[0].metadata[0].values[0]; 788 text_t hasnext = response.docInfo[0].metadata[1].values[0]; 789 text_t hasprevious = response.docInfo[0].metadata[2].values[0]; 790 791 if ((classifytype == "Hierarchy") || (classifytype == "Book")) { 792 if (haschildren == "1") 793 disp.setmacro ("httpnextarrow", "document", 794 "_If_(_cgiargd_,_httpdocument_&cl=_cgiargcl_&d=_cgiargd_.fc,_httpdocument_&cl=_cgiargcl_.fc)"); 795 else if (hasnext == "1") 796 disp.setmacro ("httpnextarrow", "document", 797 "_If_(_cgiargd_,_httpdocument_&cl=_cgiargcl_&d=_cgiargd_.ns,_httpdocument_&cl=_cgiargcl_.ns)"); 798 else { 799 // see if parent has younger siblings 800 if (get_info (OID + ".pr", collection, metadata, false, collectproto, response, logout)) { 801 if (!response.docInfo[0].metadata.empty() && 802 response.docInfo[0].metadata[1].values[0] == "1") 803 disp.setmacro ("httpnextarrow", "document", 804 "_If_(_cgiargd_,_httpdocument_&cl=_cgiargcl_&d=_cgiargd_.pr.ns,_httpdocument_&cl=_cgiargcl_.pr.ns)"); 805 } 806 } 807 808 if (hasprevious == "1") { 809 // see if OIDs older sibling has children 810 if (get_info (OID + ".ps", collection, metadata, false, collectproto, response, logout)) { 811 if (response.docInfo[0].metadata[0].values[0] == "1") 812 disp.setmacro ("httpprevarrow", "document", 813 "_If_(_cgiargd_,_httpdocument_&cl=_cgiargcl_&d=_cgiargd_.ps.lc,_httpdocument_&cl=_cgiargcl_.ps.lc)"); 814 else 815 disp.setmacro ("httpprevarrow", "document", 816 "_If_(_cgiargd_,_httpdocument_&cl=_cgiargcl_&d=_cgiargd_.ps,_httpdocument_&cl=_cgiargcl_.ps)"); 817 } 818 } else if (showtoppage && !is_top (OID)) 819 disp.setmacro ("httpprevarrow", "document", 820 "_If_(_cgiargd_,_httpdocument_&cl=_cgiargcl_&d=_cgiargd_.pr,_httpdocument_&cl=_cgiargcl_.pr)"); 821 } 822 823 else { 824 if (hasnext == "1") 825 disp.setmacro ("httpnextarrow", "document", 826 "_If_(_cgiargd_,_httpdocument_&cl=_cgiargcl_&d=_cgiargd_.ns,_httpdocument_&cl=_cgiargcl_.ns)"); 827 if (hasprevious == "1") 828 disp.setmacro ("httpprevarrow", "document", 829 "_If_(_cgiargd_,_httpdocument_&cl=_cgiargcl_&d=_cgiargd_.ps,_httpdocument_&cl=_cgiargcl_.ps)"); 830 } 831 } 832 } 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 240 241 242 243 244 245 246 -
trunk/cstr/src/recpt/cstrbrowsetools.h
r891 r911 36 36 #include "recptproto.h" 37 37 #include "formattools.h" 38 #include "browsetools.h" 38 39 40 void output_cstr_toc (cgiargsclass &args, browsermapclass *browsermap, 41 formatinfo_t &formatinfo, recptproto *collectproto, 42 displayclass &disp, outconvertclass &outconvert, 43 ostream &textout, ostream &logout); 39 44 40 void output_document_toc (cgiargsclass &args, const formatinfo_t &formatinfo,41 recptproto *collectproto, displayclass &disp,42 outconvertclass &outconvert, ostream &textout,43 ostream &logout);44 45 void output_standard_toc (const text_t &classifytype, const formatinfo_t &formatinfo,46 text_t &formatstring, cgiargsclass &args,47 recptproto *collectproto, displayclass &disp,48 outconvertclass &outconvert, ostream &textout,49 ostream &logout);50 51 void set_arrow_macros (const text_t &OID, const text_t &classifytype,52 bool showtoppage, displayclass &disp,53 recptproto *collectproto, const text_t &collection,54 ostream &logout);55 45 56 46 #endif 57 47 58 59 -
trunk/cstr/src/recpt/cstrdocaction.cpp
r891 r911 28 28 /* 29 29 $Log$ 30 Revision 1. 1 2000/02/01 22:32:37sjboddie31 Initial revision30 Revision 1.2 2000/02/06 21:25:21 sjboddie 31 updated cstr 32 32 33 33 Revision 1.1 1999/09/07 21:49:42 sjboddie … … 40 40 #include "cstrdocaction.h" 41 41 #include "cstrbrowsetools.h" 42 #include "browsetools.h" 42 43 #include "OIDtools.h" 43 44 #include "querytools.h" … … 92 93 void cstrdocaction::set_java_macros (cgiargsclass &args, displayclass &disp) { 93 94 94 text_t javaimagescontent = " _javaextras__javapostscript_";95 text_t javaimagescontent = "<!----java images content------->\n_javaextras__javapostscript_"; 95 96 96 97 text_t &arg_gg = args["gg"]; … … 134 135 button_here ++; 135 136 } 137 javaimagescontent += "<!--end java img content--->\n"; 136 138 disp.setmacro ("javaimagescontent", "document", javaimagescontent); 137 139 } … … 205 207 disp.setmacro ("header", "document", "_textheader_"); 206 208 207 disp.setmacro ("thisOID", "Global", response.docInfo[0].metadata[ 2].values[0]);208 209 text_t &classifytype = response.docInfo[0].metadata[ 1].values[0];209 disp.setmacro ("thisOID", "Global", response.docInfo[0].metadata["archivedir"].values[0]); 210 211 text_t &classifytype = response.docInfo[0].metadata["classifytype"].values[0]; 210 212 if (classifytype.empty()) classifytype = "Book"; // defaults to Book 211 213 … … 228 230 if (get_info (classtop, collection, metadata, false, collectproto, response, logout)) { 229 231 230 text_t &title = response.docInfo[0].metadata[ 0].values[0];231 text_t &classifytype = response.docInfo[0].metadata[ 1].values[0];232 text_t &title = response.docInfo[0].metadata["Title"].values[0]; 233 text_t &classifytype = response.docInfo[0].metadata["classifytype"].values[0]; 232 234 233 235 disp.setmacro ("pagetitle", "document", "_text" + title + "page_"); … … 284 286 while (this_figure != end_figure) { 285 287 textout << outconvert << disp 286 << "<p><center><img border=1 src=\"_httpcoll ection_/archives/_thisOID_/"288 << "<p><center><img border=1 src=\"_httpcollimg_/_thisOID_/" 287 289 << *this_figure << "\"></center>\n"; 288 290 this_figure ++; … … 306 308 while (this_facs != end_facs) { 307 309 textout << outconvert << disp 308 << "<p><center><img border=1 src=\"_httpcoll ection_/archives/_thisOID_/"310 << "<p><center><img border=1 src=\"_httpcollimg_/_thisOID_/" 309 311 << *this_facs << "\"></center>\n"; 310 312 this_facs ++; … … 359 361 } 360 362 361 int metasize = metadata.size();362 363 363 if (get_info (OID, collection, metadata, getParents, collectproto, inforesponse, logout)) { 364 364 int hastxt = inforesponse.docInfo[0].metadata["hastxt"].values[0].getint(); … … 438 438 } 439 439 } 440 441 442 bool cstrdocaction::do_action (cgiargsclass &args, recptprotolistclass *protos, 443 browsermapclass *browsers, displayclass &disp, 444 outconvertclass &outconvert, ostream &textout, 445 ostream &logout) { 446 447 448 // must have a valid collection server 449 recptproto *collectproto = protos->getrecptproto (args["c"], logout); 450 if (collectproto == NULL) { 451 logout << "cstrdocaction::do_action called with NULL collectproto\n"; 452 textout << outconvert << disp << "_document:header_\n" 453 << "Error: Attempt to get document without setting collection\n" 454 << "_document:footer_\n"; 455 } else { 456 457 text_t OID = args["d"]; 458 if (OID.empty()) OID = args["cl"]; 459 if (OID.empty()) { 460 textout << outconvert << disp << "Document contains no data_document:footer_\n"; 461 return true; 462 } 463 464 textout << outconvert << disp << "_document:header_\n" 465 << "_document:content_\n"; 466 467 if (args["d"].empty()) { 468 output_toc (args, browsers, formatinfo, collectproto, 469 disp, outconvert, textout, logout); 470 } else { 471 output_cstr_toc (args, browsers, formatinfo, collectproto, 472 disp, outconvert, textout, logout); 473 474 textout << "<p>\n"; 475 output_document (OID, args, collectproto, disp, outconvert, textout, logout); 476 } 477 478 textout << outconvert << disp << "_document:footer_\n"; 479 } 480 return true; 481 } 482 483 484 485 486 487 488 489 490 491 492 493 -
trunk/cstr/src/recpt/cstrdocaction.h
r891 r911 43 43 ostream &logout); 44 44 45 45 46 public: 46 47 cstrdocaction (); … … 51 52 response_t &response,text_t &response_data, 52 53 ostream &logout); 53 54 // void define_internal_macros (const ColInfoResponse_t &collectinfo, displayclass &disp, 55 // cgiargsclass &args, recptproto *collectproto, 56 // ostream &logout); 57 54 55 // void define_internal_macros (const ColInfoResponse_t &collectinfo, displayclass &disp, 56 // cgiargsclass &args, recptproto *collectproto, 57 // ostream &logout); 58 59 bool do_action (cgiargsclass &args, recptprotolistclass *protos, 60 browsermapclass *browsers, displayclass &disp, 61 outconvertclass &outconvert, ostream &textout, 62 ostream &logout); 63 58 64 }; 59 65 … … 63 69 64 70 71 72 -
trunk/cstr/src/recpt/cstrlibrarymain.cpp
r891 r911 28 28 /* 29 29 $Log$ 30 Revision 1. 1 2000/02/01 22:32:37sjboddie31 Initial revision30 Revision 1.2 2000/02/06 21:25:22 sjboddie 31 updated cstr 32 32 33 33 Revision 1.1 1999/09/07 21:49:43 sjboddie … … 64 64 #include "datelistbrowserclass.h" 65 65 #include "invbrowserclass.h" 66 #include " pagedbrowserclass.h"66 #include "cstrpagedbrowserclass.h" 67 67 #include "htmlbrowserclass.h" 68 68 … … 172 172 recpt.add_browser (&ainvbrowserclass); 173 173 174 pagedbrowserclass apagedbrowserclass;174 cstrpagedbrowserclass apagedbrowserclass; 175 175 recpt.add_browser (&apagedbrowserclass); 176 176 … … 182 182 } 183 183 184 185 186
Note:
See TracChangeset
for help on using the changeset viewer.