src/hg/hgTracks/imageV2.c 1.31

1.31 2010/05/24 19:40:06 tdreszer
Second attempt to allow 'target=' in URL.
Index: src/hg/hgTracks/imageV2.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/imageV2.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -b -B -U 4 -r1.30 -r1.31
--- src/hg/hgTracks/imageV2.c	24 May 2010 19:24:58 -0000	1.30
+++ src/hg/hgTracks/imageV2.c	24 May 2010 19:40:06 -0000	1.31
@@ -1398,12 +1398,22 @@
     hPrintf("\n   <AREA SHAPE=RECT COORDS='%d,%d,%d,%d' onclick='return mapClk(this);'",
            item->topLeftX, item->topLeftY, item->bottomRightX, item->bottomRightY);
     // TODO: remove static portion of the link and handle in js
     if(map->linkRoot != NULL)
+        {
+        if(skipToSpaces(item->linkVar) != NULL)
+            hPrintf(" HREF=%s%s",map->linkRoot,(item->linkVar != NULL?item->linkVar:""));
+        else
         hPrintf(" HREF='%s%s'",map->linkRoot,(item->linkVar != NULL?item->linkVar:""));
+        }
     else if(item->linkVar != NULL)
+        {
+        if(skipToSpaces(item->linkVar) != NULL)
         hPrintf(" HREF='%s'",item->linkVar);
     else
+            hPrintf(" HREF=%s",item->linkVar);
+        }
+    else
         warn("map item has no url!");
 
     if(item->title != NULL && strlen(item->title) > 0)
         hPrintf(" TITLE='%s'", item->title );
@@ -1497,9 +1507,9 @@
 if(map)
     useMap = imageMapDraw(map,name);
 else if(slice->link != NULL)
     {
-    if(strchr(slice->link,' ') != NULL)
+    if(skipToSpaces(slice->link) != NULL)
         hPrintf("  <A HREF=%s",slice->link);
     else
         hPrintf("  <A HREF='%s'",slice->link);
     if(slice->title != NULL)