b159fa56513cfc78d000a66cc65ff1a85a2e0c27 braney Tue Sep 5 17:23:40 2017 -0700 ongoing work on hgCollection diff --git src/hg/hgCollection/hgCollection.c src/hg/hgCollection/hgCollection.c index d9ae08b..6732a7a 100644 --- src/hg/hgCollection/hgCollection.c +++ src/hg/hgCollection/hgCollection.c @@ -32,30 +32,31 @@ // Null terminated list of CGI Variables we don't want to save permanently: char *excludeVars[] = {"Submit", "submit", "hgva_startQuery", NULL,}; struct track { struct track *next; struct track *trackList; struct trackDb *tdb; char *name; char *shortLabel; char *longLabel; char *visibility; unsigned long color; +char *viewFunc; }; char *getString(char **input) // grab a quoted string out of text blob { char *ptr = *input; if (*ptr != '"') errAbort("string must start with \""); ptr++; char *ret = ptr; for(; *ptr != '"'; ptr++) ; *ptr = 0; ptr++; @@ -95,53 +96,61 @@ return NULL; } static boolean trackCanBeAdded(struct trackDb *tdb) // are we allowing this track into a custom composite { return (tdb->subtracks == NULL) && !startsWith("wigMaf",tdb->type) && (startsWith("wig",tdb->type) || startsWith("bigWig",tdb->type)) ; } static void printGroup(char *parent, struct trackDb *tdb, boolean folder, boolean user) // output list elements for a group { char *userString = ""; char *prefix = ""; +char *viewFunc = "show all"; if (user) { //prefix = "coll_"; if (tdb->parent && tdb->subtracks) - userString = "viewType='view'"; + { + viewFunc = trackDbSetting(tdb, "viewFunc"); + if (viewFunc == NULL) + viewFunc = "show all"; + userString = "viewType='view' class='folder'"; + } + else if (tdb->subtracks) + userString = "viewType='track' class='folder'"; else userString = "viewType='track'"; } else { //prefix = "coll_"; if (tdb->parent && tdb->subtracks) userString = "class='nodrop' viewType='view'"; else userString = "class='nodrop' viewType='track'"; } //userString = "viewType='track data-jstree='{'icon':'images/folderC.png'}''"; #define IMAKECOLOR_32(r,g,b) ( ((unsigned int)b<<0) | ((unsigned int)g << 8) | ((unsigned int)r << 16)) -jsInlineF("
  • %s", tdb->shortLabel, tdb->longLabel,IMAKECOLOR_32(tdb->colorR,tdb->colorG,tdb->colorB), hStringFromTv(tdb->visibility), prefix, trackHubSkipHubName(tdb->track), userString, tdb->shortLabel ); +jsInlineF("
  • %s", tdb->shortLabel, tdb->longLabel,IMAKECOLOR_32(tdb->colorR,tdb->colorG,tdb->colorB), viewFunc, hStringFromTv(tdb->visibility), prefix, trackHubSkipHubName(tdb->track), userString, tdb->shortLabel ); jsInlineF(" (%s)", tdb->longLabel); if (tdb->subtracks) { struct trackDb *subTdb; jsInlineF(""); } jsInlineF("
  • "); } @@ -229,83 +238,88 @@ boolean vis; if (cartVis != NULL) vis = differentString(cartVis, "hide"); else if (tdbIsSuperTrack(tdb->parent)) vis = tdb->parent->isShow; else vis = tdb->parent->visibility != tvHide; return vis; } void addVisibleTracks() // add the visible tracks table rows { -printf("All VisibleAll the tracks visible in hgTracks\n"); +jsInlineF(""); } void doTable() // output the tree table { char *hubName = hubNameFromUrl(getHubName(database)); struct grp *curGroup; for(curGroup = fullGroupList; curGroup; curGroup = curGroup->next) { if ((hubName != NULL) && sameString(curGroup->name, hubName)) break; } if (curGroup != NULL) { // print out all the tracks in this group struct trackDb *tdb; jsInlineF("$('#currentCollection').append(\""); for(tdb = fullTrackList; tdb; tdb = tdb->next) { if (sameString(tdb->grp, hubName)) { jsInlineF("
    ", trackHubSkipHubName(tdb->track), tdb->shortLabel); jsInlineF("
    "); } } jsInlineF("\");\n"); // print out all the tracks in this group jsInlineF("$('#collectionList').append(\""); for(tdb = fullTrackList; tdb; tdb = tdb->next) { if (sameString(tdb->grp, hubName)) { jsInlineF("
  • %s
  • ", trackHubSkipHubName(tdb->track),trackHubSkipHubName(tdb->track), tdb->shortLabel); //printGroup("collections", tdb, TRUE, TRUE); } } jsInlineF("\");\n"); } -//addVisibleTracks(); jsInlineF("$('#tracks').append(\""); +addVisibleTracks(); for(curGroup = fullGroupList; curGroup; curGroup = curGroup->next) { if ((hubName != NULL) && sameString(curGroup->name, hubName)) continue; jsInlineF("