eded571df89e184c92e7269e92011dc646c812b7 tdreszer Wed Nov 16 10:25:46 2011 -0800 At Angie's request, adding ability to have map items with mouse-over title but no actual link diff --git src/hg/hgTracks/imageV2.c src/hg/hgTracks/imageV2.c index bca92cf..5c8095c 100644 --- src/hg/hgTracks/imageV2.c +++ src/hg/hgTracks/imageV2.c @@ -1604,48 +1604,55 @@ /////////////////////// imageV2 UI API static boolean imageMapDraw(struct mapSet *map,char *name) /* writes an image map as HTML */ { //warn("Drawing map_%s %s",name,(map == NULL?"map is NULL":map->items == NULL?"map->items is NULL":"Should draw!")); if(map == NULL || map->items == NULL) return FALSE; slReverse(&(map->items)); // These must be reversed so that they are printed in the same order as created! hPrintf(" <MAP name='map_%s'>", name); // map_ prefix is implicit struct mapItem *item = map->items; for(;item!=NULL;item=item->next) { - hPrintf("\n <AREA SHAPE=RECT COORDS='%d,%d,%d,%d' class='area'", + hPrintf("\n <AREA SHAPE=RECT COORDS='%d,%d,%d,%d'", item->topLeftX, item->topLeftY, item->bottomRightX, item->bottomRightY); // TODO: remove static portion of the link and handle in js - if(map->linkRoot != NULL) + + if (sameString(TITLE_BUT_NO_LINK,item->linkVar)) + { // map items could be for mouse-over titles only + hPrintf(" class='area %s'",TITLE_BUT_NO_LINK); + } + else if(map->linkRoot != NULL) { if(skipToSpaces(item->linkVar)) hPrintf(" HREF=%s%s",map->linkRoot,(item->linkVar != NULL?item->linkVar:"")); else hPrintf(" HREF='%s%s'",map->linkRoot,(item->linkVar != NULL?item->linkVar:"")); + hPrintf(" class='area'"); } else if(item->linkVar != NULL) { if(skipToSpaces(item->linkVar)) hPrintf(" HREF=%s",item->linkVar); else if(startsWith("/cgi-bin/hgGene", item->linkVar)) // redmine #4151 - hPrintf(" HREF='..%s'",item->linkVar); + hPrintf(" HREF='..%s'",item->linkVar); // FIXME: Chin should get rid of this special case! else hPrintf(" HREF='%s'",item->linkVar); + hPrintf(" class='area'"); } else warn("map item has no url!"); if(item->title != NULL && strlen(item->title) > 0) hPrintf(" TITLE='%s'", htmlEncode(item->title) ); if(item->id != NULL) hPrintf(" id='%s'", item->id); hPrintf(">" ); } hPrintf("</MAP>\n"); return TRUE; } static void imageDraw(struct imgBox *imgBox,struct imgTrack *imgTrack,struct imgSlice *slice,char *name,int offsetX,int offsetY,boolean useMap) @@ -1747,31 +1754,35 @@ if (sliceType == stCenter && imgTrack->centerLabelSeen == clNotSeen) hPrintf(" display:none;"); hPrintf("' class='sliceDiv %s",sliceTypeToClass(slice->type)); #ifdef IMAGEv2_DRAG_SCROLL if(imgBox->showPortal && (sliceType==stData || sliceType==stCenter)) hPrintf(" panDiv%s",(scrollHandle?" scroller":"")); #endif //def IMAGEv2_DRAG_SCROLL hPrintf("'>\n"); } struct mapSet *map = sliceGetMap(slice,FALSE); // Could be the image map or slice specific if(map) useMap = imageMapDraw(map,name); else if(slice->link != NULL) { - if(skipToSpaces(slice->link) != NULL) + if (sameString(TITLE_BUT_NO_LINK,slice->link)) + { // This fake link ensures a mouse-over title is seen but not heard + hPrintf("<A class='%s'",TITLE_BUT_NO_LINK); + } + else if(skipToSpaces(slice->link) != NULL) hPrintf(" <A HREF=%s",slice->link); else hPrintf(" <A HREF='%s'",slice->link); if (slice->title != NULL) { if (sliceType == stButton) { enum browserType browser = cgiClientBrowser(NULL,NULL,NULL); char *newLine = NEWLINE_TO_USE(browser); char *ellipsis = ELLIPSIS_TO_USE(browser); if(imgTrack->reorderable) hPrintf(" TITLE='%s%sclick or right click to configure%s%sdrag to reorder%s'",htmlEncode(slice->title), newLine, ellipsis, newLine,(tdbIsCompositeChild(imgTrack->tdb)?" highlighted subtracks":"") ); else hPrintf(" TITLE='%s%sclick or right click to configure%s'",htmlEncode(slice->title), newLine, ellipsis);