a5b512a7a022c72d644b843b88f8d0e6c990a5cf braney Fri Aug 11 14:49:58 2017 -0700 move to jstree, first pass at Cath's spec diff --git src/hg/hgCollection/hgCollection.c src/hg/hgCollection/hgCollection.c index 30e02ba..63992af 100644 --- src/hg/hgCollection/hgCollection.c +++ src/hg/hgCollection/hgCollection.c @@ -91,57 +91,60 @@ hashStore(nameHash, buffer); return cloneString(buffer); } } 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 the table rows for a group +// output list elements for a group { char *userString = ""; char *prefix = ""; -if (user) +//if (user) { - prefix = "coll_"; + //prefix = "coll_"; if (tdb->parent && tdb->subtracks) - userString = "class='user view'"; + userString = "viewType='view'"; else - userString = "class='user'"; + userString = "viewType='track'"; } #define IMAKECOLOR_32(r,g,b) ( ((unsigned int)b<<0) | ((unsigned int)g << 8) | ((unsigned int)r << 16)) -jsInlineF("%s", IMAKECOLOR_32(tdb->colorR,tdb->colorG,tdb->colorB), hStringFromTv(tdb->visibility), prefix, parent,prefix, trackHubSkipHubName(tdb->track), userString, folder ? "folder" : "file", tdb->shortLabel ); -jsInlineF("%s", tdb->longLabel); +jsInlineF("
  • %s", tdb->shortLabel, tdb->longLabel,IMAKECOLOR_32(tdb->colorR,tdb->colorG,tdb->colorB), hStringFromTv(tdb->visibility), prefix, trackHubSkipHubName(tdb->track), userString, folder ? "folder" : "file", tdb->shortLabel ); +jsInlineF("%s", tdb->longLabel); if (tdb->subtracks) { struct trackDb *subTdb; + jsInlineF(""); } +jsInlineF("
  • "); } static void outHubHeader(FILE *f, char *db, char *hubName) // output a track hub header { char *hubFile = strrchr(hubName, '/') + 1; fprintf(f,"hub hub1\n\ shortLabel User Composite\n\ longLabel User Composite\n\ genomesFile %s\n\ email braney@soe.ucsc.edu\n\ descriptionUrl hub.html\n\n", hubFile); fprintf(f,"genome %s\n\ trackDb %s\n\n", db, hubFile); @@ -216,76 +219,84 @@ 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"); +printf("All VisibleAll the tracks visible in hgTracks\n"); struct trackDb *tdb; for(tdb = fullTrackList; tdb; tdb = tdb->next) { if (isParentVisible(tdb) && isSubtrackVisible(tdb)) { printGroup("visible", tdb, FALSE, FALSE); } } } void doTable() // output the tree table { char *hubName = hubNameFromUrl(getHubName(database)); -jsInlineF("$('#tracks tr:last').after(\""); +jsInlineF("$('#tracks').append(\""); 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(""); } //addVisibleTracks(); for(curGroup = fullGroupList; curGroup; curGroup = curGroup->next) { if ((hubName != NULL) && sameString(curGroup->name, hubName)) continue; - jsInlineF("%s", curGroup->name, curGroup->label ); + jsInlineF(""); + } jsInlineF("\");\n"); jsInlineF("collections.init();\n"); } static void onclickJumpToTop(char *id) /* CSP-safe click handler arrows that cause scroll to top */ { jsOnEventById("click", id, "$('html,body').scrollTop(0);"); } static void printHelp() // print out the help page { puts( @@ -312,45 +323,44 @@ puts(""); webIncludeHelpFileSubst("hgCompositeHelp", NULL, FALSE); puts("
    "); puts("
    "); puts( " \n" " \n"); } void doMainPage() /* Print out initial HTML of control page. */ { webStartGbNoBanner(cart, database, "Collections"); -webIncludeResourceFile("jquery.treetable.css"); -webIncludeResourceFile("jquery.treetable.theme.default.css"); webIncludeResourceFile("gb.css"); -//webIncludeResourceFile("jWest.css"); webIncludeResourceFile("spectrum.min.css"); webIncludeResourceFile("hgGtexTrackSettings.css"); webIncludeFile("inc/hgCollection.html"); printHelp(); doTable(); -puts(""); +puts(""); +puts(""); +//puts(""); puts(""); -jsIncludeFile("jquery.treetable.js", NULL); +puts("\n"); jsIncludeFile("utils.js", NULL); jsIncludeFile("ajax.js", NULL); jsIncludeFile("spectrum.min.js", NULL); jsIncludeFile("hgCollection.js", NULL); webEndGb(); } static char *getSqlBigWig(struct sqlConnection *conn, char *db, struct trackDb *tdb) // figure out the bigWig for native tables { char buffer[4096]; safef(buffer, sizeof buffer, "NOSQLINJ select fileName from %s", tdb->table); return sqlQuickString(conn, buffer); } @@ -502,31 +512,31 @@ } static unsigned long hexStringToLong(char *str) { /* char buffer[1024]; strcpy(buffer, "0x"); strcat(buffer, &str[1]); */ return strtol(&str[1], NULL, 16); } static struct track *parseJson(char *jsonText) -// parse the JSON of the treetable from the Javascript +// parse the JSON returned from the ap { struct hash *trackHash = newHash(5); struct track *collectionList = NULL; struct track *track; char *ptr = jsonText; if (*ptr != '[') errAbort("element didn't start with ["); ptr++; do { if (*ptr != '[') errAbort("element didn't start with ["); ptr++;