de917aa7d6017e1f1bc5645b38e66669e9f5bf8a
larrym
Mon Dec 12 09:49:01 2011 -0800
report accurate errors when errors are encountered when navigating in hgTracks (redmine #6229)
diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c
index 5c2bd9c..a91f1d0 100644
--- src/hg/hgTracks/hgTracks.c
+++ src/hg/hgTracks/hgTracks.c
@@ -64,31 +64,31 @@
* Because the browser is a central program, most of it's cart
* variables are not hgt. qualified. It's a good idea if other
* program's unique variables be qualified with a prefix though. */
char *excludeVars[] = { "submit", "Submit", "dirty", "hgt.reset",
"hgt.in1", "hgt.in2", "hgt.in3", "hgt.inBase",
"hgt.out1", "hgt.out2", "hgt.out3",
"hgt.left1", "hgt.left2", "hgt.left3",
"hgt.right1", "hgt.right2", "hgt.right3",
"hgt.dinkLL", "hgt.dinkLR", "hgt.dinkRL", "hgt.dinkRR",
"hgt.tui", "hgt.hideAll", "hgt.visAllFromCt",
"hgt.psOutput", "hideControls", "hgt.toggleRevCmplDisp",
"hgt.collapseGroups", "hgt.expandGroups", "hgt.suggest",
"hgt.jump", "hgt.refresh", "hgt.setWidth",
"hgt.trackImgOnly", "hgt.ideogramToo", "hgt.trackNameFilter", "hgt.imageV1", "hgt.suggestTrack", "hgt.setWidth",
TRACK_SEARCH, TRACK_SEARCH_ADD_ROW, TRACK_SEARCH_DEL_ROW, TRACK_SEARCH_PAGER,
- "hgt.contentType", "hgt.positionInput",
+ "hgt.contentType", "hgt.positionInput", "hgt.internal",
NULL };
// MERGE_GENE_SUGGEST is used for work on redmine #5933
// #define MERGE_GENE_SUGGEST
/* These variables persist from one incarnation of this program to the
* next - living mostly in the cart. */
boolean baseShowPos; /* TRUE if should display full position at top of base track */
boolean baseShowAsm; /* TRUE if should display assembly info at top of base track */
boolean baseShowScaleBar; /* TRUE if should display scale bar at very top of base track */
boolean baseShowRuler; /* TRUE if should display the basic ruler in the base track (default) */
char *baseTitle = NULL; /* Title it should display top of base track (optional)*/
static char *userSeqString = NULL; /* User sequence .fa/.psl file. */
/* These variables are set by getPositionFromCustomTracks() at the very
@@ -4986,31 +4986,31 @@
/* Make line that says position. */
{
char buf[256];
char *survey = cfgOptionEnv("HGDB_SURVEY", "survey");
char *surveyLabel = cfgOptionEnv("HGDB_SURVEY_LABEL", "surveyLabel");
char *javascript = "onchange=\"document.location = '/cgi-bin/hgTracks?db=' + document.TrackForm.db.options[document.TrackForm.db.selectedIndex].value;\"";
if (containsStringNoCase(database, "zoo"))
{
hPuts("Organism ");
printAssemblyListHtmlExtra(database, javascript);
}
sprintf(buf, "%s:%d-%d", chromName, winStart+1, winEnd);
position = cloneString(buf);
#ifdef MERGE_GENE_SUGGEST
- hPrintf("%s", addCommasToPos(database, position));
+ hPrintf("%s", addCommasToPos(database, position));
hPrintf("\n", buf);
sprintLongWithCommas(buf, winEnd - winStart);
hPrintf(" %s bp. ", buf);
hPrintf("\n");
hWrites(" ");
hButtonWithOnClick("hgt.jump", "go", NULL, "imageV2.jumpButtonOnClick()");
jsonHashAddBoolean(jsonForClient, "assemblySupportsGeneSuggest", assemblySupportsGeneSuggest(database));
if(assemblySupportsGeneSuggest(database))
hPrintf("\n", assemblyGeneSuggestTrack(database));
#else
hWrites("position/search ");
hTextVar("position", addCommasToPos(database, position), 30);
sprintLongWithCommas(buf, winEnd - winStart);
if(assemblySupportsGeneSuggest(database))
hPrintf(" gene "
@@ -5909,30 +5909,40 @@
int sessionId = cgiUsualInt(cartSessionVarName(), 0);
char *hguidString = findCookieData(cookieName);
int userId = (hguidString == NULL ? 0 : atoi(hguidString));
struct cart *oldCart = cartNew(userId, sessionId, NULL, NULL);
cartRemoveExcept(oldCart, except);
cartCheckout(&oldCart);
cgiVarExcludeExcept(except);
}
static void addDataHubs(struct cart *cart)
{
hubCheckForNew(database, cart);
cartSetString(cart, hgHubConnectRemakeTrackHub, "on");
}
+void ajaxWarnHandler(char *format, va_list args)
+{
+// When we are generating a response for ajax client and hit an error, put any warnings into hgTracks.err in the response.
+char buf[4096];
+vsnprintf(buf, sizeof(buf), format, args);
+// We don't use jsonForClient for fear that it might now be corrupted.
+printf("\n",
+ javaScriptLiteralEncode(buf));
+}
+
void doMiddle(struct cart *theCart)
/* Print the body of an html file. */
{
char *debugTmp = NULL;
/* Uncomment this to see parameters for debugging. */
/* struct dyString *state = NULL; */
/* Initialize layout and database. */
cart = theCart;
measureTiming = hPrintStatus() && isNotEmpty(cartOptionalString(cart, "measureTiming"));
if (measureTiming)
measureTime("Get cart of %d for user:%u session:%u", theCart->hash->elCount,
theCart->userId, theCart->sessionId);
/* #if 1 this to see parameters for debugging. */
/* Be careful though, it breaks if custom track
@@ -5962,30 +5972,31 @@
initTl();
char *configPageCall = cartCgiUsualString(cart, "hgTracksConfigPage", "notSet");
/* Do main display. */
if (cartUsualBoolean(cart, "hgt.trackImgOnly", FALSE))
{
trackImgOnly = TRUE;
ideogramToo = cartUsualBoolean(cart, "hgt.ideogramToo", FALSE);
hideControls = TRUE;
withNextItemArrows = FALSE;
withNextExonArrows = FALSE;
hgFindMatches = NULL; // XXXX necessary ???
+ pushWarnHandler(ajaxWarnHandler);
}
jsonForClient = newJsonHash(newHash(8));
jsonHashAddString(jsonForClient, "cgiVersion", CGI_VERSION);
boolean searching = differentString(cartUsualString(cart, TRACK_SEARCH,"0"), "0");
if(!trackImgOnly)
{
// Write out includes for css and js files
hWrites(commonCssStyles());
jsIncludeFile("jquery.js", NULL);
jsIncludeFile("jquery-ui.js", NULL);
jsIncludeFile("utils.js", NULL);
jsIncludeFile("ajax.js", NULL);
#ifdef MERGE_GENE_SUGGEST