8a2b7b1c998ceef02e8e9ec4da1353a4ba6c716b max Thu Jan 19 14:09:09 2012 -0800 crazy workaround for firefox bug not breaking long words in tables, rachel feedback diff --git src/hg/hgc/t2g.c src/hg/hgc/t2g.c index 7c77b04..4ba0e21 100644 --- src/hg/hgc/t2g.c +++ src/hg/hgc/t2g.c @@ -76,34 +76,54 @@ freeMem(seqIdCoordString); return seqIdHash; } void printSeqHeaders(bool showDesc, bool isClickedSection) { printf("\n", HG_COL_BORDER); printf("\n", HG_COL_TABLE_LABEL); if (showDesc) puts(" \n"); puts(" \n"); if (t2gDebug) puts(" \n"); if (!isClickedSection && !t2gDebug) - puts(" \n"); + puts(" \n"); puts("\n"); } +void printAddWbr(char* text, int distance) +/* a crazy hack for firefox/mozilla that is unable to break long words in tables + * We need to add a tag every x characters in the text to make text breakable. + */ +{ +int i; +i = 0; +char* c; +c = text; +while (*c!=0){ + { + if (i % distance == 0) + printf(""); + printf("%c", *c); + c++; + i++; + } +} +} + bool printSeqSection(char* docId, char* title, bool showDesc, struct sqlConnection* conn, struct hash* clickedSeqs, bool isClickedSection, bool fasta) /* print a table of sequences, show only sequences with IDs in hash, * There are two sections, respective sequences are shown depending on isClickedSection and clickedSeqs * - seqs that were clicked on (isClickedSection=True) -> show only seqs in clickedSeqs * - other seqs (isClickedSection=False) -> show all other seqs * * */ { // get data from mysql char query[4096]; safef(query, sizeof(query), "SELECT fileDesc, snippet, locations, articleId,fileId, seqId, sequence FROM %s WHERE articleId='%s';", sequenceTable, docId); if (t2gDebug) puts(query); struct sqlResult *sr = sqlGetResult(conn, query); @@ -140,31 +160,33 @@ if (clickedSeqs!=NULL && ((hashLookup(clickedSeqs, annotId)!=0) != isClickedSection)) { foundSkippedRows = TRUE; continue; } if (fasta) { printf(">%s
%s
", annotId, seq); } else { printf("\n", HG_COL_LOCAL_TABLE); if (showDesc) printf("\n", snippet); - printf("\n", snippet); + printf("\n"); if (t2gDebug) { printf("
Article fileOne table row per sequence, with flanking text, sequence in boldIdentifiersMatchesFeature that includes this match
%s\n", fileDesc); //printf("%s%s"); + printAddWbr(snippet, 40); + printf("article %s, file %s, seq %s, annotId %s", artId, fileId, seqId, annotId); } // print links to locations if (!isClickedSection && !t2gDebug) { struct slName *locs; // format: hg19/chr1:300-400,mm9/chr1:60006-23234 // split on "," then split on "/" locs = charSepToSlNames(locList, ','); printf(""); if (locs==NULL) printf("No matches"); for ( ; locs!=NULL; locs = locs->next)