- Timestamp:
- 2000-07-13T10:21:53+12:00 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/New_Config_Format-branch/gsdl/src/recpt/pageaction.cpp
r1033 r1279 28 28 /* 29 29 $Log$ 30 Revision 1.29.4.1 2000/07/12 22:21:41 sjboddie 31 merged changes to trunk into New_Config_Format branch 32 33 Revision 1.34 2000/07/12 04:51:05 nzdl 34 added an error message when no "valid" collections are available 35 36 Revision 1.33 2000/07/05 21:49:33 sjboddie 37 Receptionist now caches collection information to avoid making multiple 38 get_collectinfo calls to collection server 39 40 Revision 1.32 2000/06/27 23:02:40 sjboddie 41 Tidied up the way collections are displayed on 'standard' homepage. 42 Removed all the nzdl.org specific stuff. 43 44 Revision 1.31 2000/06/23 03:48:08 sjboddie 45 Added Arabic language and encoding options to the preferences page. This 46 is a much more complex task than it should be (you even have to recompile!) 47 but it's not really worth fixing until the new config file format is 48 finalised. 49 50 Revision 1.30 2000/06/14 22:33:42 sjboddie 51 Added French and Spanish language selection options to the preferences 52 page. I really don't like how this is currently implemented (i.e. you 53 have to recompile the library to do something so simple), it might have 54 to wait until the new configuration file stuff is done before it's fixed 55 though. 56 30 57 Revision 1.29 2000/03/19 21:16:46 nzdl 31 58 added german language interface … … 186 213 187 214 text_t homeextra = "<center><table width=_pagewidth_><tr valign=top>\n"; 215 bool found_valid_col = false; 188 216 189 217 recptprotolistclass::iterator rprotolist_here = protos->begin(); … … 198 226 text_tarray::iterator collist_here = collist.begin(); 199 227 text_tarray::iterator collist_end = collist.end(); 200 201 int row1 = 9; 202 int row2 = 8; 203 int count = 1; 228 229 int count = 0; 230 bool first = true; 204 231 while (collist_here != collist_end) { 205 232 206 ColInfoResponse_t cinfo; 207 (*rprotolist_here).p->get_collectinfo (*collist_here, cinfo, err, logout); 233 ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr ((*rprotolist_here).p, *collist_here, logout); 208 234 209 if ( err == noError) {210 if (cinfo .isPublic && (cinfo.buildDate > 0)) {235 if (cinfo != NULL) { 236 if (cinfo->isPublic && (cinfo->buildDate > 0)) { 211 237 238 found_valid_col = true; 212 239 FilterResponse_t response; 213 240 text_tset metadata; … … 233 260 } 234 261 235 if ((count == 1) || (count == (row1+1)) || (count == ((row1+row2)+1))) 236 homeextra += "<td align=center>"; 237 else homeextra += "<p>"; 238 239 if (*collist_here == "niupepa") { 240 homeextra += "<a href=\"_httpmusiclibrary_\">_iconmusiclibrary_</a>\n"; 241 if ((count == row1) || (count == (row1+row2))) homeextra += "</td>"; 242 count ++; 243 if ((count == 1) || (count == (row1+1)) || (count == ((row1+row2)+1))) 244 homeextra += "<td align=center>"; 245 else homeextra += "<p>"; 246 } 262 if ((count%3 == 0) && (!first)) 263 homeextra += "</tr><tr valign=top>\n"; 247 264 248 265 text_t link = "<a href=\"_gwcgi_?a=p&p=about&c=" + *collist_here + "\">"; … … 250 267 link = "<a href=\"_gwcgi_?a=p&p=about&l=zh&nw=u&c=" + *collist_here + "\">"; 251 268 if (*collist_here == "arabic") 252 link = "<a href=\"_gwcgi_?a=p&p=about& w=a&c=" + *collist_here + "\">";253 254 if (!cinfo .receptionist.empty())255 link = "<a href=\"" + cinfo .receptionist + "\">";269 link = "<a href=\"_gwcgi_?a=p&p=about&l=ar&nw=u&c=" + *collist_here + "\">"; 270 271 if (!cinfo->receptionist.empty()) 272 link = "<a href=\"" + cinfo->receptionist + "\">"; 256 273 257 homeextra += link + collectionname + "</a>\n"; 258 259 if ((count == row1) || (count == (row1+row2))) 260 homeextra += "</td>"; 274 homeextra += "<td>" + link + collectionname + "</a></td>\n"; 261 275 262 276 count ++; 277 first = false; 263 278 } 264 279 } … … 266 281 collist_here ++; 267 282 } 268 homeextra += "</tr></table></center>\n"; 269 disp.setmacro ("homeextra", "home", homeextra); 283 for (; count%3 != 0; count ++) homeextra += "<td></td>\n"; 270 284 } 271 285 } 272 286 rprotolist_here ++; 273 287 } 288 289 if (!found_valid_col) { 290 homeextra += "<td>No valid (i.e. built and public) collections are available</td>\n"; 291 } 292 homeextra += "</tr></table></center>\n"; 293 disp.setmacro ("homeextra", "home", homeextra); 294 274 295 } 275 296 … … 319 340 320 341 342 if (recpt == NULL) { 343 logout << "ERROR (pageaction::define_internal_macros): This action does not contain\n" 344 << " information about any receptionists. The method set_receptionist was\n" 345 << " probably not called from the module which instantiated this action.\n"; 346 return; 347 } 348 321 349 text_t &arg_p = args["p"]; 322 350 text_t &arg_c = args["c"]; 323 ColInfoResponse_t cinfo; 324 comerror_t err; 351 ColInfoResponse_t *cinfo = NULL; 325 352 326 353 recptproto* collectproto = protos->getrecptproto (arg_c, logout); 327 354 if (collectproto != NULL) { 328 c ollectproto->get_collectinfo (arg_c, cinfo, err, logout);329 330 disp.setmacro ("numdocs", "Global", cinfo .numDocs);355 cinfo = recpt->get_collectinfo_ptr (collectproto, arg_c, logout); 356 357 disp.setmacro ("numdocs", "Global", cinfo->numDocs); 331 358 unsigned long current_time = time(NULL); 332 unsigned long builddate = (current_time - cinfo .buildDate) / 86400;359 unsigned long builddate = (current_time - cinfo->buildDate) / 86400; 333 360 disp.setmacro ("builddate", "Global", builddate); 334 361 } … … 340 367 // _collectionoption_ 341 368 342 if (args["ccs"] == "1" && collectproto != NULL && (cinfo .ccsCols.size() > 1)) {369 if (args["ccs"] == "1" && collectproto != NULL && (cinfo->ccsCols.size() > 1)) { 343 370 text_t collectionoption = "_textcollectionoption_"; 344 text_tarray::const_iterator col_here = cinfo .ccsCols.begin();345 text_tarray::const_iterator col_end = cinfo .ccsCols.end();371 text_tarray::const_iterator col_here = cinfo->ccsCols.begin(); 372 text_tarray::const_iterator col_end = cinfo->ccsCols.end(); 346 373 int count = 0; 347 374 while (col_here != col_end) { 348 375 text_t colname; 349 376 if (*col_here == arg_c) { 350 colname = cinfo .collectionmeta["collectionname"];377 colname = cinfo->collectionmeta["collectionname"]; 351 378 } else { 352 ColInfoResponse_t this_cinfo; 353 collectproto->get_collectinfo (*col_here, this_cinfo, err, logout); 354 if (err != noError) {col_here ++; continue;} 355 colname = this_cinfo.collectionmeta["collectionname"]; 379 ColInfoResponse_t *this_cinfo = recpt->get_collectinfo_ptr (collectproto, *col_here, logout); 380 if (this_cinfo == NULL) {col_here ++; continue;} 381 colname = this_cinfo->collectionmeta["collectionname"]; 356 382 } 357 383 … … 369 395 // _htmloptions_ 370 396 371 text_tmap::const_iterator it = cinfo .format.find ("DocumentUseHTML");372 if ((it != cinfo .format.end()) && ((*it).second == "true")) {397 text_tmap::const_iterator it = cinfo->format.find ("DocumentUseHTML"); 398 if ((it != cinfo->format.end()) && ((*it).second == "true")) { 373 399 disp.setmacro ("htmloptions", "preferences", "_htmloptionson_"); 374 400 … … 376 402 // _PreferenceDocsFromWeb_ 377 403 378 it = cinfo .format.find ("PreferenceDocsFromWeb");379 if ((it == cinfo .format.end()) || ((*it).second == "true"))404 it = cinfo->format.find ("PreferenceDocsFromWeb"); 405 if ((it == cinfo->format.end()) || ((*it).second == "true")) 380 406 disp.setmacro ("PreferenceDocsFromWeb", "preferences", "1"); 381 407 } … … 392 418 text_tarray languages; 393 419 languages.push_back ("en"); 420 languages.push_back ("fr"); 394 421 languages.push_back ("de"); 422 languages.push_back ("es"); 395 423 languages.push_back ("mi"); 396 424 languages.push_back ("zh"); 425 languages.push_back ("ar"); 397 426 text_tarray::const_iterator this_lang = languages.begin(); 398 427 text_tarray::const_iterator end_lang = languages.end(); 399 428 400 429 text_t languageoption = "_textlanguage_\n<select name=\"l\" onChange=\"updatel();\">\n"; 401 it = cinfo .format.find ("PreferenceLanguages");402 if ((it != cinfo .format.end()) && (!(*it).second.empty())) {430 it = cinfo->format.find ("PreferenceLanguages"); 431 if ((it != cinfo->format.end()) && (!(*it).second.empty())) { 403 432 text_tset pref_langs; 404 433 splitchar ((*it).second.begin(), (*it).second.end(), '|', pref_langs); … … 471 500 472 501 // if HTML collection there's no how to read document text 473 text_tmap::const_iterator it = cinfo .format.find ("HelpNoDocs");474 if ((it != cinfo .format.end()) && ((*it).second == "true")) {502 text_tmap::const_iterator it = cinfo->format.find ("HelpNoDocs"); 503 if ((it != cinfo->format.end()) && ((*it).second == "true")) { 475 504 disp.setmacro ("topicreadingdocs", "help", ""); 476 505 disp.setmacro ("texthelpreadingdocs", "help", ""); 477 506 } 478 it = cinfo .format.find ("HelpBibDocs");479 if ((it != cinfo .format.end()) && ((*it).second == "true")) {507 it = cinfo->format.find ("HelpBibDocs"); 508 if ((it != cinfo->format.end()) && ((*it).second == "true")) { 480 509 disp.setmacro ("texthelpreadingdocs", "help", "_bibtexthelpreadingdocs_"); 481 510 disp.setmacro ("textreadingdocs", "help", "_bibtextreadingdocs_"); 482 511 } 483 it = cinfo .format.find ("HelpBookDocs");484 if ((it != cinfo .format.end()) && ((*it).second == "true")) {512 it = cinfo->format.find ("HelpBookDocs"); 513 if ((it != cinfo->format.end()) && ((*it).second == "true")) { 485 514 disp.setmacro ("texthelpreadingdocs", "help", "_booktexthelpreadingdocs_"); 486 515 disp.setmacro ("textreadingdocs", "help", "_booktextreadingdocs_"); … … 491 520 492 521 // _textsubcollections_ 493 if (args["ccs"] == "1" && (cinfo .ccsCols.size() > 1)) {494 text_t textsubcollections = "_textsubcols1_(" + text_t(cinfo .ccsCols.size()) + ")";495 text_tarray::const_iterator here = cinfo .ccsCols.begin();496 text_tarray::const_iterator end = cinfo .ccsCols.end();522 if (args["ccs"] == "1" && (cinfo->ccsCols.size() > 1)) { 523 text_t textsubcollections = "_textsubcols1_(" + text_t(cinfo->ccsCols.size()) + ")"; 524 text_tarray::const_iterator here = cinfo->ccsCols.begin(); 525 text_tarray::const_iterator end = cinfo->ccsCols.end(); 497 526 bool first = true; 498 527 int count = 0; … … 500 529 if (*here == arg_c) { 501 530 if (!first) textsubcollections += "<br>"; 502 textsubcollections += "\n" + cinfo .collectionmeta["collectionname"] + "\n";531 textsubcollections += "\n" + cinfo->collectionmeta["collectionname"] + "\n"; 503 532 } else { 504 ColInfoResponse_t this_cinfo; 505 collectproto->get_collectinfo (*here, this_cinfo, err, logout); 506 if (err != noError) {here ++; continue;} 533 ColInfoResponse_t *this_cinfo = recpt->get_collectinfo_ptr (collectproto, *here, logout); 534 if (this_cinfo == NULL) {here ++; continue;} 507 535 if (!first) textsubcollections += "<br>"; 508 textsubcollections += "\n" + this_cinfo .collectionmeta["collectionname"] + "\n";536 textsubcollections += "\n" + this_cinfo->collectionmeta["collectionname"] + "\n"; 509 537 } 510 538 count ++;
Note:
See TracChangeset
for help on using the changeset viewer.