1e695a4eb7c3df8d90db67d0859efb86fde53201
kate
  Wed May 6 17:51:49 2020 -0700
Add collapsed panel with other tracks in supertrackand remove intro verbiage. Overall slim down the top material indicating hierarchy. Based on UI input from Ana and MarkD. refs #24948

diff --git src/hg/hgTrackUi/hgTrackUi.c src/hg/hgTrackUi/hgTrackUi.c
index 6b393b9..1b8bad9 100644
--- src/hg/hgTrackUi/hgTrackUi.c
+++ src/hg/hgTrackUi/hgTrackUi.c
@@ -3137,113 +3137,113 @@
     cartRemove(cart,"descriptionOnly"); // This is a once only request and should be deleted
     return;
     }
 if (tdbIsContainer(tdb))
     {
     safef(setting,sizeof(setting),"%s.%s",tdb->track,RESET_TO_DEFAULTS);
     // NOTE: if you want track vis to not be reset, move to after vis dropdown
     if (1 == cartUsualInt(cart, setting, 0))
         cartRemoveAllForTdbAndChildren(cart,tdb);
     else if (!ajax) // Overkill on !ajax, because ajax shouldn't be called for a composite
         cartTdbTreeReshapeIfNeeded(cart,tdb);
     }
 
 if (tdb->parent)
     {
-    printf("<i>This track is part of a super-track. "
-            "To configure the parent or sibling tracks, click a link below.</i>");
-
     // show super-track info
     struct trackDb *tdbParent = tdb->parent;
-    printf("<p>");
     if (trackDbSetting(tdbParent, "wgEncode"))
         printf("<A HREF='/ENCODE/index.html'><IMG style='vertical-align:middle;' "
                "width=100 src='/images/ENCODE_scaleup_logo.png'><A>");
-    printf("<b style='font-size:%d%%;'><a href='%s?%s=%s&c=%s&g=%s'"
-               " title='Configure parent track'>%s tracks</b></a>",
-                strlen(tdb->longLabel) > 30 ? 133 : 200,
+    printf("<b>Track grouping: <a href='%s?%s=%s&c=%s&g=%s'>%s </b></a>",
                 hgTrackUiName(), cartSessionVarName(), cartSessionId(cart),
                 chromosome, cgiEncode(tdbParent->track), tdbParent->longLabel);
 
     // show group info
     struct grp *grp, *grps = hLoadGrps(database);
     for (grp = grps; grp != NULL; grp = grp->next)
         {
         if (sameString(grp->name, tdb->grp))
             {
             printf("&nbsp;&nbsp;<B style='font-size:100%%;'>"
                    "(<A HREF=\"%s?%s=%s&c=%s&hgTracksConfigPage=configure"
                    "&hgtgroup_%s_close=0#%sGroup\" title='%s tracks in track configuration "
                    "page'><IMG height=12 src='../images/ab_up.gif'>All %s%s</A>)</B>",
                    hgTracksName(), cartSessionVarName(), cartSessionId(cart), chromosome,
                    tdb->grp, tdb->grp, grp->label, grp->label,
                    endsWith(grp->label," Tracks")?"":" tracks");
             break;
             }
         }
     grpFreeList(&grps);
 
-    printf("<table cellpadding='2' style='margin-left: 50px';>");
-    struct slRef *childRef;
-    tdbRefSortPrioritiesFromCart(cart, &tdbParent->children);
-    for (childRef = tdbParent->children; childRef != NULL; childRef = childRef->next)
-        {
-        struct trackDb *sibTdb = childRef->val;
-        if (sameString(sibTdb->track, tdb->track))
-            {
-            printf("<tr><td><b>%s</b></td>\n", sibTdb->shortLabel);
-            printf("<td>%s</td></tr>\n", sibTdb->longLabel);
-            continue;
-            }
-        printf("<tr>");
-        printf("<td><a href='%s?%s=%s&c=%s&g=%s'>%s</a>&nbsp;</td>", 
-                    tdbIsDownloadsOnly(sibTdb) ? hgFileUiName(): hTrackUiForTrack(sibTdb->track),
-                    cartSessionVarName(), cartSessionId(cart), chromosome, cgiEncode(sibTdb->track), 
-                    sibTdb->shortLabel);
-        printf("<td>%s</td></tr>\n", sibTdb->longLabel);
-        }
-    printf("</table></p>");
-
     // collapsed panel for Description
-    printf("<p><table>");
+
+    printf("<p>");
+    printf("<p><table>");  // required by jsCollapsible
     jsBeginCollapsibleSectionFontSize(cart, tdb->track, "superDescription", "Description", FALSE,
                                             "medium");
     char *html = replaceChars(tdbParent->html, "<H", "<h");
     html = replaceChars(html, "</H", "</h");
 
     // remove Description header
     html = replaceChars(html, "<h2>Description</h2>", "");
     html = replaceChars(html, "<h3>Description</h3>", "");
     html = replaceChars(html, "<h1>Description</h1>", "");
 
     // remove everything after Description text
     char *end = stringIn("<h2>", html);
     if (!end)
         end = stringIn("<h1>", html);
     if (!end)
         end = stringIn("<h3>", html);
     if (end)
         *end = '\0';
     printf("%s", html);
-    printf("<p><i>To view the full description of this super-track, click "
+    printf("<p><i>To view the full description, click "
                 "<a target='_blank' href='%s?%s=%s&c=%s&g=%s#TRACK_HTML'>here.</i></a>\n",
                     hgTrackUiName(), cartSessionVarName(), cartSessionId(cart),
                     chromosome, cgiEncode(tdbParent->track));
     jsEndCollapsibleSection();
-    printf("</table></p>");
+    printf("</table>"); // required by jsCollapsible
 
-    //printf("</p><p>&nbsp;&nbsp;<b>+ Description</b>\n");
+    // collapsed panel for list of other tracks in the supertrack
+
+    char listTitle[1000];
+    safef(listTitle, sizeof listTitle, "Other tracks in this grouping (%d)", 
+                        slCount(tdbParent->children)-1);
+    printf("<table>");  // required by jsCollapsible
+    jsBeginCollapsibleSectionFontSize(cart, tdb->track, "superMembers", listTitle, FALSE, "medium");
+    printf("<table cellpadding='2' style='margin-left: 50px';>");
+    struct slRef *childRef;
+    tdbRefSortPrioritiesFromCart(cart, &tdbParent->children);
+    for (childRef = tdbParent->children; childRef != NULL; childRef = childRef->next)
+        {
+        struct trackDb *sibTdb = childRef->val;
+        if (sameString(sibTdb->track, tdb->track))
+            continue;
+        printf("<tr>");
+        printf("<td><a href='%s?%s=%s&c=%s&g=%s'>%s</a>&nbsp;</td>", 
+                    tdbIsDownloadsOnly(sibTdb) ? hgFileUiName(): hTrackUiForTrack(sibTdb->track),
+                    cartSessionVarName(), cartSessionId(cart), chromosome, cgiEncode(sibTdb->track), 
+                    sibTdb->shortLabel);
+        printf("<td>%s</td></tr>\n", sibTdb->longLabel);
+        }
+    printf("</table>");
+    jsEndCollapsibleSection();
+    printf("</table>"); // required by jsCollapsible
+    printf("</p>");
 
     printf("<hr>");
     }
 
 /* track configuration form */
 
 printf("<FORM ACTION=\"%s\" NAME=\""MAIN_FORM"\" METHOD=%s>\n\n",
        hgTracksName(), cartUsualString(cart, "formMethod", "POST"));
 cartSaveSession(cart);
 if (sameWord(tdb->track,"ensGene"))
     {
     char longLabel[256];
     struct trackVersion *trackVersion = getTrackVersion(database, tdb->track);
     if ((trackVersion != NULL) && !isEmpty(trackVersion->version))
         {