Changeset 4905
- Timestamp:
- 2003-07-12T04:29:59+12:00 (21 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/pageaction.cpp
r4774 r4905 24 24 *********************************************************************/ 25 25 26 // Changelog: 27 28 // 11th July 2003: 29 30 // Added 3 functions to deal with the collection style 31 // A deciding function and then 2 functions that actually 32 // do the work for us, either images or pulldown. 33 34 26 35 #include "OIDtools.h" 27 36 #include "pageaction.h" … … 104 113 } 105 114 106 void pageaction::set_homeextra_macro (displayclass &disp, recptprotolistclass *protos, 107 cgiargsclass &args, ostream &logout) { 108 text_t homeextra = "<center><table width=_pagewidth_><tr valign=top>\n"; 109 bool found_valid_col = false; 110 115 // This function helps decide whether we want a 116 // images or pulldown style collection display 117 // We refer to the macro files for the options 118 // for images or pulldown menu and use that to 119 // switch to the appropriate function to do the job 120 121 // Aly Dharshi 122 // 11th July 2003 123 124 void pageaction::homepagestyle(displayclass &disp, recptprotolistclass *protos, 125 cgiargsclass &args, ostream &logout) 126 { 127 128 const recptconf &configinfo = recpt->get_configinfo(); 129 130 if (configinfo.HomePageType == "images") { 131 home_images(disp, protos, args, configinfo, logout); 132 133 } else 134 { 135 home_pulldown(disp, protos, args, configinfo, logout); 136 } 137 } 138 139 // This function allows for the Greenstone 140 // collection to be displayed in a pull down 141 // menu similar to that in documentaction.cpp 142 143 // Aly Dharshi 144 // 11th July 2003 145 146 void pageaction::home_pulldown(displayclass &disp, recptprotolistclass *protos, 147 cgiargsclass &args, const recptconf &configinfo, 148 ostream &logout) { 149 150 //text_t homeextra = "<center><table width=_pagewidth_><tr valign=top>\n"; 151 //bool found_valid_col = false; 152 153 text_t homeextra = "<form method=\"get\" name=\"browse\">\n"; 154 homeextra += "<select name=\"collections\" onChange=\"location.href="; 155 homeextra += "document.browse.collections.options[document.browse.collections.selectedIndex].value\">\n"; 156 157 111 158 recptprotolistclass::iterator rprotolist_here = protos->begin(); 112 159 recptprotolistclass::iterator rprotolist_end = protos->end(); … … 164 211 } 165 212 213 FilterResponse_t response; 214 text_tset metadata; 215 metadata.insert ("collectionname"); 216 text_t collectionname = *collist_here; 217 218 if (get_info ("collection", *collist_here, metadata, false, 219 (*rprotolist_here).p, response, logout)) { 220 if (!response.docInfo[0].metadata["collectionname"].values[0].empty()) 221 collectionname = response.docInfo[0].metadata["collectionname"].values[0]; 222 } 223 224 comerror_t err; 225 text_t optsite = ""; 226 text_t site_name = (*rprotolist_here).p->get_site_name (err); 227 if (!site_name.empty()) { optsite = "site="+site_name+"&"; } 228 229 text_t link = "_gwcgi_?"+optsite+"a=p&p=about&c=" + *collist_here + coll_type; 230 link += "&l=" + args["l"] + "&w=" + args["w"]; 231 232 // We are "dynamically" overriding so to speak the 233 // link to the collection aka receptionist. 234 235 if (!cinfo->receptionist.empty()) 236 link = cinfo->receptionist; 237 238 239 homeextra += "<option value=\"" + link + "\""; 240 homeextra += ">" + collectionname + "</option>\n"; 241 242 } 243 244 collist_here ++; 245 } 246 247 } 248 } 249 rprotolist_here ++; 250 } 251 252 } 253 homeextra += "</select>\n"; 254 homeextra += "</form>\n"; 255 256 disp.setmacro ("homeextra", "home", homeextra); 257 } 258 259 // originally called set_homeextra_macro 260 // this function displays the Greenstone 261 // main page as usual with the graphics for 262 // the collections. 263 264 // Aly Dharshi 265 // 11th July 2003 266 267 void pageaction::home_images(displayclass &disp, recptprotolistclass *protos, 268 cgiargsclass &args, const recptconf &configinfo, 269 ostream &logout) { 270 271 text_t homeextra = "<center><table width=_pagewidth_><tr valign=top>\n"; 272 bool found_valid_col = false; 273 274 recptprotolistclass::iterator rprotolist_here = protos->begin(); 275 recptprotolistclass::iterator rprotolist_end = protos->end(); 276 while (rprotolist_here != rprotolist_end) { 277 if ((*rprotolist_here).p != NULL) { 278 279 text_tarray collist; 280 comerror_t err; 281 (*rprotolist_here).p->get_collection_list (collist, err, logout); 282 if (err == noError) { 283 text_tarray::iterator collist_here = collist.begin(); 284 text_tarray::iterator collist_end = collist.end(); 285 286 int count = 0; 287 bool first = true; 288 while (collist_here != collist_end) { 289 ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr ((*rprotolist_here).p, *collist_here, logout); 290 291 if (cinfo != NULL) { 292 if (cinfo->isPublic && (cinfo->buildDate > 0)) { 293 294 text_t coll_type = "&ct="; 295 if (cinfo->buildType == "mgpp") { 296 coll_type += "1&qto="; 297 298 // now we also want to check search types to set the qto arg 299 if (cinfo->searchTypes.size() == 0) { 300 coll_type += "3"; // default to 3 (= both) 301 } else { 302 unsigned int search_types = 0; 303 text_tarray::const_iterator type_here = cinfo->searchTypes.begin(); 304 text_tarray::const_iterator type_end = cinfo->searchTypes.end(); 305 306 while (type_here != type_end) { 307 if (*type_here == "form") { 308 search_types |= 2; 309 } else if (*type_here == "plain") { 310 search_types |= 1; 311 } 312 type_here ++; 313 } 314 coll_type += search_types; 315 if (search_types == 3) { 316 // both were specified, now need to look at the order to see which is the default 317 type_here = cinfo->searchTypes.begin(); 318 if (*type_here == "form") { 319 coll_type += "&qt=1"; // set the default to form 320 } 321 } 322 323 } 324 } 325 else { 326 coll_type += "0"; 327 } 328 166 329 found_valid_col = true; 167 330 FilterResponse_t response; … … 215 378 216 379 } 217 if ((count% 3== 0) && (!first))380 if ((count%configinfo.HomePageCols == 0) && (!first)) 218 381 homeextra += "</tr><tr valign=top>\n"; 219 382 … … 238 401 } 239 402 240 for (; count% 3!= 0; count ++) homeextra += "<td></td>\n";403 for (; count%configinfo.HomePageCols != 0; count ++) homeextra += "<td></td>\n"; 241 404 } 242 405 } … … 614 777 615 778 if (arg_p == "home") { 616 set_homeextra_macro(disp, protos, args, logout);779 homepagestyle (disp, protos, args, logout); 617 780 } else if (arg_p == "homehelp") { 618 781 set_collectionlist_macro (disp, protos, logout); -
trunk/gsdl/src/recpt/pageaction.h
r3774 r4905 66 66 void configure (const text_t &key, const text_tarray &cfgline); 67 67 68 protected: 69 void set_homeextra_macro (displayclass &disp, recptprotolistclass *protos, 70 cgiargsclass &args, ostream &logout); 68 protected: 69 70 void home_images (displayclass &disp, recptprotolistclass *protos, 71 cgiargsclass &args, const recptconf &configinfo, ostream &logout); 72 73 void home_pulldown (displayclass &disp, recptprotolistclass *protos, 74 cgiargsclass &args, const recptconf &configinfo, ostream &logout); 75 76 void homepagestyle (displayclass &disp, recptprotolistclass *protos, 77 cgiargsclass &args, ostream &logout); 78 71 79 80 72 81 void set_collectionlist_macro (displayclass &disp, recptprotolistclass *protos, 73 82 ostream &logout); … … 83 92 84 93 94 85 95 bool status_disabled; 86 96 bool collector_disabled; -
trunk/gsdl/src/recpt/receptionist.cpp
r4290 r4905 73 73 encodings.erase(encodings.begin(), encodings.end()); 74 74 75 HomePageType = "images"; 76 HomePageCols = 3; 77 75 78 // these default page parameters can always be overriden 76 79 // in the configuration file … … 268 271 } 269 272 } 270 273 274 else if (key == "SiteFormat") { 275 if (cfgline[0] == "HomePageType") { 276 configinfo.HomePageType = cfgline[1]; 277 } else if (cfgline[0] == "HomePageCols") { 278 configinfo.HomePageCols = cfgline[1].getint(); 279 } 280 } 281 271 282 else if (key == "cgiarg") { 272 283 // get shortname -
trunk/gsdl/src/recpt/receptionist.h
r3664 r4905 98 98 bool EmailUserEvents; 99 99 100 text_t HomePageType; 101 int HomePageCols; 102 100 103 text_tmap pageparams; 101 104 text_t macroprecedence;
Note:
See TracChangeset
for help on using the changeset viewer.