Changeset 6645 for trunk/gsdl/src
- Timestamp:
- 2004-01-28T15:10:55+13:00 (20 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/datelistbrowserclass.cpp
r5124 r6645 82 82 ResultDocInfo_tarray::iterator thissection = sections.docInfo.begin(); 83 83 ResultDocInfo_tarray::iterator endsection = sections.docInfo.end(); 84 84 85 // use the dm arg as date metadata or else Date 86 text_t date_meta = args["dm"]; 87 if (date_meta == "") { 88 date_meta = "Date"; 89 } 85 90 while (thissection != endsection) { 86 91 87 92 text_t &doctype = (*thissection).metadata["doctype"].values[0]; 88 text_t &date = (*thissection).metadata[ "Date"].values[0];93 text_t &date = (*thissection).metadata[date_meta].values[0]; 89 94 90 95 // bail on this document if it has no date -
trunk/gsdl/src/recpt/documentaction.cpp
r6584 r6645 167 167 arg_ainfo.defaultstatus = cgiarginfo::weak; 168 168 arg_ainfo.argdefault = "0"; 169 arg_ainfo.savedarginfo = cgiarginfo::must; 170 argsinfo.addarginfo (NULL, arg_ainfo); 171 172 //dm is the metadata that has been used for the datelist 173 arg_ainfo.shortname = "dm"; 174 arg_ainfo.longname = "date metadata"; 175 arg_ainfo.multiplechar = true; 176 arg_ainfo.defaultstatus = cgiarginfo::weak; 177 arg_ainfo.argdefault = ""; 169 178 arg_ainfo.savedarginfo = cgiarginfo::must; 170 179 argsinfo.addarginfo (NULL, arg_ainfo); … … 362 371 text_t navigationbar = "<!-- Navigation Bar -->\n"; 363 372 373 text_t date_extra = ""; 364 374 get_top (args["cl"], topparent); 365 375 int numc = response.docInfo.size(); … … 381 391 bool first = true; 382 392 while (dochere != docend) { 383 393 date_extra = ""; 384 394 if (!first) navigationbar += "_imagespacer_"; 385 395 386 396 text_t title = (*dochere).metadata["Title"].values[0]; 387 397 if (title == "Date") { // a date list 398 text_t date_meta = (*dochere).metadata["mdtype"].values[0]; 399 if (date_meta == "") { 400 date_meta = "Date"; 401 } 402 date_extra = "&dm="+date_meta; 403 } 388 404 bool unknown = false; 389 405 … … 403 419 // set the _httpbrowseXXX_ macro for this classification 404 420 if (unknown) navigationbar += " <a href=\"_httpdocument_&cl=" + 405 (*dochere).OID + "\">" + title + "</a> ";421 (*dochere).OID + date_extra+"\">" + title + "</a> "; 406 422 else { 407 423 navigationbar += "_image" + title + "_"; 408 disp.setmacro ("httpbrowse" + title, "Global", "_httpdocument_&cl=" + (*dochere).OID );424 disp.setmacro ("httpbrowse" + title, "Global", "_httpdocument_&cl=" + (*dochere).OID+date_extra); 409 425 } 410 426 } … … 438 454 while (dochere != docend) { 439 455 text_t title = dochere->metadata["Title"].values[0]; 440 navigationbar += "<option value=\"_httpdocument_&cl=" + dochere->OID + "\""; 456 if (title == "Date") { // a date list 457 text_t date_meta = (*dochere).metadata["mdtype"].values[0]; 458 if (date_meta == "") { 459 date_meta = "Date"; 460 } 461 date_extra = "&dm="+date_meta; 462 } 463 464 navigationbar += "<option value=\"_httpdocument_&cl=" + dochere->OID +date_extra+ "\""; 441 465 if (topparent == dochere->OID) { 442 466 navigationbar += " selected"; … … 545 569 546 570 metadata.insert ("Title"); 571 metadata.insert ("mdtype"); // in case there is a datelist 547 572 bool getParents = false; 548 573 get_children ("", collection, metadata, getParents, collectproto, response, logout); -
trunk/gsdl/src/recpt/formattools.cpp
r6020 r6645 154 154 155 155 156 text_t remove_namespace(const text_t &meta_name) { 157 text_t::const_iterator end = meta_name.end(); 158 text_t::const_iterator it = findchar(meta_name.begin(), end, '.'); 159 if (it != end) { 160 return substr(it+1, end); 161 } 162 return meta_name; 163 164 } 156 165 // returns a date of form 31 _textmonthnn_ 1999 157 166 // input is date of type 19991231 … … 858 867 859 868 MetadataInfo_t *parent = docinfo.metadata[meta.metaname].parent; 860 869 text_t no_ns_metaname = remove_namespace(meta.metaname); 861 870 switch (meta.parentcommand) { 862 871 case pNone: … … 873 882 for (int i=start_i; i<=end_i; i++) { 874 883 if (!first) tmp += meta.functionoptions; 875 if (meta.metaname == "Date") tmp += format_date (metaname_rec.values[i]); 876 else if (meta.metaname == "Language") tmp += iso639(metaname_rec.values[i]); 884 885 if (no_ns_metaname == "Date") tmp += format_date (metaname_rec.values[i]); 886 else if (no_ns_metaname == "Language") tmp += iso639(metaname_rec.values[i]); 877 887 else tmp += metaname_rec.values[i]; 878 888 first = false; … … 890 900 text_t metadata_item = docinfo.metadata[meta.metaname].values[metaname_index]; 891 901 892 if ( meta.metaname == "Date")902 if (no_ns_metaname == "Date") 893 903 return format_date (metadata_item); 894 else if ( meta.metaname == "Language")904 else if (no_ns_metaname == "Language") 895 905 return iso639(metadata_item); 896 906 if (meta.metacommand & mCgiSafe) … … 902 912 case pImmediate: 903 913 if (parent != NULL) { 904 if ( meta.metaname == "Date")914 if (no_ns_metaname == "Date") 905 915 return format_date (parent->values[0]); 906 916 if (meta.metacommand & mCgiSafe) … … 914 924 while (parent->parent != NULL) parent = parent->parent; 915 925 916 if ( meta.metaname == "Date")926 if (no_ns_metaname == "Date") 917 927 return format_date (parent->values[0]); 918 928 if (meta.metacommand & mCgiSafe) … … 936 946 while (here != end) { 937 947 if (!first) tmp += meta.functionoptions; 938 if ( meta.metaname == "Date") tmp += format_date (*here);948 if (no_ns_metaname == "Date") tmp += format_date (*here); 939 949 else tmp += *here; 940 950 first = false; -
trunk/gsdl/src/recpt/formattools.h
r6020 r6645 110 110 text_t format_date (const text_t &date); 111 111 112 text_t remove_namespace(const text_t &meta_name); 113 112 114 text_t iso639 (const text_t &langcode); 113 115
Note:
See TracChangeset
for help on using the changeset viewer.