8ccceea1c52492b6a869af8de3190a387d4b6550 braney Tue Mar 12 13:41:09 2024 -0700 added exportedDataHubs dialog and code to deal with quickLifted hubs diff --git src/hg/hgTracks/exportedDataHubs.c src/hg/hgTracks/exportedDataHubs.c new file mode 100644 index 0000000..c636229 --- /dev/null +++ src/hg/hgTracks/exportedDataHubs.c @@ -0,0 +1,52 @@ + +// Code to parse list of exported data track hubs from table and print as browser dialog +// for client dialog (js) +// +/* Copyright (C) 2024 The Regents of the University of California + * See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */ + +#include "common.h" +#include "dystring.h" +#include "hCommon.h" +#include "hgConfig.h" +#include "htmshell.h" +#include "hash.h" +#include "web.h" +#include "ra.h" +#include "hgTracks.h" +#include "hgFind.h" +#include "obscure.h" +#include "net.h" +#include "hubConnect.h" +#include "trackHub.h" +#include "exportedDataHubs.h" + +boolean exportedDataHubsEnabled() +/* Return TRUE if feature is available */ +{ +char *cfgEnabled = cfgOption("browser.exportedDataHubs"); +return cfgEnabled && (sameString(cfgEnabled, "on") || sameString(cfgEnabled, "true")) ; +} + +void printExportedDataHubs(char *db) +/* Fill out exported data hubs popup. */ +{ +if (!exportedDataHubsEnabled()) + return; + +hPrintf("<div style='display:none;' id='exportedDataHubsPopup' title='Exported Data Hubs'>\n"); +struct sqlConnection *conn = hConnectCentral(); +char **row; +char query[2048]; +sqlSafef(query, sizeof(query), "select x.id,q.id,x.db,x.label,x.description,x.path,q.path from quickLiftChain q,exportedDataHubs x where q.fromDb=x.db and q.toDb='%s'", trackHubSkipHubName(db)); + +hPrintf("<table style=\"border: 1px solid black\">\n"); +struct sqlResult *sr; +sr = sqlGetResult(conn, query); +while ((row = sqlNextRow(sr)) != NULL) + { + hPrintf("<tr><td>%s</td><td><A HREF=\"./hgTracks?quickLift.%s.%s=%s&%s=on&hgsid=%s\">%s</A></td><td>%s</td></tr>",row[2], row[0],trackHubSkipHubName(db), row[1], hgHubConnectRemakeTrackHub,cartSessionId(cart), row[3],row[4]); + } +hPrintf("</table>\n"); +hDisconnectCentral(&conn); +}