Changeset 23515 for main/trunk/greenstone2/runtime-src
- Timestamp:
- 2010-12-21T18:20:39+13:00 (13 years ago)
- Location:
- main/trunk/greenstone2/runtime-src/src/recpt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/runtime-src/src/recpt/formattools.cpp
r23305 r23515 33 33 #include <assert.h> 34 34 35 static bool metadata_spanwrap = false; 35 static bool metadata_wrap = false; 36 static text_t metadata_wrap_type = ""; 36 37 37 38 // a few function prototypes … … 694 695 formatlistptr->command = comEndMetadataSpanWrap; 695 696 697 else if (meta == "metadata-divwrap") 698 formatlistptr->command = comMetadataDivWrap; 699 700 else if (meta == "/metadata-divwrap") 701 formatlistptr->command = comEndMetadataDivWrap; 702 696 703 else if (meta == "Summary") 697 704 formatlistptr->command = comSummary; … … 980 987 981 988 982 static text_t spanwrap_metatext(const text_t& metatext, const text_t& OID,989 static text_t wrap_metatext(const text_t& metatext, const text_t& OID, 983 990 const text_t metaname, int metapos=-1) 984 991 { 985 992 986 text_t tag_type = (metaname == "Text") ? "div" : "span";993 text_t tag_type = metadata_wrap_type; 987 994 text_t editable_type = (metaname == "Text") ? "text" : "metadata"; 988 995 … … 1092 1099 } 1093 1100 1094 if (metadata_ spanwrap) {1095 fresh_metatext = spanwrap_metatext(fresh_metatext,OID,meta.metaname,i);1101 if (metadata_wrap) { 1102 fresh_metatext = wrap_metatext(fresh_metatext,OID,meta.metaname,i); 1096 1103 } 1097 1104 formatted_metatext += fresh_metatext; … … 1171 1178 } 1172 1179 1173 if (metadata_ spanwrap) {1174 fresh_metatext = spanwrap_metatext(fresh_metatext,OID,meta.metaname,position);1180 if (metadata_wrap) { 1181 fresh_metatext = wrap_metatext(fresh_metatext,OID,meta.metaname,position); 1175 1182 } 1176 1183 … … 1388 1395 while (orptr != NULL) { 1389 1396 1390 if (metadata_ spanwrap) {1397 if (metadata_wrap) { 1391 1398 // need to be a bit more careful about this 1392 // => test for it *without* spanwrap , and if defined, then1393 // got back and generate it again, this time with spanwrap on1394 1395 metadata_ spanwrap = false;1399 // => test for it *without* spanwrap or divwrap, and if defined, then 1400 // got back and generate it again, this time with spanwrap/divwrap on 1401 1402 metadata_wrap = false; 1396 1403 text_t test_tmp = format_string (collection,collectproto,docinfo, disp, orptr, 1397 1404 options, logout); 1398 metadata_ spanwrap = true;1405 metadata_wrap = true; 1399 1406 if (!test_tmp.empty()) { 1400 1407 … … 1665 1672 if (decision.command == dMeta) { 1666 1673 1667 bool store_metadata_ spanwrap = metadata_spanwrap;1668 metadata_ spanwrap = 0;1669 1670 // temporarily suspend metadata- spanwrap (if on) so can test if metadata item really exits or not1674 bool store_metadata_wrap = metadata_wrap; 1675 metadata_wrap = 0; 1676 1677 // temporarily suspend metadata-XXXwrap (if on) so can test if metadata item really exits or not 1671 1678 bool metadata_exists 1672 1679 = (get_meta (collection,collectproto,docinfo,disp,decision.meta,options, 1673 1680 logout) != ""); 1674 1681 1675 metadata_ spanwrap = store_metadata_spanwrap;1682 metadata_wrap = store_metadata_wrap; 1676 1683 1677 1684 if (metadata_exists) { … … 1897 1904 break; 1898 1905 case comMetadataSpanWrap: 1899 metadata_ spanwrap=true;return "";1906 metadata_wrap=true; metadata_wrap_type="span"; return ""; 1900 1907 break; 1901 1908 case comEndMetadataSpanWrap: 1902 metadata_spanwrap=false; return ""; 1909 metadata_wrap=false; metadata_wrap_type=""; return ""; 1910 break; 1911 case comMetadataDivWrap: 1912 metadata_wrap=true; metadata_wrap_type="div"; return ""; 1913 break; 1914 case comEndMetadataDivWrap: 1915 metadata_wrap=false; metadata_wrap_type=""; return ""; 1903 1916 break; 1904 1917 case comIf: … … 1960 1973 } 1961 1974 1962 if (metadata_ spanwrap) {1963 text = spanwrap_metatext(text,docinfo.OID,"Text");1975 if (metadata_wrap) { 1976 text = wrap_metatext(text,docinfo.OID,"Text"); 1964 1977 } 1965 1978 … … 2012 2025 summary.replace("\n","
"); 2013 2026 2014 if (metadata_ spanwrap) {2015 summary = spanwrap_metatext(summary,docinfo.OID,"Summary");2027 if (metadata_wrap) { 2028 summary = wrap_metatext(summary,docinfo.OID,"Summary"); 2016 2029 } 2017 2030 -
main/trunk/greenstone2/runtime-src/src/recpt/formattools.h
r22650 r23515 35 35 comDoc, comHighlight, comEndHighlight, 36 36 comMetadataSpanWrap, comEndMetadataSpanWrap, 37 comMetadataDivWrap, comEndMetadataDivWrap, 37 38 comRel, comHref, comSummary, 38 39 comTOC, comImage, comDocumentButtonDetach, comDocumentButtonHighlight,
Note:
See TracChangeset
for help on using the changeset viewer.