8715d83d38d8bb18adfdd9ce05771b4cede85407
angie
  Fri Dec 5 09:52:07 2014 -0800
Moved some hgTables code that had been copied into a couple differentplaces into a new lib module, cartTrackDb.  hgGenome/import.c has code
that is fairly similar but that also needs to filter out custom tracks
that were generated by hgGenome.

diff --git src/hg/hgTables/hgTables.h src/hg/hgTables/hgTables.h
index 03de2f1..914a36b 100644
--- src/hg/hgTables/hgTables.h
+++ src/hg/hgTables/hgTables.h
@@ -24,33 +24,31 @@
     struct region *next;
     char *chrom;		/* Chromosome. */
     int start;			/* Zero-based. */
     int end;			/* Non-inclusive. */
     boolean fullChrom;		/* If TRUE it's full chromosome. */
     char *name;			/* possibly the encode region name */
     };
 
 /* Global variables - generally set during initialization and then read-only. */
 extern struct cart *cart;	/* This holds cgi and other variables between clicks. */
 extern struct hash *oldVars;	/* The cart before new cgi stuff added. */
 extern char *genome;		/* Name of genome - mouse, human, etc. */
 extern char *database;		/* Current database, often but not always dbDatabase. */
 extern char *freezeName;	/* Date of assembly. */
 extern struct trackDb *fullTrackList;	/* List of all tracks in database. */
-extern struct hash *fullTrackHash;     /* Hash of tracks in fullTrackList keyed by ->track field. */
 extern struct hash *fullTableToTdbHash;        /* All tracks and subtracks keyed by ->table field. */
-extern struct trackDb *forbiddenTrackList; /* List of tracks with 'tableBrowser off' setting. */
 extern struct trackDb *curTrack;	/* Currently selected track. */
 extern struct grp *fullGroupList;	/* List of all groups. */
 extern struct grp *curGroup;	/* Currently selected group. */
 extern struct customTrack *theCtList;	/* List of custom tracks. */
 extern char *curTable;	/* Current selected table. */
 struct joiner *allJoiner;	/* Info on how to join tables. */
 
 #define GALAXY_URL_BASE "https://usegalaxy.org"
 #define GALAXY_URL_APP GALAXY_URL_BASE "/tool_runner"
 
 /* --------------- HTML Helpers ----------------- */
 
 void hPrintSpaces(int count);
 /* Print a number of non-breaking spaces. */
 
@@ -135,33 +133,30 @@
 /* Return TRUE if region is full genome. */
 
 struct sqlResult *regionQuery(struct sqlConnection *conn, char *table,
 	char *fields, struct region *region, boolean isPositional,
 	char *extraWhere);
 /* Construct and execute query for table on region. */
 
 void dbOverrideFromTable(char buf[256], char **pDb, char **pTable);
 /* If *pTable includes database, overrider *pDb with it, using
  * buf to hold string. */
 
 struct grp *findSelectedGroup(struct grp *groupList, char *cgiVar);
 /* Find user-selected group if possible.  If not then
  * go to various levels of defaults. */
 
-struct slName *tablesForTrack(struct trackDb *track, boolean useJoiner);
-/* Return list of all tables associated with track. */
-
 struct trackDb *findSelectedTrack(struct trackDb *trackList,
 	struct grp *group, char *varName);
 /* Find selected track - from CGI variable if possible, else
  * via various defaults. */
 
 struct trackDb *findTrack(char *name, struct trackDb *trackList);
 /* Find track, or return NULL if can't find it. */
 
 struct trackDb *mustFindTrack(char *name, struct trackDb *trackList);
 /* Find track or squawk and die. */
 
 struct asObject *asForTable(struct sqlConnection *conn, char *table);
 /* Get autoSQL description if any associated with table. */
 
 struct sqlFieldType *sqlFieldTypesFromAs(struct asObject *as);
