f1d16c8dda5212308a33fa1642a07b7e8c28b047 max Thu Mar 30 07:57:27 2023 -0700 adding downloadUrl trackDb statement, no docs yet, refs #30904 diff --git src/hg/lib/hui.c src/hg/lib/hui.c index 5c2c4f2..9266dc6 100644 --- src/hg/lib/hui.c +++ src/hg/lib/hui.c @@ -529,30 +529,42 @@ "%s=%s&" "%s=%s&" "%s=%s'>" "Display regions of interest (%d)", MULTI_REGION_BED_WIN_FULL, tdb->track, cgiEncode(regionFile), tdb->track, hStringFromTv(vis), CT_CUSTOM_DOC_TEXT_VAR, cgiEncode(customHtml), CT_CUSTOM_TEXT_VAR, cgiEncode(dyStringCannibalize(&dsCustomText)), regionCount); printf(" in multi-region view (custom regions mode)"); printf(" "); printf("(Help)\n"); printf("
"); return TRUE; } +static void makeFileDownloads(char *fileDownloads) +/* print an additional file download link, file can be anywhere on the internet, useful e.g. for GTF files for gene tracks */ +{ +char *parts[2]; +int partCount = chopByWhite(fileDownloads, parts, 2); +if (partCount!=2) + puts("Internal Error: The downloadUrl trackDb statement needs exactly two arguments, the file type and the URL."); +char* fileType = parts[0]; +char* url = parts[1]; +printf("View table: "); if (schemaLink && differentString("longTabix", tdb->type) && !isCustomComposite(tdb)) // FIXME: hgTables.showSchmaLongTabix is a currently a dummy routine, so let's not got here // until it's implemented { makeSchemaLink(db,tdb,(links > 1 ? "Data format":"Data schema/format description and download")); if (downloadLink) printf(", "); } + +char *fileDownloads = trackDbSetting(tdb, "downloadUrl"); +if (fileDownloads) + makeFileDownloads(fileDownloads); + if (downloadLink) { // special case exception (hg18:NHGRI BiPs are in 7 different dbs but only hg18 has downloads): char *targetDb = trackDbSetting(tdb, "compareGenomeLinks"); if (targetDb != NULL) { targetDb = cloneFirstWordByDelimiter(targetDb,'='); if (!startsWith("hg",targetDb)) freez(&targetDb); } if (targetDb == NULL) targetDb = cloneString(db); makeNamedDownloadsLink(targetDb, tdb, (links > 1 ? "downloads":"Downloads")); freez(&targetDb); |