- Timestamp:
- 1999-12-06T10:27:30+13:00 (24 years ago)
- Location:
- trunk/gsdl/src/colservr
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/colservr/mggdbmsource.cpp
r722 r803 28 28 /* 29 29 $Log$ 30 Revision 1.18 1999/12/05 21:27:30 sjboddie 31 added support for multiple gsdlhomes and gdbmhome 32 30 33 Revision 1.17 1999/10/19 03:23:40 davidb 31 34 Collection building support through web pages … … 110 113 else if (key == "collectdir") collectdir = value; 111 114 else if (key == "gsdlhome") gsdlhome = value; 115 else if (key == "gdbmhome") gdbmhome = value; 112 116 } 113 117 … … 134 138 outconvertclass text_t2ascii; 135 139 140 if (gdbmhome.empty()) gdbmhome = gsdlhome; 141 136 142 if (!sourceclass::init (logout)) return false; 137 143 138 144 // get the collection directory name 139 145 if (collectdir.empty()) { 140 collectdir = filename_cat (g sdlhome, "collect", collection);146 collectdir = filename_cat (gdbmhome, "collect", collection); 141 147 } 142 148 … … 190 196 } 191 197 192 bool mggdbmsourceclass::get_metadata (const text_t & /*requestParams*/, const text_t &/*refParams*/,198 bool mggdbmsourceclass::get_metadata (const text_t &requestParams, const text_t &refParams, 193 199 bool getParents, const text_tset &fields, 194 200 const text_t &OID, MetadataInfo_tmap &metadata, … … 264 270 text_tset::const_iterator fields_here = tfields.begin(); 265 271 text_tset::const_iterator fields_end = tfields.end(); 272 266 273 while (fields_here != fields_end) { 267 274 this_metadata.clear(); … … 271 278 vector<infodbclass>::reverse_iterator end_info = info_array.rend(); 272 279 MetadataInfo_t *tmetaptr = &this_metadata; 280 int count = 0; 273 281 while (this_info != end_info) { 274 282 275 283 pos_metadata = (*this_info).getmultinfo(*fields_here); 276 277 284 if ((*fields_here == "hasnext" || *fields_here == "hasprevious")) { 278 285 … … 283 290 // cache parent contents array 284 291 text_t thisparent = get_parent (OID); 285 if (thisparent != parentOID) { 286 parentOID = thisparent; 287 parentcontents.erase(parentcontents.begin(), parentcontents.end()); 288 if (gdbmptr->getinfo(parentOID, parentinfo)) { 289 text_t &parentinfocontains = parentinfo["contains"]; 290 if (!parentinfocontains.empty()) 291 splitchar (parentinfocontains.begin(), parentinfocontains.end(), 292 ';', parentcontents); 292 if (!thisparent.empty()) { 293 if (thisparent != parentOID) { 294 parentOID = thisparent; 295 parentcontents.erase(parentcontents.begin(), parentcontents.end()); 296 if (gdbmptr->getinfo(parentOID, parentinfo)) { 297 text_t &parentinfocontains = parentinfo["contains"]; 298 if (!parentinfocontains.empty()) 299 splitchar (parentinfocontains.begin(), parentinfocontains.end(), 300 ';', parentcontents); 301 } 293 302 } 294 } 295 296 // do tests 297 text_tarray::const_iterator parentcontents_here = parentcontents.begin(); 298 text_tarray::const_iterator parentcontents_end = parentcontents.end(); 299 text_t shrunk_OID = OID; 300 shrink_parent (shrunk_OID); 301 while (parentcontents_here != parentcontents_end) { 302 if (*parentcontents_here == shrunk_OID) { 303 if (parentcontents_here == parentcontents.begin()) hasprevious = false; 304 else hasprevious = true; 303 304 // do tests 305 text_tarray::const_iterator parentcontents_here = parentcontents.begin(); 306 text_tarray::const_iterator parentcontents_end = parentcontents.end(); 307 text_t shrunk_OID = OID; 308 shrink_parent (shrunk_OID); 309 while (parentcontents_here != parentcontents_end) { 310 if (*parentcontents_here == shrunk_OID) { 311 if (parentcontents_here == parentcontents.begin()) hasprevious = false; 312 else hasprevious = true; 313 314 parentcontents_here++; 315 316 if (parentcontents_here == parentcontents.end()) hasnext = false; 317 else hasnext = true; 318 319 break; 320 } 305 321 306 parentcontents_here++; 307 308 if (parentcontents_here == parentcontents.end()) hasnext = false; 309 else hasnext = true; 310 311 break; 312 } 313 314 parentcontents_here ++; 315 } 316 } 317 318 // fill in metadata 319 if ((*fields_here == "hasnext" && hasnext) || 320 (*fields_here == "hasprevious" && hasprevious)) 321 tmetaptr->values.push_back("1"); 322 else 323 tmetaptr->values.push_back("0"); 324 322 parentcontents_here ++; 323 } 324 325 // fill in metadata 326 if ((*fields_here == "hasnext" && hasnext) || 327 (*fields_here == "hasprevious" && hasprevious)) 328 tmetaptr->values.push_back("1"); 329 else 330 tmetaptr->values.push_back("0"); 331 } else 332 tmetaptr->values.push_back("0"); 333 } 325 334 } 326 else if (pos_metadata != NULL && *fields_here != "contains") 335 else if (pos_metadata != NULL && *fields_here != "contains") { 327 336 tmetaptr->values = *pos_metadata; 337 } 328 338 else 329 339 tmetaptr->values.push_back(""); … … 336 346 } 337 347 metadata[*fields_here] = this_metadata; 338 339 348 fields_here++; 340 349 } 341 342 350 return true; 343 351 } -
trunk/gsdl/src/colservr/mggdbmsource.h
r650 r803 42 42 protected: 43 43 text_t gsdlhome; 44 text_t gdbmhome; 44 45 text_t collection; 45 46 text_t collectdir;
Note:
See TracChangeset
for help on using the changeset viewer.