Ignore:
Timestamp:
2005-11-08T17:30:57+13:00 (18 years ago)
Author:
jrm21
Message:

documentaction modified for new HTML4/CSS stuff (eg stop looking for
icon width macros). Other files modified to tidy up output (put tag
attribute values in quotes, use & instead of &, etc). Not quite
finished yet but it works.

File:
1 edited

Legend:

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

    r9923 r10873  
    380380
    381381   if (!use_pulldown) {
    382       navigationbar += "<nobr>\n";
     382
     383      navigationbar += "_navtabsearch_";
    383384      if (has_search_button) {
    384385     if (args["a"] == "q") {
    385         navigationbar += "_icontabsearchgreen_";
    386      } else {
    387         navigationbar += "_imagesearch_";
     386        navigationbar += "(selected)";
    388387     }
    389388      }
    390389 
    391       if (has_search_button || numc == 0) navigationbar += "_imagespacer_";
     390      if (has_search_button || numc == 0) navigationbar += "_navbarspacer_";
    392391 
    393392      bool first = true;
    394393      while (dochere != docend) {
    395394    date_extra = g_EmptyText;
    396      if (!first) navigationbar += "_imagespacer_";
     395     if (!first) navigationbar += "_navbarspacer_";
    397396     
    398397     text_t title = (*dochere).metadata["Title"].values[0];
     
    402401         date_meta = "Date";
    403402       }
    404        date_extra = "&dm="+date_meta;
     403       date_extra = "&amp;dm="+date_meta;
    405404     }
    406405     bool unknown = false;
    407406     
    408      // test the _XXXwidth_ macro to see if image macros are
    409      // defined for this type of classification - if not we'll
    410      // just display the text
     407     // test if the _tabtext$FIELD_ macro is defined, which means
     408     // this is a "known" metadata type and we have a translation for it
    411409     text_t tmpwidth;
    412      disp.expandstring ("document", "_" + title + "width_", tmpwidth);
    413      if (tmpwidth == ("_" + title + "width_")) unknown = true;
     410     text_t macroname="_tabtext" + title + "_";
     411     disp.expandstring ("document", macroname, tmpwidth);
     412     if (tmpwidth == macroname) // it wasn't expanded
     413       unknown = true;
    414414     
    415415     // if we're inside a document all the classification buttons should be enabled
    416      if (arg_d.empty() && ((*dochere).OID == topparent)) {
    417         if (unknown) navigationbar += " " + title + " ";
    418         else navigationbar += "_icontab" + title + "green_";
    419      } else {
    420        
    421         // set the _httpbrowseXXX_ macro for this classification
    422         if (unknown) navigationbar += " <a href=\"_httpdocument_&cl=" +
    423                 (*dochere).OID + date_extra+"\">" + title + "</a> ";
    424         else {
    425            navigationbar += "_image" + title + "_";
    426            disp.setmacro ("httpbrowse" + title, displayclass::defaultpackage, "_httpdocument_&cl=" + (*dochere).OID+date_extra);
    427         }
     416     text_t this_tab;
     417     bool is_top;
     418
     419     is_top = ((*dochere).OID == topparent);
     420
     421     // set default text fragment
     422     this_tab = "_navtab_(";
     423
     424     if (unknown) { // just give the field name
     425       if (!is_top) {
     426         // work out the link for this classifier, as it isn't the
     427         // current page
     428         this_tab += "_httpdocument_&amp;cl=" + (*dochere).OID
     429           + date_extra;
     430       }
     431       this_tab += "," + title + ",";
     432     } else { // use the macro for this field so we get translations
     433       this_tab += "_httpbrowse" + title;
     434       this_tab += "_,_tabtext" + title;
     435       this_tab += "_,_textdescr" + title + "_";
    428436     }
     437
     438     if (arg_d.empty() && is_top) {
     439       // don't link to this classifier as it is the current one
     440       this_tab += ",selected";
     441     } else if (!unknown) {
     442       // set the _httpbrowseXXX_ macro for this classification
     443       // set the correct url for this link
     444       disp.setmacro ("httpbrowse" + title, displayclass::defaultpackage, "_httpdocument_&amp;cl=" + (*dochere).OID+date_extra);
     445     }
     446
     447     this_tab += ")";
     448
     449     navigationbar += this_tab;
     450
    429451     ++dochere;
    430452     first = false;
    431453      }
    432454
    433       if (!has_search_button && numc == 1) navigationbar += "_imagespacer_";
    434 
    435       navigationbar += "\n</nobr>\n";
    436       navigationbar += "<!-- End of Navigation Bar -->\n";
     455      if (!has_search_button && numc == 1) navigationbar += "_navbarspacer_";
     456
     457      navigationbar += "\n<!-- End of Navigation Bar -->\n";
    437458
    438459   } else {
     
    451472        navigationbar += " selected";
    452473     }
    453      navigationbar += ">_texticontabsearchgreen_</option>\n";
     474     navigationbar += ">_tabtextsearch_</option>\n";
    454475      }
    455476
     
    461482         date_meta = "Date";
    462483       }
    463        date_extra = "&dm="+date_meta;
     484       date_extra = "&amp;dm="+date_meta;
    464485     }
    465486
    466      navigationbar += "<option value=\"_httpdocument_&cl=" + dochere->OID +date_extra+ "\"";
     487     navigationbar += "<option value=\"_httpdocument_&amp;cl=" + dochere->OID +date_extra+ "\"";
    467488     if (topparent == dochere->OID) {
    468489        navigationbar += " selected";
     
    505526  // _httppagehome_      overridden home url if html collections have own homepage
    506527
    507   // _usability_         a macro for remote usability reporting
    508528
    509529  // must have a valid collection server to continue
     
    549569      text_t httpdocument;
    550570      disp.expandstring (displayclass::defaultpackage, "_httpdocument_", httpdocument);
    551       httpdocument += "&f=1";
     571      httpdocument += "&amp;f=1";
    552572      disp.setmacro ("httpdocument", displayclass::defaultpackage, httpdocument);
    553573      disp.setmacro ("gsdltop", displayclass::defaultpackage, "documenttop");
     
    592612    }
    593613  }
    594   text_tmap::iterator usability = cinfo.format.find("Usability");
    595   if(usability!=cinfo.format.end()){
    596     disp.setmacro("usability",displayclass::defaultpackage,"_imageusab_");
    597     disp.setmacro("usabinterface",displayclass::defaultpackage,("_usab"+(*usability).second+"_"));
    598     disp.setmacro("usabilityscript", displayclass::defaultpackage, "_usabshowscript_");
    599   }
    600614}
    601615
     
    612626  if (get_info (inlink, args["c"], args["l"], metadata, false, collectproto, response, logout)) {
    613627    if (!response.docInfo[0].metadata["section"].values[0].empty()) {
    614       outlink = "_httpdocument_&d=" + response.docInfo[0].metadata["section"].values[0];
     628      outlink = "_httpdocument_&amp;d=" + response.docInfo[0].metadata["section"].values[0];
    615629      return true;
    616630    }
     
    635649      if (get_info (inlink, *col_here, args["l"], metadata, false, collectproto, response, logout)) {
    636650    if (!response.docInfo[0].metadata["section"].values[0].empty()) {
    637       outlink = "_httpdocument_&c=" + *col_here + "&d=" +
     651      outlink = "_httpdocument_&amp;c=" + *col_here + "&amp;d=" +
    638652        response.docInfo[0].metadata["section"].values[0];
    639653      return true;
     
    869883    bool unknown = false;
    870884
    871     // test the _XXXwidth_ macro to see if image macros are
     885    // test the _iconXXXpage_ macro to see if image macros are
    872886    // defined for this type of classification - if not we'll
    873887    // just display the text
    874888    text_t tmp;
    875     disp.expandstring ("document", "_" + title + "width_", tmp);
    876     if (tmp == ("_" + title + "width_")) unknown = true;
     889    text_t macroname="_icon" + title + "page_";
     890    disp.expandstring ("document", macroname, tmp);
     891    if (tmp == macroname) unknown = true; // it wasn't expanded
    877892
    878893    if (unknown) {
     
    12781293  // work out values for next link
    12791294  if (haschildren) {
    1280     disp.setmacro ("httpnextarrow", "document", "_httpdocument_&cl=" + args["cl"] +
    1281            "&d=" + arg_d + ".fc");
     1295    disp.setmacro ("httpnextarrow", "document", "_httpdocument_&amp;cl=" + args["cl"] +
     1296           "&amp;d=" + arg_d + ".fc");
    12821297  } else {
    12831298    text_tarray::const_iterator h = next_siblings.begin();
     
    12851300    while (h != e) {
    12861301      if (!(*h).empty()) {
    1287     disp.setmacro ("httpnextarrow", "document", "_httpdocument_&cl=" + args["cl"] +
    1288                "&d=" + *h);
     1302    disp.setmacro ("httpnextarrow", "document", "_httpdocument_&amp;cl=" + args["cl"] +
     1303               "&amp;d=" + *h);
    12891304    break;
    12901305      }
     
    12951310  // work out value for previous link
    12961311  if (!previous_sibling.empty()) {
    1297     disp.setmacro ("httpprevarrow", "document", "_httpdocument_&cl=" + args["cl"] +
    1298            "&d=" + previous_sibling);
     1312    disp.setmacro ("httpprevarrow", "document", "_httpdocument_&amp;cl=" + args["cl"] +
     1313           "&amp;d=" + previous_sibling);
    12991314  } else {
    13001315    if (countchar(arg_d.begin(), arg_d.end(), '.')) {
    1301       disp.setmacro ("httpprevarrow", "document", "_httpdocument_&cl=" + args["cl"] +
    1302              "&d=" + get_parent(arg_d));
     1316      disp.setmacro ("httpprevarrow", "document", "_httpdocument_&amp;cl=" + args["cl"] +
     1317             "&amp;d=" + get_parent(arg_d));
    13031318    }
    13041319  }
Note: See TracChangeset for help on using the changeset viewer.