Changeset 257 for trunk/gsdl/src/recpt
- Timestamp:
- 1999-05-10T15:40:44+12:00 (25 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/Makefile
r248 r257 599 599 /usr/include/g++/map.h /usr/include/gdbm.h \ 600 600 ../../packages/mg-1.3d/lib/unitool.h ../../lib/gsdlunicode.h \ 601 ../../lib/fileutil.h 601 ../../lib/fileutil.h OIDtools.h recptproto.h comtypes.h 602 602 mgq.o: mgq.c mgq.h /usr/include/stdio.h /usr/include/features.h \ 603 603 /usr/include/sys/cdefs.h /usr/include/libio.h \ … … 743 743 /usr/include/g++/projectn.h /usr/include/g++/map \ 744 744 /usr/include/g++/map.h comtypes.h filter.h source.h infodbclass.h \ 745 /usr/include/gdbm.h /usr/include/assert.h745 /usr/include/gdbm.h OIDtools.h recptproto.h /usr/include/assert.h 746 746 colservrconfig.o: colservrconfig.cpp colservrconfig.h \ 747 747 ../../lib/gsdlconf.h ../../lib/site.h ../../lib/text_t.h \ -
trunk/gsdl/src/recpt/OIDtools.cpp
r248 r257 12 12 /* 13 13 $Log$ 14 Revision 1.6 1999/05/10 03:40:25 sjboddie 15 lots of changes - slowly getting document action sorted out 16 14 17 Revision 1.5 1999/04/30 01:59:37 sjboddie 15 18 lots of stuff - getting documentaction working (documentaction replaces … … 38 41 39 42 40 // get first four characters of whatever string is passed in41 // OID. This returns the CLSU, HASH etc.42 void get_head (const text_t &OID, text_t &head) {43 44 head.clear();45 if (OID.size() < 4) return;46 head.appendrange (OID.begin(), (OID.begin() + 4));47 }48 49 50 43 // returns (in top) the top level of OID (i.e. everything 51 44 // up until the first dot) … … 76 69 77 70 78 // is_classification checks OID to see if it's a classification79 // or a document. I'm not sure how to do this - for now I'll just assume80 // all documents start with HASH and classifications start with something81 // else.82 bool is_classification (const text_t &OID) {83 text_t head;84 get_head (OID, head);85 if (head == "HASH") return false;86 return true;87 }88 89 71 // get_parents_array loads the parents array with all the parents of the 90 // document or classification specified by OID 91 // note that this function doesn't clear the parents array 72 // document or classification specified by OID 92 73 void get_parents_array (const text_t &OID, text_tarray &parents) { 74 75 parents.erase (parents.begin(), parents.end()); 93 76 94 77 text_t::const_iterator here = OID.begin (); … … 134 117 } 135 118 119 // has_children returns true if OID has children 120 bool has_children (const text_t &OID, const text_t &collection, 121 recptproto *collectproto, ostream &logout) { 122 123 FilterResponse_t response; 124 text_tarray metadata; 125 metadata.push_back ("haschildren"); 126 127 if (get_info (OID, collection, metadata, collectproto, 128 response, logout)) { 129 if (response.docInfo[0].metadata[0].values[0] == "1") 130 return true; 131 } 132 return false; 133 } 134 135 136 136 // get_children does a protocol call and returns (in response) the OIDs and 137 137 // metadata of all the children of OID. The metadata array should be loaded … … 168 168 } 169 169 170 // get_first_child does a protocol call and returns (in child) the OID171 // of the first child of OID if it exists172 bool get_first_child (const text_t &OID, text_t &child, const text_t &collection,173 recptproto *collectproto, ostream logout) {174 175 comerror_t err;176 FilterResponse_t response;177 FilterRequest_t request;178 OptionValue_t option;179 180 request.filterName = "BrowseFilter";181 option.name = "EndResults";182 option.value = "1";183 request.filterOptions.push_back (option);184 option.name = "ParentNode";185 option.value = OID;186 request.filterOptions.push_back (option);187 request.filterResultOptions = FROID;188 189 collectproto->filter (collection, request, response, err, logout);190 191 if (err != noError) {192 outconvertclass text_t2ascii;193 logout << text_t2ascii194 << "Error: call to filter failed for " << OID195 << " in OIDtools::get_first_child ("196 << get_comerror_string (err) << ")\n";197 return false;198 }199 200 if (response.docInfo[0].OID.empty())201 return false;202 else203 child = response.docInfo[0].OID;204 return true;205 }206 207 170 // get_parent returns the parent of the document or classification 208 171 // specified by OID … … 222 185 } 223 186 224 // takes an OID like ".2 .3and replaces the " with parent187 // takes an OID like ".2 and replaces the " with parent 225 188 void translate_parent (text_t &OID, const text_t &parent) { 226 189 … … 240 203 void shrink_parent (text_t &OID) { 241 204 242 text_t::iterator parit = findchar (OID.begin(), OID.end(), '.'); 243 if (parit == OID.end()) return; 244 245 OID.erase (OID.begin(), parit); 246 OID = "\"" + OID; 205 text_tarray tmp; 206 splitchar (OID.begin(), OID.end(), '.', tmp); 207 OID = "\"." + tmp.back(); 247 208 } 248 209 … … 260 221 return false; 261 222 } 223 224 225 void recurse_contents (const ResultDocInfo_t section, const bool &classify, 226 int &totalcols, const text_t &collection, 227 const text_tarray &metadata, recptproto *collectproto, 228 FilterResponse_t &response, ostream &logout) { 229 230 int haschildren = section.metadata[1].values[0].getint(); 231 const text_t &doctype = section.metadata[2].values[0]; 232 int cols; 233 234 if ((haschildren == 1) && ((!classify) || (doctype == "classify"))) { 235 text_t parent = response.docInfo.back().OID; 236 int parentcols = countchar (parent.begin(), parent.end(), '.'); 237 FilterResponse_t tmp; 238 get_children (section.OID, collection, metadata, collectproto, tmp, logout); 239 ResultDocInfo_tarray::const_iterator thisdoc = tmp.docInfo.begin(); 240 ResultDocInfo_tarray::const_iterator lastdoc = tmp.docInfo.end(); 241 while (thisdoc != lastdoc) { 242 if (((*thisdoc).metadata[2].values[0] != "classify") && (classify)) 243 cols = parentcols + 1; 244 else 245 cols = countchar ((*thisdoc).OID.begin(), (*thisdoc).OID.end(), '.'); 246 if (cols > totalcols) totalcols = cols; 247 response.docInfo.push_back (*thisdoc); 248 recurse_contents (*thisdoc, classify, totalcols, collection, 249 metadata, collectproto, response, logout); 250 thisdoc ++; 251 } 252 } 253 } 254 255 // get_contents returns OIDs and metadata of all contents 256 // below (and including) OID. 257 // metadata being returned for each is Title, haschildren, 258 // doctype, and hastxt 259 void get_contents (const text_t &topOID, const text_t &classifytype, int &totalcols, 260 const text_t &collection, recptproto *collectproto, 261 FilterResponse_t &response, ostream &logout) { 262 263 bool classify = false; 264 response.clear(); 265 text_tarray metadata; 266 metadata.push_back ("Title"); 267 metadata.push_back ("haschildren"); 268 metadata.push_back ("doctype"); 269 metadata.push_back ("hastxt"); 270 271 // we don't want to recurse all the way down through each document 272 // if we're expanding top level contents 273 if (classifytype == "classify") classify = true; 274 275 // update totalcols 276 totalcols = countchar (topOID.begin(), topOID.end(), '.'); 277 278 // get topOIDs info 279 if (get_info (topOID, collection, metadata, collectproto, response, logout)) 280 recurse_contents (response.docInfo[0], classify, totalcols, collection, 281 metadata, collectproto, response, logout); 282 } -
trunk/gsdl/src/recpt/OIDtools.h
r248 r257 17 17 #include "recptproto.h" 18 18 19 // get first four characters of whatever string is passed in20 // OID. This returns the CLSU, HASH etc.21 void get_head (const text_t &OID, text_t &head);22 23 19 // returns (in top) the top level of OID (i.e. everything 24 20 // up until the first dot) … … 27 23 // checks if OID is top level (i.e. contains no dots) 28 24 bool is_top (const text_t &OID); 29 30 // is_classification checks OID to see if it's a classification31 // or a document. I'm not sure how to do this - for now I'll just assume32 // all documents start with HASH and classifications start with something33 // else.34 bool is_classification (const text_t &OID);35 25 36 26 // get_parents_array loads the parents array with all the parents of the … … 46 36 FilterResponse_t &response, ostream &logout); 47 37 38 // has_children returns true if OID has children 39 bool has_children (const text_t &OID, const text_t &collection, 40 recptproto *collectproto, ostream &logout); 41 48 42 // get_children does a protocol call and returns (in response) the OIDs and 49 43 // metadata of all the children of OID. The metadata array should be loaded … … 52 46 const text_tarray &metadata, recptproto *collectproto, 53 47 FilterResponse_t &response, ostream &logout); 54 55 // get_first_child does a protocol call and returns (in child) the OID56 // of the first child of OID if it exists57 bool get_first_child (const text_t &OID, text_t &child, const text_t &collection,58 recptproto *collectproto, ostream logout);59 48 60 49 // get_parent returns the parent of the document or classification … … 73 62 bool needs_translating (const text_t &OID); 74 63 64 // get_contents returns OIDs and metadata of all contents 65 // below (and including) OID. 66 // at present the only metadata being returned for each is 67 // Title and haschildren 68 void get_contents (const text_t &topOID, const text_t &classifytype, int &totalcols, 69 const text_t &collection, recptproto *collectproto, 70 FilterResponse_t &response, ostream &logout); 71 75 72 #endif -
trunk/gsdl/src/recpt/browsetools.cpp
r248 r257 12 12 /* 13 13 $Log$ 14 Revision 1.4 1999/05/10 03:40:26 sjboddie 15 lots of changes - slowly getting document action sorted out 16 14 17 Revision 1.3 1999/04/30 01:59:39 sjboddie 15 18 lots of stuff - getting documentaction working (documentaction replaces … … 32 35 // ouput_book_toc generates and outputs a Book type table of contents 33 36 // it should only be called for document level tocs (i.e. when "d" 34 // argument is set) so it soes nothing if "d" isn't set37 // argument is set) so it does nothing if "d" isn't set 35 38 // This toc is intended for use with collections whose documents are 36 39 // simply numbered as pages. … … 71 74 << "<p><center>\n" 72 75 << "<table cellpadding=0 cellspacing=0 width=_pagewidth_>\n" 73 << "<tr valign= absmiddle>\n";76 << "<tr valign=top><td>\n"; 74 77 75 78 // don't want arrows and page number if text expanded … … 77 80 78 81 // previous arrow 79 textout << outconvert << disp << "<td>_document:prevarrow_</td>\n"; 82 textout << "<table><tr valign=top>\n"; 83 textout << outconvert << disp << "<td align=left>_document:prevarrow_</td>\n"; 80 84 81 85 // page ? of ? text … … 100 104 101 105 // next arrow 102 textout << outconvert << disp << "</td>\n<td>_document:nextarrow_</td>\n"; 103 } 104 106 textout << outconvert << disp << "</td>\n<td align=right>_document:nextarrow_</td>\n</table>\n"; 107 } 108 109 110 // goto line 111 textout << outconvert << disp << "_document:gotoform_"; 112 113 // control buttons 114 output_controls (args, collectproto, disp, outconvert, textout, logout); 115 textout << "</td>\n"; 116 117 // title and author 105 118 textout << outconvert << "\n<td valign=top align=right>\n<h2>" << title << "</h2>\n"; 106 119 … … 108 121 textout << outconvert << "<h4><i>" << author << "</i></h4>\n"; 109 122 110 textout << "</td></tr>\n"; 111 112 // goto line 113 textout << outconvert << disp << "<tr><td colspan=4>_document:gotoform_</td></tr></table>"; 123 textout << "</td></tr></table>\n"; 114 124 textout << "\n<!-- end of Table of Contents -->\n"; 115 } 116 } 117 125 126 127 } 128 } 129 130 // output_hierarchy_toc generates and outputs a Hierarchy type table of contents 131 // this can be used either at top levels (i.e. when "d" argument isn't set) or 132 // at document level 133 // a Hierarchy table of contents may be either expanded or contracted 118 134 void output_hierarchy_toc (const text_t &/*classifytitle*/, cgiargsclass &args, 119 recptproto *collectproto, displayclass &/*disp*/, 120 outconvertclass &/*outconvert*/, ostream &/*textout*/, 121 ostream &/*logout*/) { 122 /* 123 toc.clear(); 124 toc += "\n<!-- Table of Contents produced by browsetools::get_hierarchy_toc -->\n\n"; 125 126 toc += "<p><table width=100% cellpadding=0 cellspacing=0 border=0><tr>\n"; 127 toc += "<td valign=top>\n"; 135 recptproto *collectproto, displayclass &disp, 136 outconvertclass &outconvert, ostream &textout, 137 ostream &logout) { 138 139 textout << "\n<!-- Table of Contents produced by browsetools::get_hierarchy_toc -->\n\n"; 140 textout << "<p><table width=100% cellpadding=0 cellspacing=0 border=0><tr>\n"; 141 142 // get the cover image (if there is one) and the control buttons 143 if (!args["d"].empty()) { 144 textout << "<td valign=top width=200>\n"; 145 output_cover_image (args, collectproto, disp, outconvert, textout, logout); 146 output_controls (args, collectproto, disp, outconvert, textout, logout); 147 textout << "</td>\n"; 148 } 128 149 129 150 // get table of contents 151 textout << "<td valign=top>\n"; 130 152 if (args.getintarg("gc")) 131 get_expanded_toc(args, collectproto, toc, logout);153 output_expanded_hierarchy_toc(args, collectproto, disp, outconvert, textout, logout); 132 154 else 133 get_contracted_toc(args, collectproto, toc, logout); 134 135 toc += "</td></tr></table>\n"; 136 toc += "\n<!-- end of Table of Contents -->\n"; 137 */ 138 } 139 155 output_contracted_hierarchy_toc(args, collectproto, disp, outconvert, textout, logout); 156 157 textout << "</td></tr></table>\n"; 158 textout << "\n<!-- end of Table of Contents -->\n"; 159 } 160 161 // at the moment this just sets a _thisOID_ macro to archivedir 162 // and writes out the html to display the cover image 163 // this whole thing should be done with a call to the collection 164 // server which would send a link to the cover image if there 165 // was one otherwise send title, author and stuff 166 void output_cover_image (cgiargsclass &args, recptproto *collectproto, 167 displayclass &disp, outconvertclass &outconvert, 168 ostream &textout, ostream &logout) { 169 170 if (args["d"].empty()) return; 171 172 FilterResponse_t response; 173 text_tarray metadata; 174 metadata.push_back ("archivedir"); 175 176 text_t top; 177 get_top (args["d"], top); 178 if (get_info (top, args["c"], metadata, collectproto, 179 response, logout)) { 180 181 text_t &archivedir = response.docInfo[0].metadata[0].values[0]; 182 disp.setmacro ("thisOID", "Global", archivedir); 183 184 textout << outconvert << disp << 185 "<img src=\"_httpcollection_/archives/_thisOID_/cover.jpg\"><br>\n"; 186 } 187 } 188 189 // output_controls displays the detach, expand/contract contents, 190 // expand/contract text and highlighting/no highlighting buttons 191 // and the warning if expanded text is going to be large 192 void output_controls (cgiargsclass &args, recptproto *collectproto, 193 displayclass &disp, outconvertclass &outconvert, 194 ostream &textout, ostream &logout) { 195 196 if (args["u"] != "1") { 197 198 FilterResponse_t response; 199 text_tarray metadata; 200 text_t top; 201 get_top (args["d"], top); 202 203 text_tarray buttons; 204 205 // detach button 206 buttons.push_back ("_imagedetach_"); 207 208 // highlighting button 209 if (args["hl"] == "1") 210 buttons.push_back ("_imagenohighlight_"); 211 else 212 buttons.push_back ("_imagehighlight_"); 213 214 // expand/contract contents button - only have this if it's 215 // a Hierarchy type toc 216 metadata.push_back ("classifytype"); 217 if (get_info (top, args["c"], metadata, collectproto, 218 response, logout)) { 219 if (response.docInfo[0].metadata[0].values[0] == "Hierarchy") 220 if (args["gc"] == "1") 221 buttons.push_back ("_imagecontracttoc_"); 222 else 223 buttons.push_back ("_imageexpandtoc_"); 224 } 225 226 // expand/contract text button 227 if (args.getintarg("gt")) 228 buttons.push_back ("_imagecontracttext_"); 229 else 230 buttons.push_back ("_imageexpandtext_"); 231 232 text_tarray::const_iterator here = buttons.begin(); 233 text_tarray::const_iterator end = buttons.end(); 234 int count = 0; 235 while (here != end) { 236 if ((count != 0) && ((count % 3) == 0)) textout << "<br>\n"; 237 textout << outconvert << disp << *here; 238 count ++; 239 here ++; 240 } 241 } 242 } 140 243 141 244 … … 146 249 } 147 250 148 // ouput_ list_toc generates and outputs aList type table of contents251 // ouput_azlist_toc generates and outputs an AZList type table of contents 149 252 // it should only be called for classifications (i.e. when the "d" 150 253 // argument isn't set) as it doesn't make sense to display document 151 254 // level stuff in this way (I think !!) 152 void output_ list_toc (const text_t &classifytitle, cgiargsclass &args,153 154 155 255 void output_azlist_toc (const text_t &classifytitle, cgiargsclass &args, 256 recptproto *collectproto, displayclass &disp, 257 outconvertclass &outconvert, ostream &textout, 258 ostream &logout) { 156 259 157 260 text_tarray metadata; … … 200 303 } 201 304 202 203 void get_contracted_toc (cgiargsclass &args, recptproto */*collectproto*/,204 text_t &return_text, ostream &/*logout*/) {205 /* 305 void output_contracted_hierarchy_toc (cgiargsclass &args, recptproto *collectproto, 306 displayclass &disp, outconvertclass &outconvert, 307 ostream &textout, ostream &logout) { 308 206 309 int colnum, tabcount = 0; 207 text_tarray parents, siblings; 208 209 // load up the parents array 210 // don't want classifications unless at top level contents 211 if (!(args["cl"]).empty() && is_top(args["d"])) 212 get_parents_array (args["cl"] + ".", parents); 213 get_parents_array (args["d"], parents); 214 215 // load up siblings array 216 if ((args["d"]).empty()) get_children_array (get_parent(args["cl"]), siblings); 217 else if (is_top (args["d"])) get_children_array (args["cl"], siblings); 218 else get_children_array (get_parent(args["d"]), siblings); 219 220 return_text += "<table>\n"; 310 text_tarray parents, metadata; 311 FilterResponse_t siblings; 312 FilterResponse_t response; 313 314 text_t &arg_d = args["d"]; 315 text_t &arg_cl = args["cl"]; 316 317 metadata.push_back ("doctype"); 318 metadata.push_back ("Title"); 319 metadata.push_back ("hastxt"); 320 metadata.push_back ("haschildren"); 321 322 // load up parent and sibling arrays 323 if (arg_d.empty()) { 324 if (has_children (arg_cl, args["c"], collectproto, logout)) { 325 get_parents_array (arg_cl + ".fc", parents); 326 if (!get_children (arg_cl, args["c"], metadata, 327 collectproto, siblings, logout)) 328 return; 329 } else { 330 get_parents_array (arg_cl, parents); 331 if (!get_children (arg_cl + ".pr", args["c"], metadata, 332 collectproto, siblings, logout)) 333 return; 334 } 335 // don't want top parent of classification to be displayed 336 if (!parents.empty()) parents.erase (parents.begin()); 337 } else { 338 if (has_children (arg_d, args["c"], collectproto, logout)) { 339 get_parents_array (arg_d + ".fc", parents); 340 if (!get_children (arg_d, args["c"], metadata, 341 collectproto, siblings, logout)) 342 return; 343 } else { 344 get_parents_array (arg_d, parents); 345 if (!get_children (arg_d + ".pr", args["c"], metadata, 346 collectproto, siblings, logout)) 347 return; 348 } 349 } 350 351 textout << "<table>\n"; 221 352 colnum = parents.size() + 1; 222 353 223 354 // sort out toc of sections parents 224 if (parents.size() > 0) 225 get_parents_toc(args, parents, tabcount, colnum, return_text); 355 if (!parents.empty()) 356 output_parents_toc(args, parents, tabcount, colnum, disp, collectproto, 357 outconvert, textout, logout); 226 358 227 359 // sort out toc of sections siblings 228 if (siblings.size() > 0) 229 get_siblings_toc (args, siblings, tabcount, colnum, return_text); 360 if (!siblings.docInfo.empty()) 361 output_siblings_toc (args, siblings, tabcount, colnum, disp, 362 outconvert, textout, logout); 230 363 231 return_text += "</table>\n"; 232 */ 233 } 234 235 236 void get_expanded_toc (cgiargsclass &/*args*/, recptproto */*collectproto*/, 237 text_t &/*return_text*/, ostream &/*logout*/) { 238 239 /* 240 text_t doclink, icon, pointer, tab, pagetype; 241 int totalcols, tabcols, tabsleft; 242 text_tarray contents; 243 244 // get array of all contents to be included (all contents of entire book) 245 text_t book_top; 246 get_book_top (booksection, book_top); 247 get_contents (book_top, gdbm, contents, totalcols); 248 249 vector<text_t>::const_iterator section = contents.begin(); 250 vector<text_t>::const_iterator end = contents.end(); 364 textout << "</table>\n"; 365 } 366 367 368 void output_expanded_hierarchy_toc (cgiargsclass &args, recptproto *collectproto, 369 displayclass &disp, outconvertclass &outconvert, 370 ostream &textout, ostream &logout) { 371 372 text_t OID, topOID, classifytype, icon; 373 FilterResponse_t response; 374 int tabcols, totalcols, lasttabcols; 375 376 int gt = args.getintarg("gt"); 377 text_t doclink = "<a href=\"_httpdocument_&cl="; 378 379 if (args["d"].empty()) { 380 if (args["cl"].empty()) return; 381 OID = args["cl"]; 382 topOID = OID; // don't always want to expand from top if expanding classifications 383 classifytype = "classify"; 384 } else { 385 OID = args["d"]; 386 get_top (args["d"], topOID); 387 classifytype = "Document"; 388 } 389 390 textout << "<table>\n"; 391 392 // Get OIDs and metadata of all topOIDs contents (and topOID itself) 393 get_contents (topOID, classifytype, totalcols, args["c"], collectproto, response, logout); 394 int excess = countchar (topOID.begin(), topOID.end(), '.'); 395 totalcols -= excess; 396 397 // allow for pointer 398 if (classifytype == "Document" && !gt) totalcols += 2; 399 else totalcols += 1; 400 401 ResultDocInfo_tarray::const_iterator thissection = response.docInfo.begin(); 402 ResultDocInfo_tarray::const_iterator lastsection = response.docInfo.end(); 251 403 252 404 int count = 1; 253 while (section != end) { 254 tab.clear(); 255 gdbm.getinfo(*section, info); 256 text_t icontabs; 405 while (thissection != lastsection) { 406 407 const text_t &title = (*thissection).metadata[0].values[0]; 408 const int haschildren = (*thissection).metadata[1].values[0].getint(); 409 const text_t &doctype = (*thissection).metadata[2].values[0]; 410 411 text_t icontabs, tab, pointer; 257 412 258 413 // set up icon 259 414 icon = "_iconsmalltext_"; 260 if (is_top_level(*section)) icon = "_iconopenbook_"; 261 else if (!info.contents.empty()) icon = "_iconopenfolder_"; 262 415 if (is_top((*thissection).OID)) 416 if (classifytype == "Document") icon = "_iconopenbook_"; 417 else 418 if (doctype == "classify") icon = "_iconopenbookshelf_"; 419 else icon = "_iconclosedbook_"; 420 else if (haschildren) 421 if (classifytype == "Document") icon = "_iconopenfolder_"; 422 else icon = "_iconopenbookshelf_"; 423 424 // set up tabbing 425 if ((classifytype == "classify") && (doctype != "classify")) 426 tabcols = lasttabcols + 1; 427 else { 428 tabcols = countchar ((*thissection).OID.begin(), (*thissection).OID.end(), '.'); 429 lasttabcols = tabcols; 430 } 431 tabcols -= excess; 432 433 for (int i = 0; i < tabcols; i++) 434 icontabs += "_icontab_"; 435 263 436 // set up pointer 264 if (*section == booksection) pointer = "_iconpointer_"; 265 else pointer = "_icontab_"; 266 267 // set up tabbing 268 tabcols = count_dots(*section); 269 for (int i = 0; i < (tabcols - 1); i++) { 270 icontabs += "_icontab_"; 271 } 272 //char *tabcolsstr; 273 //itoa(tabcols, tabcolsstr, 10); 274 tab = "<td valign=top colspan=" + text_t(tabcols); 275 tab += ">" + icontabs + pointer + "</td>"; 276 tabsleft = totalcols - tabcols; 277 278 // set up url 279 if (is_book(*section) && !is_top_level(*section)) 280 doclink = "<a href=\"_httptext_"; 281 else doclink = "<a href=\"_httpbrowse_"; 282 if (args["x"] == "1") doclink += "&x=1"; 283 284 return_text += "<tr>" + tab + "<td valign=top>"; 285 if (is_top_level(*section) && args["x"] == "1") { 286 return_text += "<a href=\"\" onClick = \"close_detach()"; 287 } else { 288 if (args["g"][1] == '0' || is_top_level(*section) || 289 !are_same_chapter(booksection, *section) || 290 !info.contents.empty()) { 291 return_text += doclink + "d=" + classification; 292 return_text += "." + *section + "&a=" + pagetype; 437 if (classifytype == "Document" && !gt) { 438 if ((*thissection).OID == OID) pointer = "_iconpointer_"; 439 else pointer = "_icontab_"; 440 tabcols ++; 441 } 442 443 int colsremaining = totalcols - tabcols; 444 445 if (tabcols > 0) { 446 tab = "<td"; 447 if (tabcols > 1) tab += " colspan=" + text_t(tabcols); 448 tab += ">" + icontabs + pointer + "</td>"; 449 } 450 451 textout << outconvert << disp << "<tr>" << tab << "<td>"; 452 453 if ((classifytype == "Document") && (is_top((*thissection).OID)) && 454 (args.getintarg("x"))) 455 textout << "<a href=\"\" onClick = \"close_detach()"; 456 else { 457 if (!gt) { 458 const text_t &thisOID = (*thissection).OID; 459 text_t link; 460 if (is_top (thisOID)) 461 if (classifytype == "classify") 462 link = args["cl"] + "&d=" + thisOID; 463 else 464 link = args["cl"]; 465 else 466 if (haschildren) 467 if (classifytype == "classify") 468 link = thisOID + ".pr"; 469 else 470 link = args["cl"] + "&d=" + thisOID + ".pr"; 471 else 472 if (classifytype == "classify") 473 link = thisOID; 474 else 475 link = args["cl"] + "&d=" + thisOID; 476 477 textout << outconvert << disp << doclink << link; 293 478 } else { 294 return_text += "<a href=\"#"; 295 return_text += count; 479 textout << "<a href=\"#" << count; 296 480 count ++; 297 481 } 298 482 } 299 return_text += "\">" + icon + "</a></td>"; 300 return_text += "<td colspan=" + text_t(tabsleft); 301 return_text += ">" + info.title; 302 return_text += "</td></tr>\n"; 303 304 section ++; 305 } 306 return_text += "</table>\n"; 307 return_text += "</td></tr></table>\n"; 308 */ 309 } 310 311 312 void get_parents_toc (cgiargsclass &args, const text_tarray &parents, 313 int &tabcount, int &colnum, text_t &return_text) { 314 315 text_t section, tab, icon, doclink; 316 317 doclink = "<a href=\"_httpbrowse_"; 318 if (args["x"] == "1") doclink += "&x=1"; 483 484 textout << outconvert << disp << "\">" << icon << "</a></td><td"; 485 if (colsremaining > 1) textout << " colspan=" << colsremaining; 486 textout << outconvert << disp << ">" << title << "</td></tr>\n"; 487 488 thissection ++; 489 } 490 textout << "</table>\n"; 491 } 492 493 494 void output_parents_toc (cgiargsclass &args, const text_tarray &parents, 495 int &tabcount, int &colnum, displayclass &disp, 496 recptproto *collectproto, outconvertclass &outconvert, 497 ostream &textout, ostream &logout) { 498 499 text_t tab, icon; 500 text_tarray metadata; 501 FilterResponse_t response; 502 text_t doclink = "<a href=\"_httpdocument_"; 503 504 metadata.push_back ("doctype"); 505 metadata.push_back ("Title"); 319 506 320 507 text_tarray::const_iterator thisparent = parents.begin(); … … 322 509 323 510 while (thisparent != end) { 324 text_t icontabs; 325 section.clear(); 326 tab.clear(); 327 328 // set up icon for this parent 329 icon = "_iconopenfolder_"; 330 if (is_classification(*thisparent)) icon = "_iconopenbookshelf_"; 331 else if (is_top(*thisparent)) icon = "_iconopenbook_"; 332 333 for (int j = 0; j < tabcount; j++) 334 icontabs += "_icontab_"; 335 336 if (!icontabs.empty()) { 337 tab = "<td valign=top"; 338 if (tabcount > 1) tab += " colspan=" + text_t(tabcount); 339 tab += ">" + icontabs + "</td>"; 340 } 341 tabcount ++; 342 343 if (is_top(*thisparent) && args["x"] == "1") { 344 return_text += "<tr>" + tab + "<td valign=top><a href=\"\" "; 345 return_text += "onClick = \"close_detach()\">" + icon + "</a></td>"; 346 } else { 347 if (is_classification (*thisparent)) 348 return_text += "<tr>" + tab + "<td valign=top>" + doclink + "&cl=" + *thisparent; 349 else 350 // this may not need cl= bit once compressed args is done 351 return_text += "<tr>" + tab + "<td valign=top>" + doclink + "&cl=" + args["cl"] + "&d=" + *thisparent; 352 return_text += "\">" + icon + "</a></td>"; 353 } 354 return_text += "<td"; 355 if (colnum > 1) return_text += " colspan=" + text_t(colnum); 356 return_text += ">" + *thisparent + " title "; 357 return_text += " by " + *thisparent + " author "; 358 return_text += "</td></tr>\n"; 359 colnum --; 511 if (get_info (*thisparent, args["c"], metadata, collectproto, 512 response, logout)) { 513 text_t &doctype = response.docInfo[0].metadata[0].values[0]; 514 text_t &title = response.docInfo[0].metadata[1].values[0]; 515 516 text_t icontabs, pointer; 517 tab.clear(); 518 519 // set up icon for this parent 520 icon = "_iconopenfolder_"; 521 if (doctype == "classify") icon = "_iconopenbookshelf_"; 522 else if (is_top(*thisparent)) icon = "_iconopenbook_"; 523 524 for (int j = 0; j < tabcount; j++) 525 icontabs += "_icontab_"; 526 527 if (doctype != "classify") { 528 if (*thisparent == args["d"]) { 529 icontabs += "_iconpointer_"; 530 if (is_top (*thisparent)) 531 tabcount ++; 532 else 533 icontabs.erase (icontabs.begin(), icontabs.begin()+9); 534 } 535 } 536 537 if (!icontabs.empty()) { 538 tab = "<td valign=top"; 539 if (tabcount > 1) tab += " colspan=" + text_t(tabcount); 540 tab += ">" + icontabs + "</td>"; 541 } 542 tabcount ++; 543 544 if (is_top(*thisparent) && args["x"] == "1") { 545 textout << outconvert << disp << "<tr>" << tab << "<td valign=top><a href=\"\" " 546 << "onClick = \"close_detach()\">" << icon << "</a></td>"; 547 } else { 548 text_t link; 549 if (doctype == "classify") link = "&cl=" + *thisparent + ".pr"; 550 else 551 if (is_top (*thisparent)) link = "&cl=" + args["cl"]; 552 else link = "&cl=" + args["cl"] + "&d=" + *thisparent + ".pr"; 553 554 textout << outconvert << disp << "<tr>" << tab << "<td valign=top>" 555 << doclink << link << "\">" << icon << "</a></td>"; 556 } 557 textout << "<td"; 558 if (colnum > 1) textout << outconvert << " colspan=" << text_t(colnum); 559 textout << outconvert << disp << ">" << title << "</td></tr>\n"; 560 colnum --; 561 } 360 562 thisparent ++; 361 563 } 362 564 } 363 565 364 365 void get_siblings_toc (cgiargsclass &args, const text_tarray &siblings, 366 int &tabcount, int &colnum, text_t &return_text) { 367 /* 566 void output_siblings_toc (cgiargsclass &args, const FilterResponse_t &siblings, 567 int &tabcount, int &colnum, displayclass &disp, 568 outconvertclass &outconvert, ostream &textout, 569 ostream &/*logout*/) { 570 368 571 text_t tab, icon, pointer, child, doclink; 369 572 int count = 1; 370 573 371 doclink = "<a href=\"_httpbrowse_"; 372 if (args["x"] == "1") doclink += "&x=1"; 373 374 text_tarray::const_iterator thissibling = siblings.begin(); 375 text_tarray::const_iterator sibend = siblings.end(); 574 doclink = "<a href=\"_httpdocument_"; 575 576 ResultDocInfo_tarray::const_iterator thissibling = siblings.docInfo.begin(); 577 ResultDocInfo_tarray::const_iterator sibend = siblings.docInfo.end(); 376 578 377 579 while (thissibling != sibend) { 580 581 const text_t &doctype = (*thissibling).metadata[0].values[0]; 582 const text_t &title = (*thissibling).metadata[1].values[0]; 583 int hastxt = (*thissibling).metadata[2].values[0].getint(); 584 int haschildren = (*thissibling).metadata[3].values[0].getint(); 585 int gt = args.getintarg("gt"); 378 586 379 587 // set up icon for this sibling 380 588 icon = "_iconclosedfolder_"; 381 if ( is_classification(*thissibling)) icon = "_iconclosedbookshelf_";382 else if (is_top( *thissibling)) icon = "_iconclosedbook_";589 if (doctype == "classify") icon = "_iconclosedbookshelf_"; 590 else if (is_top((*thissibling).OID)) icon = "_iconclosedbook_"; 383 591 384 592 // fit pointer into tabbing if current section 593 // note that we don't want pointers at classification levels anymore 594 // (unless the classification contains text) 385 595 pointer = "_icontab_"; 386 if ( is_classification(*thissibling)) {387 if ( *thissibling == args["cl"])596 if (doctype == "classify") { 597 if ((*thissibling).OID == args["cl"] && hastxt) 388 598 pointer = "_iconpointer_"; 389 } else if ( *thissibling== args["d"]) pointer = "_iconpointer_";599 } else if ((*thissibling).OID == args["d"]) pointer = "_iconpointer_"; 390 600 391 601 text_t thesetabs; … … 397 607 tab += ">" + thesetabs + pointer + "</td>"; 398 608 399 if ( contains_text(*thissibling)) {609 if (!haschildren) { 400 610 // sibling is text document 401 611 icon = "_iconsmalltext_"; 402 403 return_text += "<tr>" + tab + "<td valign=top>"; 404 if (args["g"][1] == '0') { 405 return_text += doclink + "&d=" + *thissibling; 612 text_t link; 613 if (doctype == "classify") link = "&cl=" + (*thissibling).OID; 614 else link = "&cl=" + args["cl"] + "&d=" + (*thissibling).OID; 615 616 textout << outconvert << disp << "<tr>" << tab << "<td valign=top>"; 617 if (!gt) { 618 textout << outconvert << disp << doclink << link; 406 619 } else { 407 return_text += "<a href=\"#"; 408 return_text += count; 620 textout << "<a href=\"#" << count; 409 621 count ++; 410 622 } 411 return_text += "\">" + icon + "</a></td><td"; 412 if (colnum > 1) return_text += " colspan=" + text_t(colnum); 413 return_text += ">" + *thissibling + " title"; 414 return_text += " by " + *thissibling + " author"; 415 return_text += "</td></tr>\n"; 623 textout << outconvert << disp << "\">" << icon << "</a></td><td"; 624 if (colnum > 1) textout << " colspan=" << colnum; 625 textout << outconvert << disp << ">" << title << "</td></tr>\n"; 626 416 627 } else { 417 // sibling is closed book or folder so clicking 418 // it should open contents 419 // get_first_child(*thissibling, child); 420 421 return_text += "<tr>" + tab + "<td valign=top>" + doclink + "&d=" + child; 422 return_text += "\">" + icon + "</a></td><td"; 423 if (colnum > 1) return_text += " colspan=" + text_t(colnum); 424 return_text += ">" + *thissibling + " title"; 425 return_text += " by " + *thissibling + " author"; 426 return_text += "</td></tr>\n"; 628 // sibling is closed book or folder 629 text_t link; 630 if (doctype == "classify") link = "&cl=" + (*thissibling).OID; 631 else link = "&cl=" + args["cl"] + "&d=" + (*thissibling).OID; 632 633 textout << outconvert << disp << "<tr>" << tab << "<td valign=top>" 634 << doclink << link << "\">" << icon << "</a></td><td"; 635 if (colnum > 1) textout << " colspan=" << colnum; 636 textout << outconvert << disp << ">" << title << "</td></tr>\n"; 427 637 } 428 638 thissibling ++; 429 } */639 } 430 640 } 431 641 … … 442 652 if (OID.empty()) return; 443 653 444 text_t haschildren, hasnext, hasprevious;445 654 text_tarray metadata; 446 655 FilterResponse_t response; … … 452 661 if (get_info (OID, collection, metadata, collectproto, response, logout)) { 453 662 454 haschildren = response.docInfo[0].metadata[0].values[0];455 hasnext = response.docInfo[0].metadata[1].values[0];456 hasprevious = response.docInfo[0].metadata[2].values[0];663 text_t haschildren = response.docInfo[0].metadata[0].values[0]; 664 text_t hasnext = response.docInfo[0].metadata[1].values[0]; 665 text_t hasprevious = response.docInfo[0].metadata[2].values[0]; 457 666 458 667 if ((classifytype == "Hierarchy") || (classifytype == "Book")) { … … 463 672 disp.setmacro ("httpnextarrow", "document", 464 673 "_If_(_cgiargd_,_httpdocument_&cl=_cgiargcl_&d=_cgiargd_.ns,_httpdocument_&cl=_cgiargcl_.ns)"); 674 else { 675 // see if parent has younger siblings 676 if (get_info (OID + ".pr", collection, metadata, collectproto, response, logout)) { 677 if (response.docInfo[0].metadata[1].values[0] == "1") 678 disp.setmacro ("httpnextarrow", "document", 679 "_If_(_cgiargd_,_httpdocument_&cl=_cgiargcl_&d=_cgiargd_.pr.ns,_httpdocument_&cl=_cgiargcl_.pr.ns)"); 680 } 681 } 465 682 466 683 if (hasprevious == "1") { 467 684 // see if OIDs older sibling has children 468 metadata.erase (metadata.begin()+1, metadata.end()); 469 if (get_info (OID + ".p", collection, metadata, collectproto, response, logout)) { 685 if (get_info (OID + ".ps", collection, metadata, collectproto, response, logout)) { 470 686 if (response.docInfo[0].metadata[0].values[0] == "1") 471 687 disp.setmacro ("httpprevarrow", "document", 472 "_If_(_cgiargd_,_httpdocument_&cl=_cgiargcl_&d=_cgiargd_.p r.lc,_httpdocument_&cl=_cgiargcl_.pr.lc)");688 "_If_(_cgiargd_,_httpdocument_&cl=_cgiargcl_&d=_cgiargd_.ps.lc,_httpdocument_&cl=_cgiargcl_.ps.lc)"); 473 689 else 474 690 disp.setmacro ("httpprevarrow", "document", -
trunk/gsdl/src/recpt/browsetools.h
r248 r257 38 38 outconvertclass &outconvert, ostream &textout, 39 39 ostream &logout); 40 void output_list_toc (const text_t &classifytitle, cgiargsclass &args, 41 recptproto *collectproto, displayclass &disp, 42 outconvertclass &outconvert, ostream &textout, 43 ostream &logout); 44 45 void get_contracted_toc (cgiargsclass &args, recptproto *collectproto, 46 text_t &return_text, ostream &logout); 47 void get_expanded_toc (cgiargsclass &args, recptproto *collectproto, 48 text_t &return_text, ostream &logout); 49 void get_parents_toc (cgiargsclass &args, const text_tarray &parents, 50 int &tabcount, int &colnum, text_t &return_text); 51 void get_siblings_toc (cgiargsclass &args, const text_tarray &siblings, 52 int &tabcount, int &colnum, text_t &return_text); 40 void output_azlist_toc (const text_t &classifytitle, cgiargsclass &args, 41 recptproto *collectproto, displayclass &disp, 42 outconvertclass &outconvert, ostream &textout, 43 ostream &logout); 44 void output_contracted_hierarchy_toc (cgiargsclass &args, recptproto *collectproto, 45 displayclass &disp, outconvertclass &outconvert, 46 ostream &textout, ostream &logout); 47 void output_expanded_hierarchy_toc (cgiargsclass &args, recptproto *collectproto, 48 displayclass &disp, outconvertclass &outconvert, 49 ostream &textout, ostream &logout); 50 void output_parents_toc (cgiargsclass &args, const text_tarray &parents, 51 int &tabcount, int &colnum, displayclass &disp, 52 recptproto *collectproto, outconvertclass &outconvert, 53 ostream &textout, ostream &logout); 54 void output_siblings_toc (cgiargsclass &args, const FilterResponse_t &siblings, 55 int &tabcount, int &colnum, displayclass &disp, 56 outconvertclass &outconvert, ostream &textout, ostream &logout); 53 57 void set_arrow_macros (const text_t &OID, const text_t &classifytype, 54 58 displayclass &disp, recptproto *collectproto, 55 59 const text_t &collection, ostream &logout); 60 void output_controls (cgiargsclass &args, recptproto *collectproto, 61 displayclass &disp, outconvertclass &outconvert, 62 ostream &textout, ostream &logout); 63 void output_cover_image (cgiargsclass &args, recptproto *collectproto, 64 displayclass &disp, outconvertclass &outconvert, 65 ostream &textout, ostream &logout); 66 67 56 68 57 69 -
trunk/gsdl/src/recpt/comtypes.cpp
r241 r257 12 12 /* 13 13 $Log$ 14 Revision 1.8 1999/05/10 03:40:33 sjboddie 15 lots of changes - slowly getting document action sorted out 16 14 17 Revision 1.7 1999/04/21 05:23:14 sjboddie 15 18 … … 179 182 } 180 183 184 185 void DocumentRequest_t::clear () { 186 OID.clear(); 187 docType.clear(); 188 docFormat.clear(); 189 } 190 191 void DocumentResponse_t::clear () { 192 doc.clear(); 193 } 194 195 196 -
trunk/gsdl/src/recpt/comtypes.h
r241 r257 285 285 286 286 287 // DocumentRequest ::= SEQUENCE { 288 // OID GeneralString, 289 // docType GeneralString, 290 // docFormat GeneralString 291 // } 292 struct DocumentRequest_t { 293 void clear (); 294 DocumentRequest_t () {clear();} 295 296 text_t OID; 297 text_t docType; 298 text_t docFormat; 299 }; 300 301 302 // DocumentResponse ::= SEQUENCE { 303 // doc OCTET STRING 304 // } 305 306 struct DocumentResponse_t { 307 void clear (); 308 DocumentResponse_t () {clear();} 309 310 text_t doc; 311 }; 312 287 313 288 314 #endif -
trunk/gsdl/src/recpt/documentaction.cpp
r248 r257 12 12 /* 13 13 $Log$ 14 Revision 1.2 1999/05/10 03:40:35 sjboddie 15 lots of changes - slowly getting document action sorted out 16 14 17 Revision 1.1 1999/04/30 01:59:40 sjboddie 15 18 lots of stuff - getting documentaction working (documentaction replaces … … 34 37 documentaction::documentaction () { 35 38 // this action uses cgi variables "a", "d", "cl", 36 // "x", "gc", and "gt"39 // "x", "gc", "gt", "gp", and "hl" 37 40 cgiarginfo arg_ainfo; 38 41 arg_ainfo.shortname = "a"; … … 71 74 72 75 // in this action "gt" controls the expand/contract 73 // text function 76 // text function 0 = not expanded, 1 = expand unless 77 // there are more than 10 sections containing text, 78 // 2 = expand all 74 79 arg_ainfo.shortname = "gt"; 75 80 arg_ainfo.longname = "expand text"; … … 88 93 arg_ainfo.argdefault = ""; 89 94 arg_ainfo.savedarginfo = cgiarginfo::mustnot; 95 argsinfo.addarginfo (NULL, arg_ainfo); 96 97 // in this action "hl" is the "highlighting on/ 98 // highlighting off control 99 arg_ainfo.shortname = "hl"; 100 arg_ainfo.longname = "highlighting on/off"; 101 arg_ainfo.multiplechar = false; 102 arg_ainfo.defaultstatus = cgiarginfo::weak; 103 arg_ainfo.argdefault = "1"; 104 arg_ainfo.savedarginfo = cgiarginfo::must; 90 105 argsinfo.addarginfo (NULL, arg_ainfo); 91 106 … … 199 214 200 215 metadata.push_back ("Title"); 216 metadata.push_back ("classifytype"); 201 217 get_children ("", args["c"], metadata, collectproto, response, logout); 202 218 … … 236 252 dochere = response.docInfo.begin(); 237 253 while (dochere != docend) { 254 const text_t &title = (*dochere).metadata[0].values[0]; 255 const text_t &classifytype = (*dochere).metadata[1].values[0]; 256 238 257 // if we're inside a document all the classification buttons should be enabled 239 258 if (args["d"].empty() && ((*dochere).OID == topparent)) 240 navigationbar += "_imagespacer__icontab" + (*dochere).metadata[0].values[0]+ "green_";259 navigationbar += "_imagespacer__icontab" + title + "green_"; 241 260 else { 242 navigationbar += "_imagespacer__image" + (*dochere).metadata[0].values[0]+ "_";261 navigationbar += "_imagespacer__image" + title + "_"; 243 262 244 263 // set the _httpbrowseXXX_ macro for this classification 245 disp.setmacro ("httpbrowse" + (*dochere).metadata[0].values[0], 246 "Global", "_httpdocument_&cl=" + (*dochere).OID + ".fc"); 264 text_t link = (*dochere).OID; 265 if (classifytype == "AZList" || classifytype == "Datelist") link += ".fc"; 266 disp.setmacro ("httpbrowse" + title, "Global", 267 "_httpdocument_&cl=" + link); 247 268 } 248 javaimagesnavbar += "_java" + (*dochere).metadata[0].values[0]+ "_";269 javaimagesnavbar += "_java" + title + "_"; 249 270 dochere ++; 250 271 } … … 277 298 278 299 // _httpprevarrow_ these are set if next or previous arrows 279 // _httpnextarrow_ are to be used - (i.e. if it's a 300 // _httpnextarrow_ are to be used - (i.e. if it's an AZList or a Datelist 280 301 // classifytype at a top level or if it's a Book or a 281 302 // Hierarchy classifytype at document level … … 283 304 // _header_ the header macro is overridden if we're not at a top level 284 305 // classification to remove the title block 306 307 // _javaimagescontent_ this is the javascript code to shove in to make the 308 // flashy buttons work 309 285 310 286 311 text_tarray metadata; … … 292 317 if (!args["d"].empty()) { 293 318 // we're at document level 319 text_t javaimagescontent; 294 320 295 321 // get metadata for top level of document 296 text_t doctop = args["d"]; 297 text_t classifytype; 322 text_t doctop; 298 323 get_top (args["d"], doctop); 299 324 if (get_info (doctop, args["c"], metadata, collectproto, response, logout)) { 300 325 disp.setmacro ("header", "document", "_textheader_"); 301 classifytype = response.docInfo[0].metadata[1].values[0];326 text_t &classifytype = response.docInfo[0].metadata[1].values[0]; 302 327 if (classifytype.empty()) classifytype = "Book"; // defaults to Book 303 328 if ((classifytype == "Book") || (classifytype == "Hierarchy")) 304 329 set_arrow_macros (args["d"], classifytype, disp, collectproto, args["c"], logout); 330 331 if (args["u"] != "1") { 332 javaimagescontent += "_javadetach_"; 333 if (args["gt"] == "1") 334 javaimagescontent += "_javacontracttext__javacontinue_"; 335 else 336 javaimagescontent += "_javaexpandtext_"; 337 if (classifytype == "Hierarchy") 338 if (args["gc"] == "1") 339 javaimagescontent += "_javacontractcontents_"; 340 else 341 javaimagescontent += "_javaexpandcontents_"; 342 if (args["hl"] != "1") 343 javaimagescontent += "_javahighlighting_"; 344 else 345 javaimagescontent += "_javanohighlighting_"; 346 disp.setmacro ("javaimagescontent", "document", javaimagescontent); 347 } 305 348 } 306 349 } else { … … 308 351 309 352 // get metadata for top level classification 310 text_t classtop = args["cl"];353 text_t classtop; 311 354 get_top (args["cl"], classtop); 312 355 if (get_info (classtop, args["c"], metadata, collectproto, response, logout)) { 313 356 357 text_t &title = response.docInfo[0].metadata[0].values[0]; 358 text_t &classifytype = response.docInfo[0].metadata[1].values[0]; 359 314 360 disp.setmacro ("imagethispage", "document", 315 "_icon" + response.docInfo[0].metadata[0].values[0]+ "page_");361 "_icon" + title + "page_"); 316 362 317 363 // now get the metadata for each child of top level … … 319 365 // (if they're required by the current classification type) 320 366 321 if ((response.docInfo[0].metadata[1].values[0] == "List") || 322 (response.docInfo[0].metadata[1].values[0] == "Datelist")) { 367 if ((classifytype == "AZList") || (classifytype == "Datelist")) { 323 368 324 369 text_t classificationlinks, navarrows; … … 378 423 text_tarray metadata; 379 424 FilterResponse_t response; 425 DocumentRequest_t docrequest; 426 DocumentResponse_t docresponse; 380 427 text_t topparent, classifytype, classifytitle; 428 comerror_t err; 429 430 text_t &arg_d = args["d"]; 431 text_t &arg_cl = args["cl"]; 432 text_t &collection = args["c"]; 433 434 text_t OID = arg_d; 435 if (arg_d.empty()) OID = arg_cl; 381 436 382 437 textout << outconvert << disp << "_document:header_\n" 383 438 << "_document:content_\n"; 384 439 385 if (args["d"].empty() && args["cl"].empty()) 386 textout << outconvert << "Document contains no data\n"; 387 else { 388 389 if (!args["d"].empty()) get_top (args["d"], topparent); 390 else get_top (args["cl"], topparent); 391 392 // get the classifytitle and classifytype 393 metadata.push_back ("Title"); 394 metadata.push_back ("classifytype"); 395 if (get_info (topparent, args["c"], metadata, collectproto, response, logout)) { 396 classifytitle = response.docInfo[0].metadata[0].values[0]; 397 classifytype = response.docInfo[0].metadata[1].values[0]; 440 if (arg_d.empty() && arg_cl.empty()) { 441 textout << outconvert << "Document contains no data_document:footer_\n"; 442 return true; 443 } 444 445 // get the classifytitle and classifytype 446 get_top (OID, topparent); 447 metadata.push_back ("Title"); 448 metadata.push_back ("classifytype"); 449 if (get_info (topparent, collection, metadata, collectproto, response, logout)) { 450 classifytitle = response.docInfo[0].metadata[0].values[0]; 451 classifytype = response.docInfo[0].metadata[1].values[0]; 452 } 453 454 if (!arg_d.empty()) { 455 456 if (classifytype == "Hierarchy") 457 output_hierarchy_toc (classifytitle, args, collectproto, disp, 458 outconvert, textout, logout); 459 else 460 // Book is the default for a document level toc - AZList and Datelist don't 461 // make sense for document level 462 output_book_toc (classifytitle, args, collectproto, disp, 463 outconvert, textout, logout); 464 } else { 465 466 if (classifytype == "Hierarchy") 467 output_hierarchy_toc (classifytitle, args, collectproto, disp, 468 outconvert, textout, logout); 469 else if (classifytype == "Datelist") 470 output_datelist_toc (classifytitle, args, collectproto, disp, 471 outconvert, textout, logout); 472 else 473 // AZList is the default for a classification level toc - Book doesn't make 474 // sense for classification level 475 output_azlist_toc (classifytitle, args, collectproto, disp, 476 outconvert, textout, logout); 477 } 478 479 // get info on this document 480 metadata.erase (metadata.begin(), metadata.end()); 481 metadata.push_back("Title"); 482 metadata.push_back("hastxt"); 483 metadata.push_back("haschildren"); 484 485 if (get_info (OID, collection, metadata, collectproto, response, logout)) { 486 text_t &title = response.docInfo[0].metadata[0].values[0]; 487 int hastxt = response.docInfo[0].metadata[1].values[0].getint(); 488 int haschildren = response.docInfo[0].metadata[2].values[0].getint(); 489 490 int gt = args.getintarg("gt"); 491 if (gt == 0) { 492 if (hastxt == 1) { 493 // get the text 494 docrequest.OID = OID; 495 collectproto->get_document (collection, docrequest, docresponse, err, logout); 496 497 textout << outconvert << disp 498 << "<p>\n<h3>" << title << "</h3>" << docresponse.doc; 499 } 500 } else { 501 502 // text is to be expanded 503 int tmp; // this doesn't get used here 504 if (!haschildren) 505 OID = get_parent (OID); 506 507 get_contents (OID, classifytype, tmp, collection, collectproto, response, logout); 508 509 ResultDocInfo_tarray::const_iterator sechere = response.docInfo.begin(); 510 ResultDocInfo_tarray::const_iterator secend = response.docInfo.end(); 511 512 if (gt == 1) { 513 // check if there are more than 10 sections containing text to be expanded - 514 // if there are output warning message - this isn't a great way to do this 515 // since the sections may be very large or very small - one day I'll fix it 516 // -- Stefan. 517 int seccount = 0; 518 while (sechere != secend) { 519 if ((*sechere).metadata[3].values[0] == "1") seccount ++; 520 if (seccount > 10) break; 521 sechere ++; 522 } 523 if (seccount > 10) textout << outconvert << disp << "_document:textltwarning_"; 524 else gt = 2; 525 } 526 527 if (gt == 2) { 528 // get the text for each section 529 sechere = response.docInfo.begin(); 530 int count = 0; 531 while (sechere != secend) { 532 textout << outconvert << disp << "\n<p><a name=" << count << "><h3>" 533 << (*sechere).metadata[0].values[0] << "</h3></a>\n"; 534 if ((*sechere).metadata[3].values[0] == "1") { 535 docrequest.OID = (*sechere).OID; 536 collectproto->get_document (collection, docrequest, docresponse, err, logout); 537 textout << outconvert << disp << docresponse.doc; 538 } 539 count ++; 540 sechere ++; 541 } 542 } 398 543 } 399 400 if (!args["d"].empty()) {401 402 if (classifytype == "Hierarchy")403 output_hierarchy_toc (classifytitle, args, collectproto, disp,404 outconvert, textout, logout);405 else406 // Book is the default for a document level toc - List and Datelist don't407 // make sense for document level408 output_book_toc (classifytitle, args, collectproto, disp,409 outconvert, textout, logout);410 } else {411 412 if (classifytype == "Hierarchy")413 output_hierarchy_toc (classifytitle, args, collectproto, disp,414 outconvert, textout, logout);415 else if (classifytype == "Datelist")416 output_datelist_toc (classifytitle, args, collectproto, disp,417 outconvert, textout, logout);418 else419 // List is the default for a classification level toc - Book doesn't make420 // sense for classification level421 output_list_toc (classifytitle, args, collectproto, disp,422 outconvert, textout, logout);423 }424 425 544 } 426 545 textout << outconvert << disp << "_document:footer_\n"; -
trunk/gsdl/src/recpt/librarymain.cpp
r238 r257 12 12 /* 13 13 $Log$ 14 Revision 1.6 1999/05/10 03:40:39 sjboddie 15 lots of changes - slowly getting document action sorted out 16 14 17 Revision 1.5 1999/04/19 23:56:10 rjmcnab 15 18 Finished the gdbm metadata stuff … … 49 52 50 53 // add a collection server for each collection ... (not implemented yet) 51 collectserver cserver;52 gdbmclass gdbmhandler;53 mgsearchclass mgsearch;54 // text_tarray collections; 55 // collections.push_back ("gberg"); 56 // collections.push_back ("hdl"); 54 57 55 // add a null filter 56 filterclass filter; 57 cserver.add_filter (&filter); 58 // text_tarray::const_iterator thiscol = collections.begin(); 59 // text_tarray::const_iterator endcol = collections.end(); 58 60 59 // add a browse filter 60 browsefilterclass browsefilter; 61 browsefilter.set_gdbmptr (&gdbmhandler); 62 cserver.add_filter (&browsefilter); 61 // while (thiscol != endcol) { 63 62 64 // add a query filter 65 queryfilterclass queryfilter; 66 queryfilter.set_gdbmptr (&gdbmhandler); 67 queryfilter.set_mgsearchptr (&mgsearch); 68 cserver.add_filter (&queryfilter); 63 collectserver cserver; 64 gdbmclass gdbmhandler; 65 mgsearchclass mgsearch; 69 66 70 // add a mg and gdbm source 71 mggdbmsourceclass mggdbmsource; 72 mggdbmsource.set_gdbmptr (&gdbmhandler); 73 mggdbmsource.set_mgsearchptr (&mgsearch); 74 cserver.add_source (&mggdbmsource); 75 76 // inform collection server and everything it contains about its 77 // collection name 78 cserver.configure ("collection", "gberg"); 79 80 nproto.add_collectserver (&cserver); 67 // add a null filter 68 filterclass filter; 69 cserver.add_filter (&filter); 70 71 // add a browse filter 72 browsefilterclass browsefilter; 73 browsefilter.set_gdbmptr (&gdbmhandler); 74 cserver.add_filter (&browsefilter); 75 76 // add a query filter 77 queryfilterclass queryfilter; 78 queryfilter.set_gdbmptr (&gdbmhandler); 79 queryfilter.set_mgsearchptr (&mgsearch); 80 cserver.add_filter (&queryfilter); 81 82 // add a mg and gdbm source 83 mggdbmsourceclass mggdbmsource; 84 mggdbmsource.set_gdbmptr (&gdbmhandler); 85 mggdbmsource.set_mgsearchptr (&mgsearch); 86 cserver.add_source (&mggdbmsource); 87 88 // inform collection server and everything it contains about its 89 // collection name 90 cserver.configure ("collection", "hdl"); 91 92 nproto.add_collectserver (&cserver); 93 // thiscol ++; 94 // } 81 95 82 96 // add the protocol to the receptionist 83 97 recpt.add_protocol (&nproto); 84 98 85 cgiwrapper (recpt, " gberg");99 cgiwrapper (recpt, "hdl"); 86 100 return 0; 87 101 } -
trunk/gsdl/src/recpt/nullproto.cpp
r248 r257 12 12 /* 13 13 $Log$ 14 Revision 1.6 1999/05/10 03:40:41 sjboddie 15 lots of changes - slowly getting document action sorted out 16 14 17 Revision 1.5 1999/04/30 01:59:41 sjboddie 15 18 lots of stuff - getting documentaction working (documentaction replaces … … 166 169 } 167 170 171 void nullproto::get_document (const text_t &collection, 172 const DocumentRequest_t &request, 173 DocumentResponse_t &response, 174 comerror_t &err, ostream &logout) { 175 collectserver *cserver = cservers.getcollectserver (collection); 176 if (cserver != NULL) cserver->get_document (request, response, err, logout); 177 else err = protocolError; 178 } -
trunk/gsdl/src/recpt/nullproto.h
r248 r257 57 57 FilterResponse_t &response, 58 58 comerror_t &err, ostream &logout); 59 60 void get_document (const text_t &collection, 61 const DocumentRequest_t &request, 62 DocumentResponse_t &response, 63 comerror_t &err, ostream &logout); 64 59 65 }; 60 66 -
trunk/gsdl/src/recpt/recptproto.cpp
r248 r257 12 12 /* 13 13 $Log$ 14 Revision 1.6 1999/05/10 03:40:43 sjboddie 15 lots of changes - slowly getting document action sorted out 16 14 17 Revision 1.5 1999/04/30 01:59:43 sjboddie 15 18 lots of stuff - getting documentaction working (documentaction replaces … … 113 116 } 114 117 118 void recptproto::get_document (const text_t &/*collection*/, 119 const DocumentRequest_t &/*request*/, 120 DocumentResponse_t &/*response*/, 121 comerror_t &err, ostream &/*logout*/) { 122 err = protocolError; 123 } 124 125 115 126 116 127 -
trunk/gsdl/src/recpt/recptproto.h
r248 r257 93 93 FilterResponse_t &response, 94 94 comerror_t &err, ostream &logout); 95 96 // gets a document (duh!) 97 virtual void get_document (const text_t &collection, 98 const DocumentRequest_t &request, 99 DocumentResponse_t &response, 100 comerror_t &err, ostream &logout); 95 101 }; 96 102
Note:
See TracChangeset
for help on using the changeset viewer.