Ignore:
Timestamp:
2000-04-07T16:40:45+12:00 (24 years ago)
Author:
sjboddie
Message:

Reverted back to old DocumentHeader, DocumentTitles, DocumentImages etc.
from DocumentColumns stuff. I'll move the DocumentColumns stuff to a
separate development branch (New_Config_Format-branch) for now. The plan
is to redesign the configuration file format a bit and limit the number of
distributions floating around that take different configuration formats).

File:
1 edited

Legend:

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

    r1059 r1079  
    2828/*
    2929   $Log$
    30    Revision 1.36  2000/04/03 07:26:28  sjboddie
    31    replaced old DocumentIcon and DocumentContents format options
    32    with DocumentColumn stuff
    33 
    34    Revision 1.35  2000/03/31 03:04:31  nzdl
    35    tidied up some of the browsing code - replaced DocumentImages,
    36    DocumentTitles and DocumentHeading with DocumentIcon
     30   Revision 1.37  2000/04/07 04:40:44  sjboddie
     31   Reverted back to old DocumentHeader, DocumentTitles, DocumentImages etc.
     32   from DocumentColumns stuff. I'll move the DocumentColumns stuff to a
     33   separate development branch (New_Config_Format-branch) for now. The plan
     34   is to redesign the configuration file format a bit and limit the number of
     35   distributions floating around that take different configuration formats).
    3736
    3837   Revision 1.34  2000/02/15 22:53:49  kjm18
     
    293292
    294293documentaction::~documentaction () {
    295 }
    296 
    297 
    298 // output_controls displays the detach, expand/contract contents,
    299 // expand/contract text and highlighting/no highlighting buttons
    300 void documentaction::output_controls (cgiargsclass &args, const text_tarray &ibuttons,
    301                       recptproto * /*collectproto*/, displayclass &disp,
    302                       outconvertclass &outconvert, ostream &textout,
    303                       ostream &/*logout*/) {
    304 
    305   if (args["u"] != "1") {
    306    
    307     FilterResponse_t response;
    308     text_tarray metadata;
    309     text_tarray buttons;
    310    
    311     text_tarray::const_iterator here = ibuttons.begin();
    312     text_tarray::const_iterator end = ibuttons.end();
    313    
    314     while (here != end) {
    315      
    316       if (*here == "Detach")
    317     buttons.push_back ("_document:imagedetach_");
    318       else if (*here == "Highlight") {
    319     if (args["hl"] == "1")
    320       buttons.push_back ("_document:imagenohighlight_");
    321     else
    322       buttons.push_back ("_document:imagehighlight_");
    323       } else if (*here == "Expand Contents") {
    324     if (args["gc"] == "1")
    325       buttons.push_back ("_document:imagecontracttoc_");
    326     else
    327       buttons.push_back ("_document:imageexpandtoc_");
    328       } else if (*here == "Expand Text") {
    329     if (args.getintarg("gt"))
    330       buttons.push_back ("_document:imagecontracttext_");
    331     else
    332       buttons.push_back ("_document:imageexpandtext_");
    333       }
    334       here ++;
    335     }
    336    
    337     here = buttons.begin();
    338     end = buttons.end();
    339     int count = 0;
    340     while (here != end) {
    341       if ((count != 0) && ((count % 2) == 0)) textout << "<br>\n";
    342       textout << outconvert << disp << *here;
    343       count ++;
    344       here ++;
    345     }
    346   }
    347 }
    348 
    349 void documentaction::output_formatstring (const text_t &OID, const text_t &collection,
    350                       recptproto *collectproto, const text_t &formatstring,
    351                       displayclass &disp, outconvertclass &outconvert,
    352                       ostream &textout, ostream &logout) {
    353 
    354   if (OID.empty()) return;
    355  
    356   text_tset metadata;
    357   bool getParents;
    358   FilterResponse_t response;
    359 
    360   format_t *formatlistptr = new format_t();
    361   parse_formatstring (formatstring, formatlistptr, metadata, getParents);
    362 
    363   if (!get_info (OID, collection, metadata, getParents, collectproto, response, logout))
    364     return;
    365 
    366   textout << outconvert << disp << get_formatted_string (response.docInfo[0], formatlistptr);
    367 }
    368 
    369 // output_headerstring outputs a formatstring that may contain the
    370 // [Buttons] and [TOC] elements. It separates these elements out,
    371 // calling output_controls and output_toc respectively to process
    372 // the special elements. Calls output_formatstring to process the
    373 // remaining bits of formatstring
    374 void documentaction::output_headerstring (cgiargsclass &args, recptproto *collectproto,
    375                       const text_t &formatstring, browsermapclass *browsers,
    376                       displayclass &disp, outconvertclass &outconvert,
    377                       ostream &textout, ostream &logout) {
    378 
    379   text_t &OID = args["d"];
    380   if (OID.empty()) OID = args["cl"];
    381   text_t &collection = args["c"];
    382 
    383   text_t::const_iterator here = formatstring.begin();
    384   text_t::const_iterator end = formatstring.end();
    385 
    386   text_t currentstring;
    387   while (here != end) {
    388     if ((*here == '[') && (*(here+1) == 'B') && (*(here+2) == 'u') &&
    389     (*(here+3) == 't') && (*(here+4) == 't') && (*(here+5) == 'o') &&
    390     (*(here+6) == 'n') && (*(here+7) == 's') && (*(here+8) == ']')) {
    391       here += 8;
    392       if (!currentstring.empty()) {
    393     output_formatstring (OID, collection, collectproto, currentstring,
    394                  disp, outconvert, textout, logout);
    395     currentstring.clear();
    396       }
    397      
    398       output_controls (args, formatinfo.DocumentButtons, collectproto,
    399                disp, outconvert, textout, logout);
    400 
    401     } else if ((*here == '[') && (*(here+1) == 'T') && (*(here+2) == 'O') &&
    402     (*(here+3) == 'C') && (*(here+4) == ']')) {
    403       here += 4;
    404       if (!currentstring.empty()) {
    405     output_formatstring (OID, collection, collectproto, currentstring,
    406                  disp, outconvert, textout, logout);
    407     currentstring.clear();
    408       }
    409 
    410       output_toc (args, browsers, formatinfo.formatstrings, collectproto,
    411           disp, outconvert, textout, logout);
    412 
    413     } else {
    414       currentstring.push_back (*here);
    415     }
    416 
    417     here ++;
    418   }
    419 
    420   if (!currentstring.empty())
    421     output_formatstring (OID, collection, collectproto, currentstring,
    422              disp, outconvert, textout, logout);
    423294}
    424295
     
    740611
    741612  while (format_here != format_end) {
    742     if ((*format_here).first == "DocumentColumns")
    743       formatinfo.DocumentColumns = (*format_here).second;
    744     else if ((*format_here).first == "DocumentColumnsTotalWidth")
    745       formatinfo.DocumentColumnsTotalWidth = (*format_here).second;
    746     else if ((*format_here).first == "DocumentColumnLeft")
    747       formatinfo.DocumentColumnLeft = (*format_here).second;
    748     else if ((*format_here).first == "DocumentColumnLeftWidth")
    749       formatinfo.DocumentColumnLeftWidth = (*format_here).second;
    750     else if ((*format_here).first == "DocumentColumnRight")
    751       formatinfo.DocumentColumnRight = (*format_here).second;
     613    if (((*format_here).first == "DocumentImages") &&
     614    ((*format_here).second == "true"))
     615      formatinfo.DocumentImages = true;
     616    else if (((*format_here).first == "DocumentTitles") &&
     617         ((*format_here).second == "false"))
     618      formatinfo.DocumentTitles = false;
     619    else if ((*format_here).first == "DocumentHeading")
     620      formatinfo.DocumentHeading = (*format_here).second;
     621    else if (((*format_here).first == "DocumentContents") &&
     622         ((*format_here).second == "false"))
     623      formatinfo.DocumentContents = false;
    752624    else if (((*format_here).first == "DocumentArrowsBottom") &&
    753625         ((*format_here).second == "false"))
     
    977849    textout << outconvert << disp << "_document:header_\n"
    978850        << "_document:content_\n";
    979 
    980     // currently only display header information at document level,
    981     // this should probably be changed to handle stuff like CL1Columns
    982     if (!args["d"].empty()) {
    983       textout << outconvert << disp
    984           << "<p><center><table width=_pagewidth_><tr>\n"
    985           << "<td valign=top";
    986       if (formatinfo.DocumentColumns == "2") {
    987     textout << outconvert << disp
    988         << " width=" << formatinfo.DocumentColumnLeftWidth << ">\n";
    989     output_headerstring (args, collectproto, formatinfo.DocumentColumnLeft,
    990                  browsers, disp, outconvert, textout, logout);
    991     textout << "\n</td><td valign=top>\n";
    992     output_headerstring (args, collectproto, formatinfo.DocumentColumnRight,
    993                  browsers, disp, outconvert, textout, logout);
    994       } else {
    995     textout << " width=100%>\n";
    996     output_headerstring (args, collectproto, formatinfo.DocumentColumnLeft,
    997                  browsers, disp, outconvert, textout, logout);
    998       }
    999       textout << "\n</td></tr></table></center>\n";
    1000     } else {
    1001       // classification level
    1002       output_toc (args, browsers, formatinfo.formatstrings, collectproto,
    1003           disp, outconvert, textout, logout);
    1004     }
     851     
     852    // output the table of contents
     853    output_toc (args, browsers, formatinfo, collectproto,
     854        disp, outconvert, textout, logout);
    1005855   
    1006856    // output the document text
     
    12481098  textout << outconvert << disp << buffer;
    12491099}
     1100
     1101
     1102
     1103
     1104
     1105
     1106
     1107
     1108
     1109
     1110
Note: See TracChangeset for help on using the changeset viewer.