Changeset 1065


Ignore:
Timestamp:
2000-04-04T16:43:08+12:00 (24 years ago)
Author:
nzdl
Message:

caught cstr collection up with DocumentColumn stuff

Location:
trunk/cstr/src/recpt
Files:
4 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/cstr/src/recpt/Makefile.in

    r1022 r1065  
    4646RANLIB = @RANLIB@
    4747LDFLAGS = @LDFLAGS@
    48 #LIBS = -lgdbm -lstdc++ -lm -lcrypt
    4948LIBS = @LIBS@
    5049
     
    6564
    6665
    67 HEADERS = cstrdocaction.h cstrbrowsetools.h cstrpagedbrowserclass.h
     66HEADERS = cstrdocaction.h
    6867
    69 SOURCES = cstrlibrarymain.cpp cstrdocaction.cpp cstrbrowsetools.cpp \
    70       cstrpagedbrowserclass.cpp
     68SOURCES = cstrlibrarymain.cpp cstrdocaction.cpp
    7169
    7270
    73 OBJECTS = cstrlibrarymain.o cstrdocaction.o cstrbrowsetools.o \
    74       cstrpagedbrowserclass.o
     71OBJECTS = cstrlibrarymain.o cstrdocaction.o
    7572
    7673
  • trunk/cstr/src/recpt/cstrdocaction.cpp

    r911 r1065  
    2828/*
    2929   $Log$
     30   Revision 1.3  2000/04/04 04:43:07  nzdl
     31   caught cstr collection up with DocumentColumn stuff
     32
    3033   Revision 1.2  2000/02/06 21:25:21  sjboddie
    3134   updated cstr
     
    3942#include <string.h>
    4043#include "cstrdocaction.h"
    41 #include "cstrbrowsetools.h"
    42 #include "browsetools.h"
    4344#include "OIDtools.h"
    4445#include "querytools.h"
    45 #include "unitool.h"
     46#include "cgiutils.h"
    4647
    4748cstrdocaction::cstrdocaction () {
     
    7677}
    7778
     79void cstrdocaction::output_controls (cgiargsclass &args, const text_tarray &ibuttons,
     80                     recptproto *collectproto, displayclass &disp,
     81                     outconvertclass &outconvert, ostream &textout,
     82                     ostream &logout) {
     83
     84
     85  if (args["u"] != "1") {
     86
     87    text_tarray buttons;
     88    text_t &arg_gg = args["gg"];
     89
     90    text_tarray::const_iterator here = ibuttons.begin();
     91    text_tarray::const_iterator end = ibuttons.end();
     92   
     93    while (here != end) {
     94     
     95      if (*here == "Detach")
     96    buttons.push_back ("_document:imagedetach_");
     97      else if ((*here == "Highlight") && (arg_gg == "text")) {
     98    if (args["hl"] == "1")
     99      buttons.push_back ("_document:imagenohighlight_");
     100    else
     101      buttons.push_back ("_document:imagehighlight_");
     102      } else if ((*here == "Expand Text") && arg_gg == "text") {
     103    if (args.getintarg("gt"))
     104      buttons.push_back ("_document:imagecontracttext_");
     105    else
     106      buttons.push_back ("_document:imageexpandtext_");
     107      }
     108      here ++;
     109    }
     110
     111    FilterResponse_t response;
     112    text_tset metadata;
     113    text_t top;
     114    get_top (args["d"], top);
     115    metadata.insert ("figures");
     116    metadata.insert ("Description");
     117    metadata.insert ("Source");
     118    if (get_info (top, args["c"], metadata, false, collectproto, response, logout)) {
     119      text_t &figures = response.docInfo[0].metadata["figures"].values[0];
     120      text_t &description = response.docInfo[0].metadata["Description"].values[0];
     121      text_t &source = response.docInfo[0].metadata["Source"].values[0];
     122
     123      if (!source.empty())
     124    buttons.push_back ("_document:imagepostscript_(" + cgi_safe(source) + ")");
     125     
     126      if ((!description.empty()) && (arg_gg != "abstract"))
     127    buttons.push_back ("_document:imageabstract_");
     128     
     129      if ((!figures.empty()) && (arg_gg != "figures"))
     130    buttons.push_back ("_document:imagefigures_");
     131     
     132      if (arg_gg != "text")
     133    buttons.push_back ("_document:imageviewtext_");
     134    }
     135     
     136    here = buttons.begin();
     137    end = buttons.end();
     138    int count = 0;
     139    while (here != end) {
     140      if ((count != 0) && ((count % 2) == 0)) textout << "<br>\n";
     141      textout << outconvert << disp << *here;
     142      count ++;
     143      here ++;
     144    }
     145  }
     146}
     147
     148
    78149
    79150void cstrdocaction::get_cgihead_info (cgiargsclass &args, recptprotolistclass * /*protos*/,
     
    106177   
    107178  int arg_gt = args.getintarg("gt");
    108   //  int arg_gc = args.getintarg("gc");
    109179  int arg_hl = args.getintarg("hl");
    110180
     
    122192      else
    123193    javaimagescontent += "_javaexpandtext_";
    124       //    } else if (*button_here == "Expand Contents") {
    125       //      if (arg_gc == 1)
    126       //    javaimagescontent += "_javacontractcontents_";
    127       //      else
    128       //    javaimagescontent += "_javaexpandcontents_";
    129194    } else if (*button_here == "Highlight" && arg_gg == "text") {
    130195      if (arg_hl == 1)
     
    138203  disp.setmacro ("javaimagescontent", "document", javaimagescontent);
    139204}
    140 
    141 
    142 
    143 /*
    144 // define all the macros which are related to pages generated
    145 // by this action. we also load up the formatinfo structure
    146 // here (it's used in do_action as well as here)
    147 void cstrdocaction::define_internal_macros (const ColInfoResponse_t &collectinfo, displayclass &disp,
    148                         cgiargsclass &args, recptproto *collectproto,
    149                         ostream &logout) {
    150  
    151   // define_internal_macros sets the following macros:
    152 
    153   // _pagetitle_            the title to be displayed at the top of the browser window
    154  
    155   // _imagethispage_        the title image to be displayed at top right of page
    156  
    157   // _classificationlinks_  the links between classifications to be displayed
    158   //                        at top of list or datelist classifications
    159 
    160   // _httpprevarrow_        these are set if next or previous arrows
    161   // _httpnextarrow_        are to be used - (i.e. if it's an AZList or a DateList
    162   //                        classifytype at a top level or if it's a Book or a
    163   //                        Hierarchy classifytype at document level
    164 
    165   // _navarrows_            this may be overridden to "" when format option
    166   //                        DocumentArrowsBottom is false
    167 
    168   // _header_               the header macro is overridden if we're not at a top level
    169   //                        classification to remove the title block
    170 
    171   // _javaimagescontent_    this is the javascript code to shove in to make the
    172   //                        flashy buttons work
    173 
    174   // _thisOID_              the OID (directory) of the current document - this corresponds
    175   //                        to the archivedir metadata element
    176 
    177   // can't do anything if collectproto is null (i.e. no collection was specified)
    178   if (collectproto == NULL) return;
    179  
    180   text_tarray metadata;
    181   FilterResponse_t response;
    182   text_t &arg_d = args["d"];
    183   text_t &arg_cl = args["cl"];
    184   text_t &collection = args["c"];
    185   int gt = args.getintarg("gt");
    186   load_formatinfo (collectinfo.format, gt);
    187 
    188   // don't want arrows or goto if we're in figures or facsimiles
    189   if (args["gg"] != "text") {
    190     formatinfo.DocumentArrowsBottom = false;
    191     formatinfo.DocumentArrowsTop = false;
    192     formatinfo.DocumentGoTo = false;
    193   }
    194 
    195   if (!formatinfo.DocumentArrowsBottom)
    196     disp.setmacro("navarrows", "document", "");
    197 
    198   metadata.push_back ("Title");
    199   metadata.push_back ("classifytype");
    200   metadata.push_back ("archivedir");
    201  
    202   if (!arg_d.empty()) {
    203     // we're at document level
    204    
    205     // get metadata for this document and it's parents
    206     if (get_info (arg_d, collection, metadata, true, collectproto, response, logout)) {
    207       disp.setmacro ("header", "document", "_textheader_");
    208 
    209       disp.setmacro ("thisOID", "Global", response.docInfo[0].metadata["archivedir"].values[0]);
    210 
    211       text_t &classifytype = response.docInfo[0].metadata["classifytype"].values[0];
    212       if (classifytype.empty()) classifytype = "Book"; // defaults to Book
    213 
    214       // set arrow macros if required
    215       if (((classifytype == "Book") && (formatinfo.DocumentArrowsTop || formatinfo.DocumentArrowsBottom)) ||
    216       ((classifytype == "Hierarchy") && formatinfo.DocumentArrowsBottom))
    217     set_arrow_macros (arg_d, classifytype, formatinfo.DocumentTopPages,
    218               disp, collectproto, collection, logout);
    219      
    220       if (args["u"] != "1")
    221     set_java_macros (args, disp);
    222 
    223     }
    224   } else {
    225     if (!arg_cl.empty()) {
    226    
    227       // get metadata for top level classification
    228       text_t classtop;
    229       get_top (arg_cl, classtop);
    230       if (get_info (classtop, collection, metadata, false, collectproto, response, logout)) {
    231      
    232     text_t &title = response.docInfo[0].metadata["Title"].values[0];
    233     text_t &classifytype = response.docInfo[0].metadata["classifytype"].values[0];
    234 
    235     disp.setmacro ("pagetitle", "document", "_text" + title + "page_");
    236     disp.setmacro ("imagethispage", "document", "_icon" + title + "page_");
    237 
    238     // now get the metadata for each child of top level
    239     // so we can generate the _classificationlinks_ and arrow macros
    240     // (if they're required by the current classification type)
    241    
    242     if ((classifytype == "AZList") || (classifytype == "DateList"))
    243       get_classificationlinks (arg_cl, collection, collectproto, disp, logout);
    244      
    245       }
    246     }
    247   }
    248 }
    249 
    250 */
    251205
    252206void cstrdocaction::output_document (const text_t &OID, cgiargsclass &args,
     
    272226    textout << outconvert << disp << "_textnoabstract_";
    273227    }
     228
    274229  } else if (arg_gg == "figures") {
    275230    metadata.insert ("figures");
     
    294249      }
    295250    }
     251
    296252  } else if (arg_gg == "facsimiles") {
    297253    metadata.insert ("facsimiles");
     
    299255    get_top (OID, top);
    300256    if (get_info (top, collection, metadata, false, collectproto, inforesponse, logout)) {
    301       text_t &facsimiles = inforesponse.docInfo[0].metadata["facsimiles"].values[0];
    302      
    303       if (!facsimiles.empty()) {
    304     text_tarray facs_array;
    305     splitchar (facsimiles.begin(), facsimiles.end(), ',', facs_array);
    306     text_tarray::const_iterator this_facs = facs_array.begin();
    307     text_tarray::const_iterator end_facs = facs_array.end();
    308     while (this_facs != end_facs) {
    309       textout << outconvert << disp
    310             << "<p><center><img border=1 src=\"_httpcollimg_/_thisOID_/"
    311           << *this_facs << "\"></center>\n";
    312       this_facs ++;
    313     }
    314       } else {
    315     textout << outconvert << disp << "_textnofacsimiles_";
     257
     258      text_tarray::const_iterator this_facs = inforesponse.docInfo[0].metadata["facsimiles"].values.begin();
     259      text_tarray::const_iterator end_facs = inforesponse.docInfo[0].metadata["facsimiles"].values.end();
     260      while (this_facs != end_facs) {
     261    textout << outconvert << disp
     262        << "<p><center><img border=1 src=\"_httpcollimg_/_thisOID_/"
     263        << *this_facs << "\"></center>\n";
     264    this_facs ++;
    316265      }
    317     }     
     266    } else {
     267      textout << outconvert << disp << "_textnofacsimiles_";
     268    }
    318269   
    319270  } else {
     
    323274    int wanttext = 0;
    324275    int arg_gt = args.getintarg("gt");
    325 
     276   
    326277    // if we have a query string and highlighting is turned on we need
    327278    // to redo the query to get the terms for highlighting
     
    440391
    441392
    442 bool cstrdocaction::do_action (cgiargsclass &args, recptprotolistclass *protos,
    443                 browsermapclass *browsers, displayclass &disp,
    444                 outconvertclass &outconvert, ostream &textout,
    445                 ostream &logout) {
    446 
    447 
    448   // must have a valid collection server
    449   recptproto *collectproto = protos->getrecptproto (args["c"], logout);
    450   if (collectproto == NULL) {
    451     logout << "cstrdocaction::do_action called with NULL collectproto\n";
    452     textout << outconvert << disp << "_document:header_\n"
    453         << "Error: Attempt to get document without setting collection\n"
    454         << "_document:footer_\n";
    455   } else { 
    456    
    457     text_t OID = args["d"];
    458     if (OID.empty()) OID = args["cl"];
    459     if (OID.empty()) {
    460       textout << outconvert << disp << "Document contains no data_document:footer_\n";
    461       return true;
    462     }
    463 
    464     textout << outconvert << disp << "_document:header_\n"
    465         << "_document:content_\n";
    466 
    467     if (args["d"].empty()) {
    468       output_toc (args, browsers, formatinfo, collectproto,
    469           disp, outconvert, textout, logout);
    470     } else {
    471       output_cstr_toc (args, browsers, formatinfo, collectproto,
    472                disp, outconvert, textout, logout);
    473 
    474       textout << "<p>\n";
    475       output_document (OID, args, collectproto, disp, outconvert, textout, logout);
    476     }
    477 
    478     textout << outconvert << disp << "_document:footer_\n";
    479   }
    480   return true;
    481 }
    482 
    483 
    484 
    485 
    486 
    487 
    488 
    489 
    490 
    491 
    492 
    493 
     393
     394
     395
     396
     397
     398
     399
     400
     401
     402
  • trunk/cstr/src/recpt/cstrdocaction.h

    r911 r1065  
    3636protected:
    3737
     38  void output_controls (cgiargsclass &args, const text_tarray &ibuttons,
     39            recptproto *collectproto, displayclass &disp,
     40            outconvertclass &outconvert, ostream &textout,
     41            ostream &logout);
     42
    3843  void set_java_macros (cgiargsclass &args, displayclass &disp);
    3944
     
    4853  virtual ~cstrdocaction ();
    4954
    50 
    5155  void get_cgihead_info (cgiargsclass &args, recptprotolistclass *protos,
    5256             response_t &response,text_t &response_data,
    5357             ostream &logout);
    54  
    55   //  void define_internal_macros (const ColInfoResponse_t &collectinfo, displayclass &disp,
    56                    //                  cgiargsclass &args, recptproto *collectproto,
    57                    //                  ostream &logout);
    58    
    59   bool do_action (cgiargsclass &args, recptprotolistclass *protos,
    60           browsermapclass *browsers, displayclass &disp,
    61           outconvertclass &outconvert, ostream &textout,
    62           ostream &logout);
    63  
    6458};
    6559
  • trunk/cstr/src/recpt/cstrlibrarymain.cpp

    r957 r1065  
    2828/*
    2929   $Log$
     30   Revision 1.4  2000/04/04 04:43:07  nzdl
     31   caught cstr collection up with DocumentColumn stuff
     32
    3033   Revision 1.3  2000/02/21 21:45:08  sjboddie
    3134   gsdlhome now set from gsdlsite.cfg
     
    6770#include "datelistbrowserclass.h"
    6871#include "invbrowserclass.h"
    69 #include "cstrpagedbrowserclass.h"
     72#include "pagedbrowserclass.h"
    7073#include "htmlbrowserclass.h"
    7174
     
    181184  recpt.add_browser (&ainvbrowserclass);
    182185
    183   cstrpagedbrowserclass apagedbrowserclass;
     186  pagedbrowserclass apagedbrowserclass;
    184187  recpt.add_browser (&apagedbrowserclass);
    185188
Note: See TracChangeset for help on using the changeset viewer.