9e45ac752c5cf71c74e6e874fee99e21b272f768 chmalee Wed Dec 2 09:41:24 2020 -0800 Fixing spurious cartDump empty hgsid messages generated by expanding/collapsing tables on hgc, refs #26619 diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c index de5d206..4fea33b 100644 --- src/hg/hgc/hgc.c +++ src/hg/hgc/hgc.c @@ -814,30 +814,42 @@ if (bedSize >= 6) { strand = bed->strand; } printPos(bed->chrom, bed->chromStart, bed->chromEnd, strand, TRUE, bed->name); } void genericHeader(struct trackDb *tdb, char *item) /* Put up generic track info. */ { if (item != NULL && item[0] != 0) cartWebStart(cart, database, "%s (%s)", tdb->longLabel, item); else cartWebStart(cart, database, "%s", tdb->longLabel); + +// QA noticed that clicking the +- buttons to collapse item detail tables was +// generating messages in the Apache log if you went directly to an item page +// without first visiting hgTracks. Clicking those buttons causes a cartDump +// in order to save the state of visibility of the table, which in +// turn needs an hgsid in order to save the state correctly. However, because +// we aren't in a form, we have never saved the hgsid to a hidden +// input element, and so the javascript that creates the cartDump link attaches +// an empty 'hgsid=' parameter, which cartDump doesn't like. Since we aren't in +// a form, use the 'common' object to store the parameter so the links to cartDump +// are correct: +jsInlineF("var common = {hgsid:\"%s\"};\n", cartSessionId(cart)); } void printItemDetailsHtml(struct trackDb *tdb, char *itemName) /* if track has an itemDetailsHtml, retrieve and print the HTML */ { char *tableName = trackDbSetting(tdb, "itemDetailsHtmlTable"); if (tableName != NULL) { struct sqlConnection *conn = hAllocConn(database); struct itemDetailsHtml *html, *htmls; // if the details table has chrom/start/end columns, then use these to lookup html if (sqlColumnExists(conn, tableName, "chrom")) { char *chrom = cgiString("c"); int start = cgiInt("o");