700758c7e3fabc5cd1f925d8da37c5ee4bee3bd0 max Sat Mar 17 13:56:32 2012 -0700 fixed wbr bug and added pmid output redmine #6833 diff --git src/hg/hgc/pubs.c src/hg/hgc/pubs.c index c731e05..a722cbc 100644 --- src/hg/hgc/pubs.c +++ src/hg/hgc/pubs.c @@ -174,46 +174,52 @@ if (pubsDebug) printf("articleId=%s", articleId); printf("<I>%s</I><P>", snippets); printf("<HR>"); } freeMem(sectionList); sqlFreeResult(&sr); } static char* printArticleInfo(struct sqlConnection *conn, char* item) /* Header with information about paper, return documentId */ { char query[512]; - safef(query, sizeof(query), "SELECT articleId, url, title, authors, citation, abstract FROM %s WHERE displayId='%s'", pubsArticleTable, item); + safef(query, sizeof(query), "SELECT articleId, url, title, authors, citation, abstract, pmid FROM %s WHERE displayId='%s'", pubsArticleTable, item); struct sqlResult *sr = sqlGetResult(conn, query); char **row; char *articleId=NULL; if ((row = sqlNextRow(sr)) != NULL) { + char* cit = row[4]; char* abstract = row[5]; + char* pmid = row[6]; + if (strlen(abstract)==0) { abstract = "(No abstract found for this article. Please use the link to the fulltext above.)"; } articleId = cloneString(row[0]); printf("<P>%s</P>\n", row[3]); printf("<A TARGET=\"_blank\" HREF=\"%s\"><B>%s</B></A>\n", row[1], row[2]); - printf("<P style=\"width:800px; font-size:80%%\">%s</P>\n", row[4]); + printf("<P style=\"width:800px; font-size:80%%\">%s", cit); + if (nullIfAllSpace(pmid)!=NULL) + printf(", <A HREF=\"http://www.ncbi.nlm.nih.gov/pubmed/%s\">PMID%s</A>\n", pmid, pmid); + printf("</P>\n"); printf("<P style=\"width:800px; font-size:100%%\">%s</P>\n", abstract); } sqlFreeResult(&sr); return articleId; } static struct hash* getSeqIdHash(struct sqlConnection* conn, char* trackTable, \ char* articleId, char *item, char* seqName, int start) /* return a hash with the sequence IDs for a given chain of BLAT matches */ { char query[512]; /* check first if the column exists (some debugging tables on hgwdev don't have seqIds) */ safef(query, sizeof(query), "SHOW COLUMNS FROM %s LIKE 'seqIds';", trackTable); char* seqIdPresent = sqlQuickString(conn, query); if (!seqIdPresent) { @@ -263,33 +269,39 @@ if (!isClickedSection && !pubsDebug) puts(" <TH style=\"width: 20%\">Feature that includes this match</TH>\n"); puts("</TR>\n"); } static 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 <wbr> tag every x characters in the text to make text breakable. */ { int i; i = 0; char* c; c = text; +bool doNotBreak = FALSE; while (*c != 0){ { - if (i % distance == 0) + if (*c=='&') + doNotBreak = TRUE; + if (*c==';') + doNotBreak = FALSE; + + if (i % distance == 0 && ! doNotBreak) printf("<wbr>"); printf("%c", *c); c++; i++; } } } static bool printSeqSection(char* articleId, 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 * * */