a3fe2462440781ba92b9fb1ef95bec0359028325 angie Mon Jul 20 09:28:59 2015 -0700 Adding Data Integrator to list of destinations from the Manage Custom Tracks page. Since there are now 4 destinations, instead of having one button for each, use a menu to select the destination and a single 'go' button. Align the 'add custom tracks' button with the new menu. refs #15517 diff --git src/hg/hgCustom/hgCustom.c src/hg/hgCustom/hgCustom.c index f56033c..f9afdcd 100644 --- src/hg/hgCustom/hgCustom.c +++ src/hg/hgCustom/hgCustom.c @@ -630,30 +630,63 @@ /* Get list of assemblies with custom tracks */ struct hashEl *hels = cartFindPrefix(cart, CT_FILE_VAR_PREFIX); struct hashEl *hel = NULL; for (hel = hels; hel != NULL; hel = hel->next) { /* TODO: chop actual prefix */ db = chopPrefixAt(cloneString(hel->name), '_'); /* TODO: check if file exists, if not remove ctfile_ var */ dbDb = hDbDb(db); if (dbDb) slAddTail(&dbList, dbDb); } return dbList; } +static struct slPair *makeOtherCgiValsAndLabels() +/* Return {value, label} pairs with other CGIs the user might wish to jump to. */ +{ +struct slPair *valsAndLabels = slPairNew(hgTracksName(), "Genome Browser"); +slAddHead(&valsAndLabels, slPairNew(hgTablesName(), "Table Browser")); +slAddHead(&valsAndLabels, slPairNew(hgVaiName(), "Variant Annotation Integrator")); +slAddHead(&valsAndLabels, slPairNew(hgIntegratorName(), "Data Integrator")); +slReverse(&valsAndLabels); +return valsAndLabels; +} + +static void makeOtherCgiForm(char *pos) +/* Make a form for navigating to other CGIs. */ +{ +struct slPair *valsAndLabels = makeOtherCgiValsAndLabels(); +// Default to the first CGI in the menu. +char *defaultCgi = valsAndLabels->name; +printf("
\n", defaultCgi); +cartSaveSession(cart); +if (pos) + cgiMakeHiddenVar("position", pos); +printf("view in "); +// Construct a menu of destination CGIs +#define hgCtNavDest "hgct_navDest" +char *selected = cartUsualString(cart, hgCtNavDest, defaultCgi); +char *extraHtml = "id=\"navSelect\" " + "onChange=\"var newVal = $('#navSelect').val(); $('#navForm').attr('action', newVal);\""; +puts(cgiMakeSingleSelectDropList(hgCtNavDest, valsAndLabels, selected, NULL, NULL, extraHtml)); +cgiMakeButton("submit", "go"); +puts("
"); +} + static void manageCustomForm(char *warn) /* list custom tracks and display checkboxes so user can select for delete */ { struct dbDb *dbList = getCustomTrackDatabases(); struct dbDb *dbDb = NULL; /* add this database to the list, as it may have no custom * tracks, but we still want to see it in the menu */ slAddTail(&dbList, hDbDb(database)); slReverse(&dbList); /* remove duplicate entry for this database, if any */ for (dbDb = dbList->next; dbDb != NULL; dbDb = dbDb->next) if (sameString(dbDb->name, database)) slRemoveEl(&dbList, dbDb); @@ -714,88 +747,80 @@ /* count up number of custom tracks for this genome */ int numCts = slCount(ctList); cgiSimpleTableStart(); cgiSimpleTableRowStart(); if (numCts) { puts(""); showCustomTrackList(ctList, numCts); } else puts("No custom tracks for this genome:  "); puts(""); -/* navigation buttons */ -puts(""); -puts(""); +/* end mainForm; navigation menu has its own form. */ -/* button to add custom tracks */ -int buttonWidth = 18; -puts(""); puts(""); +puts(""); cgiTableRowEnd(); cgiTableEnd(); + + +// This vertically aligns the 'add tracks' button with the other-CGI select +puts(""); + cartSetString(cart, "hgta_group", "user"); } void helpCustom() /* display documentation */ { webNewSection("Loading Custom Tracks"); char *browserVersion; if (btIE == cgiClientBrowser(&browserVersion, NULL, NULL) && *browserVersion < '8') puts(""); else puts(""); webIncludeHelpFile("customTrackLoad", FALSE); puts("");
"); -printf("", - hgCtDoAdd, "add custom tracks", buttonWidth); -puts("
"); +puts(""); + /* determine if there's a navigation position for this screen */ char *pos = NULL; if (ctList) { pos = ctInitialPosition(ctList); if (!pos) pos = ctFirstItemPos(ctList); } -/* button for GB navigation */ -puts(""); - -/* button for TB navigation */ puts(""); -/* button for VAI navigation */ +/* button to add custom tracks */ puts(""); puts("
"); -printf("
\n", - hgTracksName()); -cartSaveSession(cart); -printf("", - "go to genome browser", buttonWidth); -if (pos) - cgiMakeHiddenVar("position", pos); -puts("
"); -puts("
"); -printf("
\n", - hgTablesName()); -cartSaveSession(cart); -printf("", - "go to table browser", buttonWidth); -puts("
"); +makeOtherCgiForm(pos); puts("
"); -printf("
\n", - hgVaiName()); -cartSaveSession(cart); -printf("", - "go to variant annotation integrator", buttonWidth); -puts("
"); +printf("\n", + "add custom tracks", hgCtDoAdd); puts("
"); puts("