Ignore:
Timestamp:
2001-02-09T15:41:33+13:00 (23 years ago)
Author:
jmt14
Message:

Modified files:

browsetools.cpp documentaction.cpp formattools.cpp
formattools.h

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/documentaction.cpp

    r1860 r1941  
    144144  arg_ainfo.savedarginfo = cgiarginfo::must;
    145145  argsinfo.addarginfo (NULL, arg_ainfo);
     146
     147  //rd is whether a document will be displayed
     148  //with a relevant document list
     149  arg_ainfo.shortname = "rd";
     150  arg_ainfo.longname = "include relevant documents";
     151  arg_ainfo.multiplechar = false;
     152  arg_ainfo.defaultstatus = cgiarginfo::weak;
     153  arg_ainfo.argdefault = "0";
     154  arg_ainfo.savedarginfo = cgiarginfo::must;
     155  argsinfo.addarginfo (NULL, arg_ainfo);
     156
    146157}
    147158
     
    183194    if (xinfo != NULL) args["x"] = xinfo->argdefault;
    184195  }
     196
     197  //checks whether rd arg is valid
     198  int arg_rd = args.getintarg("rd");
     199  if (arg_rd != 0 && arg_rd != 1) {
     200    logout << "Warning: \"rd\" argument out of range (" << arg_rd << ")\n";
     201    cgiarginfo *rdinfo = argsinfo.getarginfo ("rd");
     202    if (rdinfo != NULL) args["rd"] = rdinfo->argdefault;
     203  }
     204
    185205
    186206  return true;
     
    490510         '|', formatinfo.DocumentButtons);
    491511    else if ((*format_here).first == "DocumentText")
    492       formatinfo.DocumentText = (*format_here).second;
     512      formatinfo.DocumentText = (*format_here).second; 
     513    else if ((*format_here).first == "RelatedDocuments")
     514      formatinfo.RelatedDocuments = (*format_here).second;
    493515    else if (((*format_here).first == "DocumentUseHTML") &&
    494516         ((*format_here).second == "true"))
     
    565587      options.push_back(opt);
    566588    }
    567 
     589   
     590    //do not display relation metadata
     591    disp.setmacro ("relateddoc", "document", ""); 
     592       
     593    //if preferences indicate relevant docs should be collected
     594    //and there is no particular format specified then display
     595    //this default format.
     596     if(args["rd"] == "1" && formatinfo.RelatedDocuments.empty()){
     597
     598       text_t relation = ""; //string for displaying relation metadata
     599
     600       //call function in formattools.cpp which will return the text of the
     601       //related documents in a vertical list. This is the default format.
     602       if (get_info (arg_d, collection, metadata, options, false, collectproto, response, logout))
     603     relation += get_related_docs(collection, collectproto, response.docInfo[0], logout);
     604       
     605       //set macro to be the related document string
     606       disp.setmacro ("relateddoc", "document", relation);
     607     }
     608     
     609 
    568610    // get metadata for this document and it's parents
    569611    if (get_info (arg_d, collection, metadata, options,
    570612          true, collectproto, response, logout)) {
     613
    571614      disp.setmacro ("header", "document", "_textheader_");
    572 
     615     
    573616      text_tarray pagetitlearray;
    574617      if (!response.docInfo[0].metadata["Title"].values[0].empty())
    575618    pagetitlearray.push_back (response.docInfo[0].metadata["Title"].values[0]);
     619     
    576620      if (args["gt"] != "1") {
    577621    MetadataInfo_t *parenttitle = response.docInfo[0].metadata["Title"].parent;
     
    627671    }
    628672
    629         // Add a macro to display the phind classifier (if appropriate)
     673        //if the document is not a document from a collection
     674    //we must set the macro to be an empty string
     675    disp.setmacro ("relateddoc", "document", "");
     676
     677    // Add a macro to display the phind classifier (if appropriate)
    630678    text_t &childtype = response.docInfo[0].metadata["childtype"].values[0];
    631679    if (childtype == "Phind") {
     
    642690                outconvertclass &outconvert, ostream &textout,
    643691                ostream &logout) {
    644 
    645 
     692 
    646693  // must have a valid collection server
    647694  recptproto *collectproto = protos->getrecptproto (args["c"], logout);
     
    660707    }
    661708
     709 
    662710    if (formatinfo.DocumentUseHTML) {
    663711     
     
    682730    }
    683731
     732   
    684733    textout << outconvert << disp << "_document:header_\n"
    685734        << "_document:content_\n";
    686735     
    687736    // output the table of contents
     737    logout << "formatinfo.RelatedDocs: " << formatinfo.RelatedDocuments.getcstr() << endl;
    688738    output_toc (args, browsers, formatinfo, collectproto,
    689739        disp, outconvert, textout, logout);
    690    
     740   
     741    //output the related documents (may be the empty string)
     742    //will not output the docs if a format string is specified
     743    textout << outconvert << disp << "_document:relateddoc_\n";
     744
    691745    // output the document text
    692746    textout << "<p>\n";
     
    774828  }
    775829
     830
    776831  format_t *formatlistptr = new format_t();
    777832  parse_formatstring (formatinfo.DocumentText, formatlistptr, metadata, getParents);
     
    779834  metadata.insert ("hastxt");
    780835  metadata.insert ("haschildren");
    781   
     836 
    782837  if (formatinfo.DocumentText == "[Text]")
    783838    wanttext = 1;
Note: See TracChangeset for help on using the changeset viewer.