src/hg/hgTracks/hgTracks.c 1.1638

1.1638 2010/04/08 22:31:33 kent
Making it so that list of makeItems tracks to initialize is determined at run time. Making hgTracks.c generate a javascript function hgTrackInitTracks() that gets called during the javascript init.
Index: src/hg/hgTracks/hgTracks.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/hgTracks.c,v
retrieving revision 1.1637
retrieving revision 1.1638
diff -b -B -U 4 -r1.1637 -r1.1638
--- src/hg/hgTracks/hgTracks.c	8 Apr 2010 18:36:46 -0000	1.1637
+++ src/hg/hgTracks/hgTracks.c	8 Apr 2010 22:31:33 -0000	1.1638
@@ -4158,8 +4158,24 @@
 }
 
 #endif
 
+void printTrackInitJavascript(struct track *trackList)
+{
+hPrintf("<script type='text/javascript'>\n");
+hPrintf( "function hgTracksInitTracks()\n{\n");
+
+struct track *track;
+for (track = trackList; track != NULL; track = track->next)
+    {
+    if (startsWithWord("makeItems", track->tdb->type) )
+        hPrintf("setUpMakeItemsDrag(\"%s\");\n", track->mapName);
+    }
+
+hPrintf( "}\n");
+hPrintf("</script>\n");
+}
+
 void doTrackForm(char *psOutput, struct tempName *ideoTn)
 /* Make the tracks display form with the zoom/scroll buttons and the active
  * image.  If the ideoTn parameter is not NULL, it is filled in if the
  * ideogram is created.  */
@@ -4304,8 +4320,10 @@
 if(!trackImgOnly)
     hPrintf(dyStringContents(trackDbJson));
 #endif
 
+printTrackInitJavascript(trackList);
+
 /* Generate two lists of hidden variables for track group visibility.  Kludgy,
    but required b/c we have two different navigation forms on this page, but
    we want open/close changes in the bottom form to be submitted even if the user
    submits via the top form. */