Index: src/hg/hgTracks/imageV2.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/imageV2.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -b -B -U 4 -r1.6 -r1.7
--- src/hg/hgTracks/imageV2.c	17 Jul 2009 18:25:41 -0000	1.6
+++ src/hg/hgTracks/imageV2.c	27 Aug 2009 00:10:16 -0000	1.7
@@ -413,9 +413,8 @@
 
 struct imgTrack *imgTrackUpdate(struct imgTrack *imgTrack,struct trackDb *tdb,char *name,char *db,char *chrom,int chromStart,int chromEnd,boolean plusStrand,boolean showCenterLabel,enum trackVisibility vis,int order)
 /* Updates an already existing image track */
 {
-static int lastOrder = 900; // keep track of the order these images get added
 if(tdb != NULL && tdb != imgTrack->tdb)
     imgTrack->tdb    = tdb;
 if(name != NULL && differentStringNullOk(imgTrack->name,name))
     {
@@ -431,8 +430,10 @@
 imgTrack->chromEnd   = chromEnd;
 imgTrack->plusStrand = plusStrand;
 imgTrack->showCenterLabel = showCenterLabel;
 imgTrack->vis             = vis;
+#ifdef IMAGEv2_DRAG_REORDER
+static int lastOrder = 900; // keep track of the order these images get added
 if(order == IMG_FIXEDPOS)
     {
     imgTrack->reorderable = FALSE;
     if(name != NULL && sameString(RULER_TRACK_NAME,name))
@@ -450,8 +451,12 @@
         }
     else if(imgTrack->order != order)
         imgTrack->order = order;
     }
+#else//ifndef IMAGEv2_DRAG_REORDER
+    imgTrack->reorderable = FALSE;
+    imgTrack->order = 1;
+#endif//ndef IMAGEv2_DRAG_REORDER
 return imgTrack;
 }
 
 int imgTrackOrderCmp(const void *va, const void *vb)
@@ -1050,20 +1055,22 @@
 if(!imgBoxIsComplete(imgBox,TRUE))
     return;
 char name[128];
 
-// TODO: Add in sorting
-//if(differentStringNullOk(imgBox->imgTracks->name,RULER_TRACK_NAME))
-//    slReverse(&(imgBox->imgTracks));
+#ifdef IMAGEv2_DRAG_REORDER
 imgBoxTracksNormalizeOrder(imgBox);
+#endif//def IMAGEv2_DRAG_REORDER
 
 hPrintf("<!---------------vvv IMAGEv2 vvv---------------->\n");
 //commonCssStyles();
+#ifdef IMAGEv2_DRAG_REORDER
 jsIncludeFile("jquery.tablednd.js", NULL);
-// TODO: jsIncludeFile("dragScroll.js", NULL);
+#endif//def IMAGEv2_DRAG_REORDER
 hPrintf("<style type='text/css'>\n");
+#ifdef IMAGEv2_DRAG_REORDER
 hPrintf(".trDrag {opacity:0.4; padding:1px; background-color:red;}\n");// outline:red solid thin;}\n"); // opacity for FF, padding/bg for IE
 hPrintf(".dragHandle {cursor: s-resize;}\n");
+#endif//def IMAGEv2_DRAG_REORDER
 hPrintf("div.dragZoom {cursor: text;}\n");
 hPrintf("</style>\n");
 
 if(imgBox->showPortal)
@@ -1084,9 +1091,12 @@
     }
 
 hPrintf("<TABLE id='imgTbl' border=0 cellspacing=0 cellpadding=0");
 hPrintf(" width=%d",imgBox->showPortal?(imgBox->portalWidth+imgBox->sideLabelWidth):imgBox->width);
-hPrintf(" class='tableWithDragAndDrop' style='border:1px solid blue;border-collapse:separate'");
+#ifdef IMAGEv2_DRAG_REORDER
+hPrintf(" class='tableWithDragAndDrop'");
+#endif//def IMAGEv2_DRAG_REORDER
+hPrintf(" style='border:1px solid blue;border-collapse:separate'");
 hPrintf(">\n");
 
 struct imgTrack *imgTrack = imgBox->imgTracks;
 for(;imgTrack!=NULL;imgTrack=imgTrack->next)
@@ -1096,9 +1106,9 @@
         (imgTrack->reorderable?" class='trDraggable'":" class='nodrop nodrag'"));
     // leftLabel
     if(imgBox->showSideLabel && imgBox->plusStrand)
         {
-        safef(name,sizeof(name),"left_%s",trackName);
+        safef(name,sizeof(name),"side_%s",trackName);
         hPrintf(" <TD id='td_%s'%s>\n",name,
             (imgTrack->reorderable?" class='dragHandle' title='Drag to reorder'":""));
         sliceAndMapDraw(imgBox,imgTrackSliceGetByType(imgTrack,isSide), name,FALSE);
         hPrintf(" </TD>");
@@ -1114,15 +1124,15 @@
         //hPrintf("<BR>\n");
         }
     // data image
     safef(name, sizeof(name), "data_%s", trackName);
-    sliceAndMapDraw(imgBox,imgTrackSliceGetByType(imgTrack,isData), name,imgTrack->reorderable);
+    sliceAndMapDraw(imgBox,imgTrackSliceGetByType(imgTrack,isData), name,(imgTrack->order>0));
     hPrintf(" </TD>");
 
     // rightLabel
     if(imgBox->showSideLabel && !imgTrack->plusStrand)
         {
-        safef(name, sizeof(name), "right_%s", trackName);
+        safef(name, sizeof(name), "side_%s", trackName);
         hPrintf(" <TD id='td_%s'%s>\n", name,
             (imgTrack->reorderable?" class='dragHandle' title='Drag to reorder'":""));
         sliceAndMapDraw(imgBox,imgTrackSliceGetByType(imgTrack,isSide), name,FALSE);
         hPrintf(" </TD>\n");

