e2467a639cc1e98174ffbd9d0da399b3b75bc9ae markd Thu Jul 26 21:33:38 2012 -0700 highlighting by attribute functionality for GENCODE diff --git src/hg/inc/hui.h src/hg/inc/hui.h index 5e5bd1b..53fdef6 100644 --- src/hg/inc/hui.h +++ src/hg/inc/hui.h @@ -1150,55 +1150,65 @@ struct _sortableTdbItem *next; struct trackDb *tdb; // a contained item is actually a tdb entry sortColumn *columns; // a link list of values to sort on } sortableTdbItem; sortableTdbItem *sortableTdbItemCreate(struct trackDb *tdbChild,sortOrder_t *sortOrder); // creates a sortable tdb item struct, given a child tdb and its parents sort table void sortTdbItemsAndUpdatePriorities(sortableTdbItem **items); // sort tdb items in list and then update priorities of item tdbs void sortableTdbItemsFree(sortableTdbItem **items); // Frees all memory associated with a list of sortable tdb items #define FILTER_BY "filterBy" +#define HIGHLIGHT_BY "highlightBy" typedef struct _filterBy // A single filterBy set (from trackDb.ra filterBy column:Title=value,value // [column:Title=value|label,value|label,value|label]) { struct _filterBy *next; // SL list char*column; // field that will be filtered on char*title; // Title that User sees char*htmlName; // Name used in HTML/CGI boolean useIndex; // The returned values should be indexes boolean valueAndLabel; // If values list is value|label, then label is shown to the user boolean styleFollows; // style settings can follow like: // value|label{background-color:#660000} struct slName *slValues; // Values that can be filtered on (All is always implied) struct slName *slChoices; // Values that have been chosen } filterBy_t; filterBy_t *filterBySetGet(struct trackDb *tdb, struct cart *cart, char *name); // Gets one or more "filterBy" settings (ClosestToHome). returns NULL if not found +filterBy_t *highlightBySetGet(struct trackDb *tdb, struct cart *cart, char *name); +/* Gets one or more "highlightBy" settings (ClosestToHome). returns NULL if not found */ + void filterBySetFree(filterBy_t **filterBySet); // Free a set of filterBy structs char *filterBySetClause(filterBy_t *filterBySet); // returns the "column1 in (...) and column2 in (...)" clause for a set of filterBy structs +INLINE boolean filterByAllChosen(filterBy_t *filterBy) +/* Is "All" chosen in the filter list? */ +{ +return ((filterBy->slChoices == NULL) || (slNameInList(filterBy->slChoices,"All"))); +} + void filterBySetCfgUi(struct cart *cart, struct trackDb *tdb, filterBy_t *filterBySet, boolean onOneLine); // Does the UI for a list of filterBy structure char *filterByClause(filterBy_t *filterBy); // returns the SQL where clause for a single filterBy struct: "column in (...)" struct dyString *dyAddFilterByClause(struct cart *cart, struct trackDb *tdb, struct dyString *extraWhere,char *column, boolean *and); // creates the where clause condition to support a filterBy setting. // Format: filterBy column:Title=value,value [column:Title=value|label,value|label,value|label]) // filterBy filters are multiselect's so could have multiple values selected. // thus returns the "column1 in (...) and column2 in (...)" clause. // if 'column' is provided, and there are multiple filterBy columns, // only the named column's clause is returned.