Changeset 600
- Timestamp:
- 1999-09-17T16:00:26+12:00 (25 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/documentaction.cpp
r533 r600 28 28 /* 29 29 $Log$ 30 Revision 1.24 1999/09/17 04:00:26 sjboddie 31 tidied up navigation bar to produce a default "unknown" button if 32 it comes across metadata it can't display 33 30 34 Revision 1.23 1999/09/07 04:56:54 sjboddie 31 35 added GPL notice … … 134 138 135 139 documentaction::documentaction () { 140 136 141 // this action uses cgi variables "a", "d", "cl", 137 142 // "x", "gc", "gt", "gp", and "hl" … … 218 223 219 224 bool documentaction::init (ostream &logout) { 225 226 // classify_meta should contain names of all classifiers supported 227 // by this receptionist. classifications using metadata names not 228 // in this list will be displayed as "unknown" 229 classify_meta.insert ("Title"); 230 classify_meta.insert ("List"); 231 classify_meta.insert ("Creator"); 232 classify_meta.insert ("Series"); 233 classify_meta.insert ("Date"); 234 classify_meta.insert ("Subject"); 235 classify_meta.insert ("Organization"); 236 classify_meta.insert ("Howto"); 237 classify_meta.insert ("Topic"); 238 classify_meta.insert ("Browse"); 239 classify_meta.insert ("People"); 240 220 241 return action::init (logout); 221 242 } … … 266 287 267 288 289 // set_widthtspace calculates how wide the spaces in the nav bar should 290 // be and sets the appropriate macro 291 void documentaction::set_spacemacro (displayclass &disp, const FilterResponse_t &response) { 292 293 text_t width; 294 int twidth, swidth, iwidth = 0; 295 296 int numc = response.docInfo.size(); 297 ResultDocInfo_tarray::const_iterator dochere = response.docInfo.begin(); 298 ResultDocInfo_tarray::const_iterator docend = response.docInfo.end(); 299 300 disp.expandstring ("Global", "_pagewidth_", width); 301 twidth = width.getint(); 302 303 disp.expandstring ("query", "_searchwidth_", width); 304 iwidth += width.getint(); 305 306 while (dochere != docend) { 307 text_t title = (*dochere).metadata[0].values[0]; 308 text_tset::const_iterator it = classify_meta.find (title); 309 if (it == classify_meta.end()) title = "Unknown"; 310 311 disp.expandstring ("document", "_" + title + "width_", width); 312 iwidth += width.getint(); 313 dochere ++; 314 } 315 if ((twidth - iwidth) < numc) swidth = 2; 316 else { 317 swidth = twidth - iwidth; 318 if (numc > 0) swidth = swidth / numc; 319 } 320 disp.setmacro ("widthtspace", "Global", swidth); 321 } 322 323 // set_navbarmacros sets _navigationbar_, _javaimagesnavbar_ and _httpbrowseXXX_ macros 324 void documentaction::set_navbarmacros (displayclass &disp, const FilterResponse_t &response, 325 cgiargsclass &args) { 326 327 text_t javaimagesnavbar, topparent; 328 text_t &arg_d = args["d"]; 329 text_t navigationbar = "<!-- Navigation Bar -->\n"; 330 331 get_top (args["cl"], topparent); 332 int numc = response.docInfo.size(); 333 ResultDocInfo_tarray::const_iterator dochere = response.docInfo.begin(); 334 ResultDocInfo_tarray::const_iterator docend = response.docInfo.end(); 335 336 navigationbar += "<nobr>\n"; 337 if (args["a"] == "q") { 338 navigationbar += "_icontabsearchgreen_"; 339 } else { 340 navigationbar += "_imagesearch_"; 341 javaimagesnavbar = "_javasearch_"; 342 } 343 if (numc == 0) navigationbar += "_imagespacer_"; 344 345 while (dochere != docend) { 346 text_t title = (*dochere).metadata[0].values[0]; 347 const text_t &classifytype = (*dochere).metadata[1].values[0]; 348 349 text_tset::const_iterator it = classify_meta.find (title); 350 if (it == classify_meta.end()) title = "Unknown"; 351 352 // if we're inside a document all the classification buttons should be enabled 353 if (arg_d.empty() && ((*dochere).OID == topparent)) 354 navigationbar += "_imagespacer__icontab" + title + "green_"; 355 else { 356 navigationbar += "_imagespacer__image" + title + "_"; 357 358 // set the _httpbrowseXXX_ macro for this classification 359 text_t link; 360 if (classifytype == "HTML") 361 link = "_httppagex_(html)&hp=" + (*dochere).OID + ".fc"; 362 else 363 link = "_httpdocument_&cl=" + (*dochere).OID; 364 365 if (classifytype == "AZList" || classifytype == "DateList") link += ".fc"; 366 disp.setmacro ("httpbrowse" + title, "Global", link); 367 368 } 369 javaimagesnavbar += "_java" + title + "_"; 370 dochere ++; 371 } 372 navigationbar += "\n</nobr>\n"; 373 navigationbar += "<!-- End of Navigation Bar -->\n"; 374 disp.setmacro ("navigationbar", "Global", navigationbar); 375 if (args.getintarg("v") == 0) 376 disp.setmacro ("javaimagesnavbar", "Global", javaimagesnavbar); 377 } 378 379 268 380 // define all the macros which might be used by other actions 269 381 // to produce pages. … … 286 398 // _javaimagesnavbar_ this is the javascript code to shove in to make the 287 399 // flashy images used by _navigationbar_ work 400 401 // _widthtspace_ the width of the spacers between buttons in navigation 402 // bar 288 403 289 404 … … 296 411 FilterResponse_t response; 297 412 text_tarray metadata; 298 text_t navigationbar, javaimagesnavbar, width, topparent;299 int twidth, swidth, iwidth = 0;300 301 text_t &arg_d = args["d"];302 text_t &arg_cl = args["cl"];303 413 text_t &collection = args["c"]; 304 414 … … 306 416 if (!args.getintarg("x")) { 307 417 308 get_top (arg_cl, topparent);309 310 418 collectproto->get_filterinfo (collection, filterinfo, err, logout); 311 419 if (err == noError) { … … 317 425 bool getParents = false; 318 426 get_children ("", collection, metadata, getParents, collectproto, response, logout); 319 320 int numc = response.docInfo.size();321 ResultDocInfo_tarray::const_iterator dochere = response.docInfo.begin();322 ResultDocInfo_tarray::const_iterator docend = response.docInfo.end();323 427 324 navigationbar = "<!-- Navigation Bar -->\n"; 325 326 // calculate width of spacers and set macro 327 if (args.getintarg("v") == 0) { 328 disp.expandstring ("Global", "_pagewidth_", width); 329 twidth = width.getint(); 330 331 disp.expandstring ("query", "_searchwidth_", width); 332 iwidth += width.getint(); 333 334 while (dochere != docend) { 335 disp.expandstring ("document", "_" + (*dochere).metadata[0].values[0] + "width_", width); 336 iwidth += width.getint(); 337 dochere ++; 338 } 339 if ((twidth - iwidth) < numc) swidth = 2; 340 else { 341 swidth = twidth - iwidth; 342 if (numc > 0) swidth = swidth / numc; 343 } 344 disp.setmacro ("widthtspace", "Global", swidth); 345 } 346 347 navigationbar += "<nobr>\n"; 348 if (args["a"] == "q") { 349 navigationbar += "_icontabsearchgreen_"; 350 } else { 351 navigationbar += "_imagesearch_"; 352 javaimagesnavbar = "_javasearch_"; 353 } 354 if (numc == 0) navigationbar += "_imagespacer_"; 355 356 dochere = response.docInfo.begin(); 357 while (dochere != docend) { 358 const text_t &title = (*dochere).metadata[0].values[0]; 359 const text_t &classifytype = (*dochere).metadata[1].values[0]; 360 361 // if we're inside a document all the classification buttons should be enabled 362 if (arg_d.empty() && ((*dochere).OID == topparent)) 363 navigationbar += "_imagespacer__icontab" + title + "green_"; 364 else { 365 navigationbar += "_imagespacer__image" + title + "_"; 366 367 // set the _httpbrowseXXX_ macro for this classification 368 text_t link; 369 if (classifytype == "HTML") 370 link = "_httppagex_(html)&hp=" + (*dochere).OID + ".fc"; 371 else 372 link = "_httpdocument_&cl=" + (*dochere).OID; 373 374 if (classifytype == "AZList" || classifytype == "DateList") link += ".fc"; 375 disp.setmacro ("httpbrowse" + title, "Global", link); 376 377 } 378 javaimagesnavbar += "_java" + title + "_"; 379 dochere ++; 380 } 381 navigationbar += "\n</nobr>\n"; 382 navigationbar += "<!-- End of Navigation Bar -->\n"; 383 disp.setmacro ("navigationbar", "Global", navigationbar); 384 if (args.getintarg("v") == 0) 385 disp.setmacro ("javaimagesnavbar", "Global", javaimagesnavbar); 428 // calculate width of spacers and set _widthtspace_ macro 429 if (args.getintarg("v") == 0) set_spacemacro (disp, response); 430 431 // set _navigationbar_ and _javaimagesnavbar_ macros 432 set_navbarmacros (disp, response, args); 386 433 } 387 434 } else { -
trunk/gsdl/src/recpt/documentaction.h
r533 r600 40 40 void load_formatinfo (const text_tmap &colformat, int gt); 41 41 42 void set_spacemacro (displayclass &disp, const FilterResponse_t &response); 43 44 void set_navbarmacros (displayclass &disp, const FilterResponse_t &response, cgiargsclass &args); 45 42 46 void set_java_macros (cgiargsclass &args, displayclass &disp); 43 47 … … 63 67 64 68 formatinfo_t formatinfo; 69 text_tset classify_meta; 65 70 66 71
Note:
See TracChangeset
for help on using the changeset viewer.