Changeset 761 for trunk/gsdl/src/recpt/pageaction.cpp
- Timestamp:
- 1999-11-02T10:58:02+13:00 (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/pageaction.cpp
r729 r761 28 28 /* 29 29 $Log$ 30 Revision 1.20 1999/11/01 21:58:02 sjboddie 31 changes to arguments of many functions, now pass list of protocols 32 instead of just that for this collection 33 30 34 Revision 1.19 1999/10/19 21:59:09 sjboddie 31 35 bug in generating "how to find information" text for about pages … … 142 146 } 143 147 144 void pageaction::get_cgihead_info (cgiargsclass &/*args*/, response_t &response, 145 text_t &response_data, ostream &/*logout*/) { 148 void pageaction::get_cgihead_info (cgiargsclass &/*args*/, recptprotolistclass * /*protos*/, 149 response_t &response,text_t &response_data, 150 ostream &/*logout*/) { 146 151 response = content; 147 152 response_data = "text/html"; 148 153 } 149 154 150 void pageaction::define_internal_macros (const ColInfoResponse_t &collectinfo, displayclass &disp, 151 cgiargsclass &args, recptproto *collectproto, 152 ostream &logout) { 155 void pageaction::set_homeextra_macro (displayclass &disp, recptprotolistclass *protos, 156 ostream &logout) { 157 158 text_t homeextra = "<center><table width=_pagewidth_><tr valign=top>\n"; 159 160 recptprotolistclass::iterator rprotolist_here = protos->begin(); 161 recptprotolistclass::iterator rprotolist_end = protos->end(); 162 while (rprotolist_here != rprotolist_end) { 163 if ((*rprotolist_here).p != NULL) { 164 165 text_tarray collist; 166 comerror_t err; 167 (*rprotolist_here).p->get_collection_list (collist, err, logout); 168 if (err == noError) { 169 text_tarray::iterator collist_here = collist.begin(); 170 text_tarray::iterator collist_end = collist.end(); 171 172 int row1 = 6; 173 int row2 = 4; 174 int count = 1; 175 while (collist_here != collist_end) { 176 177 if (*collist_here == "niupepa") 178 homeextra += "<p><a href=\"_httpmusiclibrary_\">_iconmusiclibrary_</a>\n"; 179 180 ColInfoResponse_t cinfo; 181 (*rprotolist_here).p->get_collectinfo (*collist_here, cinfo, err, logout); 182 183 if (err == noError) { 184 if (cinfo.isPublic && (cinfo.buildDate > 0)) { 185 186 FilterResponse_t response; 187 text_tset metadata; 188 metadata.insert ("collectionname"); 189 metadata.insert ("iconcollection"); 190 metadata.insert ("iconcollectionsmall"); 191 text_t collectionname = *collist_here; 192 text_t alt = collectionname; 193 if (get_info ("collection", *collist_here, metadata, false, 194 (*rprotolist_here).p, response, logout)) { 195 if (!response.docInfo[0].metadata["collectionname"].values[0].empty()) 196 alt = response.docInfo[0].metadata["collectionname"].values[0]; 197 198 if (!response.docInfo[0].metadata["iconcollectionsmall"].values[0].empty()) 199 collectionname = "<img width=150 border=1 src=\"" 200 + response.docInfo[0].metadata["iconcollectionsmall"].values[0] 201 + "\" alt=\"" + alt + "\">"; 202 else if (!response.docInfo[0].metadata["iconcollection"].values[0].empty()) 203 collectionname = "<img width=150 border=1 src=\"" 204 + response.docInfo[0].metadata["iconcollection"].values[0] 205 + "\" alt=\"" + alt + "\">"; 206 else collectionname = alt; 207 } 208 209 if ((count == 1) || (count == (row1+1)) || (count == ((row1+row2)+1))) 210 homeextra += "<td align=center>"; 211 else homeextra += "<p>"; 212 text_t link = "<a href=\"_gwcgi_?a=p&p=about&c=" + *collist_here + "\">"; 213 if (*collist_here == "chinese") 214 link = "<a href=\"_gwcgi_?a=p&p=about&l=zh&nw=u&c=" + *collist_here + "\">"; 215 216 if (!cinfo.receptionist.empty()) 217 link = "<a href=\"" + cinfo.receptionist + "?a=p&p=about&c=" 218 + *collist_here + "\">"; 219 220 homeextra += link + collectionname + "</a>\n"; 221 222 if ((count == row1) || (count == (row1+row2))) 223 homeextra += "</td>"; 224 225 count ++; 226 } 227 } 228 229 collist_here ++; 230 } 231 homeextra += "</tr></table></center>\n"; 232 disp.setmacro ("homeextra", "home", homeextra); 233 } 234 } 235 rprotolist_here ++; 236 } 237 } 238 239 void pageaction::define_internal_macros (displayclass &disp, cgiargsclass &args, 240 recptprotolistclass *protos, ostream &logout) { 153 241 154 242 // define_internal_macros sets the following macros: … … 177 265 text_t &arg_p = args["p"]; 178 266 179 if (arg_p == "home") { 180 // make sure we know about a receptionist 181 if (recpt == NULL) { 182 logout << "The page action does not contain information\n" 183 << "about any receptionists. The method set_receptionist\n" 184 << "was probably not called from the module which instantiated\n" 185 << "this page action.\n"; 186 return; 267 if (arg_p == "home") set_homeextra_macro (disp, protos, logout); 268 269 else if (arg_p == "about" || arg_p == "help") { 270 // get pointer to collection server 271 recptproto* collectproto = protos->getrecptproto (args["c"], logout); 272 if (collectproto == NULL) return; 273 274 if (arg_p == "about") { 275 comerror_t err; 276 ColInfoResponse_t cinfo; 277 collectproto->get_collectinfo (args["c"], cinfo, err, logout); 278 279 disp.setmacro ("numdocs", "about", cinfo.numDocs); 280 unsigned long current_time = time(NULL); 281 unsigned long builddate = (current_time - cinfo.buildDate) / 86400; 282 disp.setmacro ("builddate", "about", builddate); 187 283 } 188 189 text_t homeextra = "<center><table width=_pagewidth_><tr valign=top>\n"; 190 191 recptprotolistclass *rprotolist = recpt->get_recptprotolist_ptr (); 192 if (rprotolist == NULL) return; 193 194 recptprotolistclass::iterator rprotolist_here = rprotolist->begin(); 195 recptprotolistclass::iterator rprotolist_end = rprotolist->end(); 196 while (rprotolist_here != rprotolist_end) { 197 if ((*rprotolist_here).p != NULL) { 198 199 text_tarray collist; 200 comerror_t err; 201 (*rprotolist_here).p->get_collection_list (collist, err, logout); 202 if (err == noError) { 203 text_tarray::iterator collist_here = collist.begin(); 204 text_tarray::iterator collist_end = collist.end(); 205 206 int row1 = 6; 207 int row2 = 4; 208 int count = 1; 209 while (collist_here != collist_end) { 210 211 if (*collist_here == "niupepa") 212 homeextra += "<p><a href=\"_httpmusiclibrary_\">_iconmusiclibrary_</a>\n"; 213 214 215 ColInfoResponse_t cinfo; 216 (*rprotolist_here).p->get_collectinfo (*collist_here, cinfo, err, logout); 217 218 if (err == noError) { 219 if (cinfo.isPublic && (cinfo.buildDate > 0)) { 220 221 FilterResponse_t response; 222 text_tset metadata; 223 metadata.insert ("collectionname"); 224 metadata.insert ("iconcollection"); 225 metadata.insert ("iconcollectionsmall"); 226 text_t collectionname = *collist_here; 227 text_t alt = collectionname; 228 if (get_info ("collection", *collist_here, metadata, false, 229 (*rprotolist_here).p, response, logout)) { 230 if (!response.docInfo[0].metadata["collectionname"].values[0].empty()) 231 alt = response.docInfo[0].metadata["collectionname"].values[0]; 232 233 if (!response.docInfo[0].metadata["iconcollectionsmall"].values[0].empty()) 234 collectionname = "<img width=150 border=1 src=\"" 235 + response.docInfo[0].metadata["iconcollectionsmall"].values[0] 236 + "\" alt=\"" + alt + "\">"; 237 else if (!response.docInfo[0].metadata["iconcollection"].values[0].empty()) 238 collectionname = "<img width=150 border=1 src=\"" 239 + response.docInfo[0].metadata["iconcollection"].values[0] 240 + "\" alt=\"" + alt + "\">"; 241 else collectionname = alt; 242 } 243 244 if ((count == 1) || (count == (row1+1)) || (count == ((row1+row2)+1))) 245 homeextra += "<td align=center>"; 246 else homeextra += "<p>"; 247 text_t link = "<a href=\"_gwcgi_?a=p&p=about&c=" + *collist_here + "\">"; 248 if (*collist_here == "chinese") 249 link = "<a href=\"_gwcgi_?a=p&p=about&l=zh&nw=u&c=" + *collist_here + "\">"; 250 251 if (!cinfo.receptionist.empty()) 252 link = "<a href=\"" + cinfo.receptionist + "?a=p&p=about&c=" 253 + *collist_here + "\">"; 254 255 homeextra += link + collectionname + "</a>\n"; 256 257 if ((count == row1) || (count == (row1+row2))) 258 homeextra += "</td>"; 259 260 count ++; 261 } 262 } 263 264 collist_here ++; 265 } 266 homeextra += "</tr></table></center>\n"; 267 disp.setmacro ("homeextra", "home", homeextra); 268 } 269 } 270 rprotolist_here ++; 271 } 272 } else if (arg_p == "about") { 273 disp.setmacro ("numdocs", "about", collectinfo.numDocs); 274 unsigned long current_time = time(NULL); 275 unsigned long builddate = (current_time - collectinfo.buildDate) / 86400; 276 disp.setmacro ("builddate", "about", builddate); 277 } 278 279 if (arg_p == "about" || arg_p == "help") { 280 284 281 285 // _textbrowseoptions_ and _numbrowseoptions_ 282 286 283 287 FilterResponse_t response; 284 288 text_tset metadata; … … 316 320 } 317 321 318 bool pageaction::do_action (cgiargsclass &args, const ColInfoResponse_t &/*collectinfo*/,319 recptproto * /*collectproto*/, displayclass &disp,322 bool pageaction::do_action (cgiargsclass &args, recptprotolistclass * /*protos*/, 323 browsermapclass * /*browsers*/, displayclass &disp, 320 324 outconvertclass &outconvert, ostream &textout, 321 325 ostream &/*logout*/) {
Note:
See TracChangeset
for help on using the changeset viewer.