Changeset 649 for trunk/gsdl/src/recpt/pageaction.cpp
- Timestamp:
- 1999-10-10T21:14:12+13:00 (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/pageaction.cpp
r604 r649 28 28 /* 29 29 $Log$ 30 Revision 1.16 1999/10/10 08:14:09 sjboddie 31 - metadata now returns mp rather than array 32 - redesigned browsing support (although it's not finished so 33 won't currently work ;-) 34 30 35 Revision 1.15 1999/09/17 04:46:05 sjboddie 31 36 fixed a couple of problems with 'unknown' classifier … … 121 126 } 122 127 123 124 bool pageaction::init (ostream &logout) {125 126 // classify_meta should contain names of all classifiers supported127 // by this receptionist. classifications using metadata names not128 // in this list will be displayed as "unknown"129 classify_meta.insert ("Title");130 classify_meta.insert ("List");131 classify_meta.insert ("Creator");132 classify_meta.insert ("Series");133 classify_meta.insert ("Date");134 classify_meta.insert ("Subject");135 classify_meta.insert ("Organization");136 classify_meta.insert ("Howto");137 classify_meta.insert ("Topic");138 classify_meta.insert ("Browse");139 classify_meta.insert ("People");140 141 return action::init (logout);142 }143 144 145 128 bool pageaction::check_cgiargs (cgiargsinfoclass &/*argsinfo*/, cgiargsclass &/*args*/, 146 129 ostream &/*logout*/) { … … 154 137 response_data = "text/html"; 155 138 } 156 157 158 // define all the macros which might be used by other actions159 // to produce pages.160 void pageaction::define_external_macros (const ColInfoResponse_t &/*collectinfo*/, displayclass &/*disp*/,161 cgiargsclass &/*args*/, recptproto * /*collectproto*/,162 ostream &/*logout*/) {163 }164 165 139 166 140 void pageaction::define_internal_macros (const ColInfoResponse_t &collectinfo, displayclass &disp, … … 203 177 } 204 178 205 unsigned long current_time = time(NULL); 206 text_t homeextra; 179 text_t homeextra = "<center><table width=_pagewidth_><tr valign=top>\n"; 207 180 208 181 recptprotolistclass *rprotolist = recpt->get_recptprotolist_ptr (); … … 213 186 while (rprotolist_here != rprotolist_end) { 214 187 if ((*rprotolist_here).p != NULL) { 188 215 189 text_tarray collist; 216 190 comerror_t err; … … 220 194 text_tarray::iterator collist_end = collist.end(); 221 195 222 homeextra += "<dl>\n"; 223 224 FilterResponse_t response; 225 text_tarray metadata; 226 metadata.push_back ("collectionname"); 227 196 int row1 = 6; 197 int row2 = 4; 198 int count = 1; 228 199 while (collist_here != collist_end) { 229 text_t collectionname = *collist_here; 230 if (get_info ("collection", *collist_here, metadata, false, (*rprotolist_here).p, response, logout)) 231 collectionname = response.docInfo[0].metadata[0].values[0]; 232 200 233 201 ColInfoResponse_t cinfo; 234 202 (*rprotolist_here).p->get_collectinfo (*collist_here, cinfo, err, logout); 235 203 if (err == noError) { 236 text_t link = "<a href=\"_gwcgi_?a=p&p=about&c=" + *collist_here + "\">"; 237 if (!cinfo.receptionist.empty()) 238 link = "<a href=\"" + cinfo.receptionist + "?a=p&p=about&c=" + *collist_here + "\">"; 239 240 homeextra += "<dt>" + link + collectionname + "</a></dt>\n"; 241 homeextra += "<dd>"; 242 if (cinfo.numDocs != 0) homeextra += text_t(cinfo.numDocs) + "_documents_"; 243 if (cinfo.numWords != 0) homeextra += text_t(cinfo.numWords) + "_words_"; 244 unsigned long last_update = (current_time - cinfo.buildDate) / 86400; 245 homeextra += "_lastupdate_ " + text_t(last_update) + " _ago_</dd>\n"; 204 if (cinfo.isPublic) { 205 206 FilterResponse_t response; 207 text_tset metadata; 208 metadata.insert ("collectionname"); 209 metadata.insert ("iconcollection"); 210 metadata.insert ("iconcollectionsmall"); 211 text_t collectionname = *collist_here; 212 text_t alt = collectionname; 213 if (get_info ("collection", *collist_here, metadata, false, 214 (*rprotolist_here).p, response, logout)) { 215 if (!response.docInfo[0].metadata["collectionname"].values[0].empty()) 216 alt = response.docInfo[0].metadata["collectionname"].values[0]; 217 218 if (!response.docInfo[0].metadata["iconcollectionsmall"].values[0].empty()) 219 collectionname = "<img width=150 src=\"" 220 + response.docInfo[0].metadata["iconcollectionsmall"].values[0] 221 + "\" alt=\"" + alt + "\">"; 222 else if (!response.docInfo[0].metadata["iconcollection"].values[0].empty()) 223 collectionname = "<img width=150 src=\"" 224 + response.docInfo[0].metadata["iconcollection"].values[0] 225 + "\" alt=\"" + alt + "\">"; 226 else collectionname = alt; 227 } 228 229 if ((count == 1) || (count == (row1+1)) || (count == ((row1+row2)+1))) 230 homeextra += "<td align=center>"; 231 else homeextra += "<p>"; 232 text_t link = "<a href=\"_gwcgi_?a=p&p=about&c=" + *collist_here + "\">"; 233 if (*collist_here == "chinese") 234 link = "<a href=\"_gwcgi_?a=p&p=about&l=zh&nw=u&c=" + *collist_here + "\">"; 235 236 if (!cinfo.receptionist.empty()) 237 link = "<a href=\"" + cinfo.receptionist + "?a=p&p=about&c=" 238 + *collist_here + "\">"; 239 240 homeextra += link + collectionname + "</a>\n"; 241 242 if ((count == row1) || (count == (row1+row2))) 243 homeextra += "</td>"; 244 245 count ++; 246 } 246 247 } 248 247 249 collist_here ++; 248 250 } 249 homeextra += "</ dl>\n";251 homeextra += "</tr></table></center>\n"; 250 252 disp.setmacro ("homeextra", "home", homeextra); 251 253 } … … 265 267 266 268 FilterResponse_t response; 267 text_t arraymetadata;268 metadata. push_back("Title");269 text_tset metadata; 270 metadata.insert ("Title"); 269 271 bool getParents = false; 270 272 get_children ("", args["c"], metadata, getParents, collectproto, response, logout); … … 272 274 disp.setmacro ("numbrowseoptions", "help", response.docInfo.size()+1); 273 275 274 ResultDocInfo_tarray:: const_iterator here = response.docInfo.begin();275 ResultDocInfo_tarray:: const_iterator end = response.docInfo.end();276 ResultDocInfo_tarray::iterator here = response.docInfo.begin(); 277 ResultDocInfo_tarray::iterator end = response.docInfo.end(); 276 278 277 279 // we're assuming that we've always got a search button … … 280 282 281 283 while (here != end) { 282 text_t title = (*here).metadata[0].values[0]; 283 284 text_tset::const_iterator it = classify_meta.find (title); 285 if (it == classify_meta.end()) title = "Unknown"; 286 287 shorttext += "<li>_text" + title + "short_\n"; 288 longtext += "_text" + title + "long_"; 284 text_t title = (*here).metadata["Title"].values[0]; 285 286 text_t stext, ltext; 287 disp.expandstring ("document", "_text" + title + "short_", stext); 288 if (stext == ("_text" + title + "short_")) { 289 stext = "<li>_textdefaultshorttext_"; 290 ltext = "_textdefaultlongtext_"; 291 } else { 292 shorttext += "<li>" + stext; 293 longtext += "_text" + title + "long_"; 294 } 289 295 here ++; 290 296 }
Note:
See TracChangeset
for help on using the changeset viewer.