@@ -279,34 +274,30 @@
     };
 
 struct sqlFieldType *sqlFieldTypeNew(char *name, char *type);
 /* Create a new sqlFieldType */
 
 void sqlFieldTypeFree(struct sqlFieldType **pFt);
 /* Free resources used by sqlFieldType */
 
 void sqlFieldTypeFreeList(struct sqlFieldType **pList);
 /* Free a list of dynamically allocated sqlFieldType's */
 
 struct sqlFieldType *sqlListFieldsAndTypes(struct sqlConnection *conn, char *table);
 /* Get list of fields including their names and types.  The type currently is just
  * a MySQL type string. */
 
-boolean accessControlDenied(char *db, char *table);
-/* Return TRUE if table access is restricted to some host(s) other than
- * the one we're running on. */
-
 /* ------------- Functions related to joining and filtering ------------*/
 void tabOutSelectedFields(
 	char *primaryDb,		/* The primary database. */
 	char *primaryTable, 		/* The primary table. */
 	FILE *f,                        /* file for output, null for stdout */
 	struct slName *fieldList);	/* List of db.table.field */
 /* Do tab-separated output on selected fields, which may
  * or may not include multiple tables. */
 
 boolean anyFilter();
 /* Return TRUE if any filter set. */
 
 struct joinerDtf *filteringTables();
 /* Get list of tables we're filtering on as joinerDtf list (with
  * the field entry NULL). */
@@ -562,34 +553,30 @@
 #define outSchema "schema"
 #define outSummaryStats "stats"
 #define outBed "bed"
 #define outGff "gff"
 #define outCustomTrack "customTrack"
 #define outHyperlinks "hyperlinks"
 #define outWigData "wigData"
 #define outWigBed "wigBed"
 #define outChromGraphData "chromGraphData"
 #define outMicroarrayNames "microarrayNames"
 #define outMicroarrayGroupings "microarrayGroupings"
 #define outGalaxy "galaxyQuery"
 #define outMaf "maf"
 #define outPalOptions "fasta"
 
-/* --------- configuration options ------------ */
-boolean allowAllTables(void);
-/* determine if all tables should is allowed by configuration */
-
 /* --------- Identifier list handling stuff. ------------ */
 
 char *identifierFileName();
 /* File name identifiers are in, or NULL if no such file. */
 
 struct hash *identifierHash(char *db, char *table);
 /* Return hash full of identifiers from the given table (or NULL). */
 
 char *getIdField(char *db, struct trackDb *track, char *table,
 	struct hTableInfo *hti);
 /* Get ID field for table, or NULL if none.  FreeMem result when done */
 
 char *identifierWhereClause(char *idField, struct hash *idHash);
 /* If the number of pasted IDs is reasonably low, return a where-clause component for the IDs. */
 
@@ -1148,33 +1135,30 @@
 void doGsLogin(struct sqlConnection *conn);
 /* Process user password post. */
 
 void gsSendToDM();
 /* upload the generated file to DM */
 
 void getBackgroundStatus(char *url);
 /* fetch status as the latest complete html block available */
 
 void startBackgroundWork(char *exec, char **pWorkUrl);
 /* deal with forking off child for background work
  * and setting up the trash file for communicating
  * from the child to the browser */
 
 /* --------------- wikiTrack functions --------------- */
-void wikiTrackDb(struct trackDb **list);
-/* create a trackDb entry for the wiki track */
-
 struct hTableInfo *wikiHti();
 /* Create an hTableInfo for the wikiTrack. */
 
 void doSummaryStatsWikiTrack(struct sqlConnection *conn);
 /* Put up page showing summary stats for wikiTrack. */
 
 struct bed *wikiTrackGetFilteredBeds(char *name, struct region *regionList,
 	struct lm *lm, int *retFieldCount);
 /* Get list of beds from the wikiTrack * in current regions and that pass
  *	filters.  You can bedFree this when done.  */
 
 /* --------------- microarray track functions ------------- */
 
 boolean isMicroarray(struct trackDb *parent, char *table);
 /* Return TRUE if table is specified as a microarray in the current database's