Changeset 4893


Ignore:
Timestamp:
2003-07-11T08:48:10+12:00 (21 years ago)
Author:
sjboddie
Message:

Added NavigationBar format option for specifying an alternative format
for the navigation bar.

Location:
trunk/gsdl/src/recpt
Files:
2 edited

Legend:

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

    r4868 r4893  
    286286// reponse contains 1 metadata field (Title)
    287287void documentaction::set_navbarmacros (displayclass &disp, FilterResponse_t &response,
    288                        bool has_search_button, cgiargsclass &args) {
    289 
    290   text_t topparent;
    291   text_t &arg_d = args["d"];
    292   text_t navigationbar = "<!-- Navigation Bar -->\n";
    293 
    294   get_top (args["cl"], topparent);
    295   int numc = response.docInfo.size();
    296   ResultDocInfo_tarray::iterator dochere = response.docInfo.begin();
    297   ResultDocInfo_tarray::iterator docend = response.docInfo.end();
    298 
    299   navigationbar += "<nobr>\n";
    300   if (has_search_button) {
    301     if (args["a"] == "q") {
    302       navigationbar += "_icontabsearchgreen_";
    303     } else {
    304       navigationbar += "_imagesearch_";
    305     }
    306   }
    307  
    308   if (has_search_button || numc == 0) navigationbar += "_imagespacer_";
    309  
    310   bool first = true;
    311   while (dochere != docend) {
    312 
    313     if (!first) navigationbar += "_imagespacer_";
    314 
    315     text_t title = (*dochere).metadata["Title"].values[0];
    316 
    317     bool unknown = false;
    318 
    319     // test the _XXXwidth_ macro to see if image macros are
    320     // defined for this type of classification - if not we'll
    321     // just display the text
    322     text_t tmpwidth;
    323     disp.expandstring ("document", "_" + title + "width_", tmpwidth);
    324     if (tmpwidth == ("_" + title + "width_")) unknown = true;
    325 
    326     // if we're inside a document all the classification buttons should be enabled
    327     if (arg_d.empty() && ((*dochere).OID == topparent)) {
    328       if (unknown) navigationbar += "&nbsp;" + title + "&nbsp;";
    329       else navigationbar += "_icontab" + title + "green_";
    330     } else {
    331 
    332       // set the _httpbrowseXXX_ macro for this classification
    333       if (unknown) navigationbar += "&nbsp;<a href=\"_httpdocument_&cl=" +
    334              (*dochere).OID + "\">" + title + "</a>&nbsp;";
    335       else {
    336         navigationbar += "_image" + title + "_";
    337         disp.setmacro ("httpbrowse" + title, "Global", "_httpdocument_&cl=" + (*dochere).OID);
    338       }
    339     }
    340     dochere ++;
    341     first = false;
    342   }
    343   navigationbar += "\n</nobr>\n";
    344   navigationbar += "<!-- End of Navigation Bar -->\n";
    345   disp.setmacro ("navigationbar", "Global", navigationbar);
     288                       bool has_search_button, cgiargsclass &args,
     289                       ColInfoResponse_t &cinfo) {
     290
     291
     292   bool use_pulldown = false;
     293   text_tmap::iterator it = cinfo.format.find("NavigationBar");
     294   if (it != cinfo.format.end()) {
     295      if (it->second == "pulldown") {
     296     use_pulldown = true;
     297      }
     298   }
     299
     300   text_t topparent;
     301   text_t &arg_d = args["d"];
     302   text_t navigationbar = "<!-- Navigation Bar -->\n";
     303
     304   get_top (args["cl"], topparent);
     305   int numc = response.docInfo.size();
     306   ResultDocInfo_tarray::iterator dochere = response.docInfo.begin();
     307   ResultDocInfo_tarray::iterator docend = response.docInfo.end();
     308
     309   if (!use_pulldown) {
     310      navigationbar += "<nobr>\n";
     311      if (has_search_button) {
     312     if (args["a"] == "q") {
     313        navigationbar += "_icontabsearchgreen_";
     314     } else {
     315        navigationbar += "_imagesearch_";
     316     }
     317      }
     318 
     319      if (has_search_button || numc == 0) navigationbar += "_imagespacer_";
     320 
     321      bool first = true;
     322      while (dochere != docend) {
     323     
     324     if (!first) navigationbar += "_imagespacer_";
     325     
     326     text_t title = (*dochere).metadata["Title"].values[0];
     327     
     328     bool unknown = false;
     329     
     330     // test the _XXXwidth_ macro to see if image macros are
     331     // defined for this type of classification - if not we'll
     332     // just display the text
     333     text_t tmpwidth;
     334     disp.expandstring ("document", "_" + title + "width_", tmpwidth);
     335     if (tmpwidth == ("_" + title + "width_")) unknown = true;
     336     
     337     // if we're inside a document all the classification buttons should be enabled
     338     if (arg_d.empty() && ((*dochere).OID == topparent)) {
     339        if (unknown) navigationbar += "&nbsp;" + title + "&nbsp;";
     340        else navigationbar += "_icontab" + title + "green_";
     341     } else {
     342       
     343        // set the _httpbrowseXXX_ macro for this classification
     344        if (unknown) navigationbar += "&nbsp;<a href=\"_httpdocument_&cl=" +
     345                (*dochere).OID + "\">" + title + "</a>&nbsp;";
     346        else {
     347           navigationbar += "_image" + title + "_";
     348           disp.setmacro ("httpbrowse" + title, "Global", "_httpdocument_&cl=" + (*dochere).OID);
     349        }
     350     }
     351     dochere ++;
     352     first = false;
     353      }
     354      navigationbar += "\n</nobr>\n";
     355      navigationbar += "<!-- End of Navigation Bar -->\n";
     356
     357   } else {
     358
     359      navigationbar = "<form method=\"get\" name=\"navform\">\n";
     360      navigationbar += "<select name=\"navbar\" onChange=\"location.href=";
     361      navigationbar += "document.navform.navbar.options[document.navform.navbar.selectedIndex].value\">\n";
     362
     363      if (args["a"] != "q" && args["cl"].empty()) {
     364     navigationbar += "<option value=\"\" selected></option>\n";
     365      }
     366     
     367      if (has_search_button) {
     368     navigationbar += "<option value=\"_httpquery_\"";
     369     if (args["a"] == "q") {
     370        navigationbar += " selected";
     371     }
     372     navigationbar += ">_texticontabsearchgreen_</option>\n";
     373      }
     374
     375      while (dochere != docend) {
     376     text_t title = dochere->metadata["Title"].values[0];   
     377     navigationbar += "<option value=\"_httpdocument_&cl=" + dochere->OID + "\"";
     378     if (topparent == dochere->OID) {
     379        navigationbar += " selected";
     380     }
     381     navigationbar += ">" + title + "</option>\n";
     382     dochere++;
     383      }
     384
     385      navigationbar += "</select>\n";
     386      navigationbar += "</form>\n";
     387   }
     388
     389   disp.setmacro ("navigationbar", "Global", navigationbar);
    346390}
    347391
     
    448492
    449493    // set _navigationbar_ macro
    450     set_navbarmacros (disp, response, has_search_button, args);
     494    set_navbarmacros (disp, response, has_search_button, args, cinfo);
    451495   
    452496      }
  • trunk/gsdl/src/recpt/documentaction.h

    r4868 r4893  
    4848
    4949  void set_navbarmacros (displayclass &disp, FilterResponse_t &response,
    50              bool has_search_button, cgiargsclass &args);
     50             bool has_search_button, cgiargsclass &args,
     51             ColInfoResponse_t &cinfo);
    5152
    5253  virtual void output_text (ResultDocInfo_t &docinfo, format_t *formatlistptr,
Note: See TracChangeset for help on using the changeset viewer.