023b6afdcfa6fe445856a5645cccac8113a4689e braney Thu Aug 3 12:50:53 2017 -0700 put all HTML in a separate include file diff --git src/hg/hgCollection/hgCollection.c src/hg/hgCollection/hgCollection.c index bc69c30..e468916 100644 --- src/hg/hgCollection/hgCollection.c +++ src/hg/hgCollection/hgCollection.c @@ -100,32 +100,32 @@ static void printGroup(char *parent, struct trackDb *tdb, boolean folder, boolean user) // output the table rows for a group { char *userString = ""; if (user) { if (tdb->parent && tdb->subtracks) userString = "class='user view'"; else userString = "class='user'"; } -printf("%s", parent, trackHubSkipHubName(tdb->track), userString, folder ? "folder" : "file", tdb->shortLabel ); -printf("%s\n", tdb->longLabel); +jsInlineF("%s", parent, trackHubSkipHubName(tdb->track), userString, folder ? "folder" : "file", tdb->shortLabel ); +jsInlineF("%s", tdb->longLabel); if (tdb->subtracks) { struct trackDb *subTdb; for(subTdb = tdb->subtracks; subTdb; subTdb = subTdb->next) printGroup(trackHubSkipHubName(tdb->track), subTdb, user && (subTdb->subtracks != NULL), user); } } static void outHubHeader(FILE *f, char *db, char *hubName) // output a track hub header { char *hubFile = strrchr(hubName, '/') + 1; @@ -220,223 +220,68 @@ void addVisibleTracks() // add the visible tracks table rows { 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); } } } -static void doHeader() -// build the header for the main page -{ -puts( -"\n" -"
\n" -"
\n" -); -printf( -" \n" -" My Collections \n" -" " -" Build Custom Collections of Tracks \n" ); -puts( -"\n" -" \n" -" \n" -" \n" -" \n" -" \n" -"
\n" -"
\n" - -"
\n" -"
\n" -"
\n" - -"
Save
\n" -"
Discard Changes
\n" -"
\n" ); -puts( -"
\n" -"
\n" -); -} - -static void doTable() +void doTable() // output the tree table { -puts( -" \n" -"
\n" -"
All Tracks
\n" -"
\n"); - -puts( -"
\n" -"
Make New Collection
\n" -"
\n" -); -puts( -"
\n" -"
\n"); - char *hubName = hubNameFromUrl(getHubName(database)); -printf("\n"); +jsInlineF("$('#tracks tr:last').after(\""); struct grp *curGroup; -printf(""); -printf("\n"); 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; for(tdb = fullTrackList; tdb; tdb = tdb->next) { if (sameString(tdb->grp, hubName)) printGroup("collections", tdb, TRUE, TRUE); } } //addVisibleTracks(); for(curGroup = fullGroupList; curGroup; curGroup = curGroup->next) { if ((hubName != NULL) && sameString(curGroup->name, hubName)) continue; - printf("\n", curGroup->name, curGroup->label ); + jsInlineF("", curGroup->name, curGroup->label ); struct trackDb *tdb; for(tdb = fullTrackList; tdb; tdb = tdb->next) { if ( sameString(tdb->grp, curGroup->name)) { printGroup(curGroup->name, tdb, FALSE, FALSE); } } } -printf("
My CollectionsYour collected tracks.
%s
%s
\n"); -} - -static void doAttributes() -// output the attribute pane -{ -puts( -" \n" -"
\n" -"
Set Attributes
\n" -"
\n"); -puts( -"
\n" -"
Save
\n" -"
\n" -); -puts( -"
\n" -"
Discard Changes
\n" -"
\n" -); -puts( -"
\n"); -// trackDb track options (none at the moment) -puts( -"
" -"Drag to custom composite to copy to Collections" -"
" -); - -// view options -puts( -"
" -"" -"\n" -"
" -"\n" -"\n" -"
" -"" -"\n" -"
" -"" -"\n" -"
" -"

Color:   " -"

\n" -); - -// custom composite options -puts( -"
" -"" -"\n" -"
" -"\n" -"\n" -"
" -"" -"\n" -"
" -"\n" -"
\n" -); - -// custom track options -puts( -"
" -"" -"\n" -"
" -"\n" -"\n" -"
" -"" -"\n" -"
" -"

Color:   " -"

\n" - -); - +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( "\n" "
\n" "
Help
\n" @@ -454,60 +299,47 @@ "
\n" ); puts( "
\n" "
\n"); puts("
"); 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("jWest.css"); webIncludeResourceFile("spectrum.min.css"); webIncludeResourceFile("hgGtexTrackSettings.css"); -doHeader(); -puts( -"\n" -"
\n" -"
\n"); -doTable(); -puts( -"
\n" -"
\n"); -doAttributes(); -puts( -"
\n" -"
\n" -); +webIncludeFile("inc/hgCollection.html"); + printHelp(); +doTable(); puts(""); puts(""); jsIncludeFile("jquery.treetable.js", NULL); 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];