Changeset 10947


Ignore:
Timestamp:
2005-11-25T13:12:03+13:00 (18 years ago)
Author:
jrm21
Message:

If we aren't using tables (ie format string doesn't start with <td>)
then wrap the h/v list with <div> ... </div>.
Also add class=v_list | h_list respectively to opening <table>/<div> tags.

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

Legend:

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

    r10873 r10947  
    102102        collectproto, response, logout);
    103103
    104                    
     104  /* use_table is set to true if the format string starts with <td> */
    105105  if (use_table || colnumber > 0) {
    106106    textout << outconvert << "<table><tr><td>";
     
    115115  }
    116116
    117   textout << outconvert << "<table><tr>\n";
     117  if (use_table)
     118    textout << outconvert << "<table class=\"h_list\"><tr>\n";
     119  else
     120    textout << outconvert << "<div class=\"h_list\">\n";
    118121
    119122  ResultDocInfo_tarray::iterator tsibling = response.docInfo.begin();
     
    121124
    122125  text_t icon, link;
    123   int num_chars=0; // see note below - jrm21
     126
    124127  while (tsibling != esibling) {
    125128
     
    139142    if (args["xx"]=="1") {
    140143      // documents should be detached
    141       link += "&amp;x=1\" target=\\_blank>";
     144      link += "&amp;x=1\" target=\"_blank\">";
    142145    } else {
    143146      link += "\">";
     
    156159                      options, logout);
    157160
    158     /* this is awful. Someone please come up with a better way to prevent
    159        the table of contents when browsing metadata from becoming too wide.
    160        This is an attempt to add new rows when the number of characters in
    161        the current row becomes too high. It doesn't know about macros in the
    162        string, though... -- jrm21 */
    163 
    164     char *tmp_str=fmt_str.getcstr();
    165     char *end_str=tmp_str+strlen(tmp_str);
    166     while (tmp_str<end_str) {
    167       if (*tmp_str=='<') {    // for html tags
    168     while (*tmp_str!='>') ++tmp_str;
    169       } else if (*tmp_str=='&') { // for html entities
    170     while (*tmp_str!=';') ++tmp_str;
    171     ++num_chars;
    172       } else ++num_chars;
    173       ++tmp_str;
    174     }
    175 
    176     if (num_chars>100) { // this is fairly arbitrary...
    177       textout << outconvert << "</tr>\n<tr>";
    178       num_chars=0;
    179     }
    180 
    181     textout << outconvert << "<td>" << disp << fmt_str << "</td>\n";
     161    textout << outconvert << "<span class=\"h_item\">" << disp << fmt_str << "</span>\n";
    182162    ++tsibling;
    183163  }
    184164
    185   textout << outconvert << "</tr></table>\n";
     165  if (use_table)
     166    textout << outconvert << "</tr></table>\n";
     167  else
     168    textout << outconvert << "</div>\n";
     169
    186170  if (use_table  || colnumber > 0) textout << outconvert << "</tr></table>\n";
     171
    187172  return 0;
    188173}
  • trunk/gsdl/src/recpt/vlistbrowserclass.cpp

    r10873 r10947  
    5757
    5858text_t vlistbrowserclass::get_default_formatstring () {
    59   return "<td valign=top>[link][icon][/link]</td>"
    60     "<td valign=top>[srclink][srcicon][/srclink]</td>"
    61     "<td valign=top>[highlight]{Or}{[Title],Untitled}[/highlight]"
     59  return "<td valign=\"top\">[link][icon][/link]</td>"
     60    "<td valign=\"top\">[srclink][srcicon][/srclink]</td>"
     61    "<td valign=\"top\">[highlight]{Or}{[Title],Untitled}[/highlight]"
    6262    "{If}{[Source],<br><i>([Source])</i>}</td>";
    6363}
     
    8484
    8585
     86  /* use_table is set to true if the format string starts with <td> */
    8687  if (use_table || colnumber > 0) {
    87     textout << outconvert << "<table><tr valign=top>";
     88    textout << outconvert << "<table class=\"v_list\"><tr valign=\"top\">";
    8889    // get tab size
    8990    text_t tab; int itab;
     
    9394                   << "<td><img src=\"_httpimg_/space.gif\" width="
    9495                   << (itab*colnumber) << "></td>";
     96  } else {
     97    textout << outconvert << "<div class=\"v_list\">\n";
    9598  }
    9699
     
    106109                   options, logout);
    107110 
    108   if (use_table  || colnumber > 0) textout << outconvert << "</tr></table>\n";
     111  if (use_table  || colnumber > 0) {
     112    textout << outconvert << "</tr></table>\n";
     113  } else {
     114    textout << outconvert << "</div>\n";
     115  }
    109116
    110117  return 1;
     
    127134
    128135  if (colnumber > 0) {
    129     textout << outconvert << "<table><tr valign=top>";
     136    textout << outconvert << "<table><tr valign=\"top\">";
    130137    // get tab size
    131138    text_t tab; int itab;
     
    137144    textout << outconvert << "<td>";
    138145  }
    139   if (use_table) textout << outconvert << "<table>\n";
     146
     147  /* use table set to true if format string starts with <td> */
     148  if (use_table) {
     149    textout << outconvert << "<table class=\"v_list\">\n";
     150  } else {
     151    textout << outconvert << "<div class=\"v_list\">\n";
     152  }
    140153
    141154  ResultDocInfo_tarray::iterator thissection = sections.docInfo.begin();
     
    143156
    144157  // ** here lies Alan's hack to get 4 results per table row
    145   int item = 0, perline;; // set perline to 1 normally
     158  int item = 0, perline; // set perline to 1 normally
    146159  text_t fstring;
    147160
     
    194207  }
    195208
    196   if (use_table) textout << outconvert << "</table>\n";
     209  if (use_table)
     210    textout << outconvert << "</table>\n";
     211  else
     212    textout << outconvert << "</div>\n";
    197213  if (colnumber > 0) textout << outconvert << "</td></tr></table>\n";
    198214
Note: See TracChangeset for help on using the changeset viewer.