Changeset 2684


Ignore:
Timestamp:
2001-08-02T12:13:43+12:00 (23 years ago)
Author:
jrm21
Message:

attempt to gracefully add rows to the table if the text content of the HList
is too long.

File:
1 edited

Legend:

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

    r1610 r2684  
    118118
    119119  text_t icon, link;
     120  int num_chars=0; // see note below - jrm21
    120121  while (tsibling != esibling) {
    121122
    122123    bool highlight = false;
    123     textout << "<td>";
    124124    text_t &doctype = (*tsibling).metadata["doctype"].values[0];
    125125
     
    135135    }
    136136
    137     textout << outconvert << disp
    138         << get_formatted_string (collection, collectproto,
    139                      *tsibling, disp, formatlistptr, link, icon, highlight,
    140                      logout);
     137    text_t fmt_str=get_formatted_string (collection, collectproto,
     138                      *tsibling, disp, formatlistptr,
     139                      link, icon, highlight, logout);
    141140
    142     textout << "</td>\n";
     141    /* this is awful. Someone please come up with a better way to prevent
     142       the table of contents when browsing metadata from becoming too wide.
     143       This is an attempt to add new rows when the number of characters in
     144       the current row becomes too high. It doesn't know about macros in the
     145       string, though... -- jrm21 */
     146
     147    char *tmp_str=fmt_str.getcstr();
     148    char *end_str=tmp_str+strlen(tmp_str);
     149    while (tmp_str<end_str) {
     150      if (*tmp_str=='<') {    // for html tags
     151    while (*tmp_str!='>') tmp_str++;
     152      } else if (*tmp_str=='&') { // for html entities
     153    while (*tmp_str!=';') tmp_str++;
     154    num_chars++;
     155      } else num_chars++;
     156      tmp_str++;
     157    }
     158
     159    if (num_chars>100) { // this is fairly arbitrary...
     160      textout << "</tr>\n<tr>";
     161      num_chars=0;
     162    }
     163
     164    textout << "<td>" << outconvert << disp << fmt_str << "</td>\n";
    143165    tsibling ++;
    144166  }
Note: See TracChangeset for help on using the changeset viewer.