1c6c924436ec6dfb8e8164b73f659c655fa98a7d
larrym
  Wed Feb 22 15:45:09 2012 -0800
convert showWarning calls to warn in javascript code (I'm cleaning up code by removing a reimplementation of the warn code)
diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js
index 1ffb0c5..f023d97 100644
--- src/hg/js/hgTracks.js
+++ src/hg/js/hgTracks.js
@@ -1611,62 +1611,62 @@
         }
     },
 
     handleViewImg: function (response, status)
     {   // handles view image response, which must get new image without imageV2 gimmickery
         jQuery('body').css('cursor', '');
         var str = "<IMG[^>]*SRC='([^']+)'";
         var reg = new RegExp(str);
         a = reg.exec(response);
         if(a && a[1]) {
             if(window.open(a[1]) == null) {
                 rightClick.windowOpenFailedMsg();
             }
             return;
         }
-        showWarning("Couldn't parse out img src");
+        warn("Couldn't parse out img src");
     },
 
     myPrompt: function (msg, callback)
     {   // replacement for prompt; avoids misleading/confusing security warnings which are caused by prompt in IE 7+
         // callback is called if user presses "OK".
         $("body").append("<div id = 'myPrompt'><div id='dialog' title='Basic dialog'><form>" +
                             msg + "<input id='myPromptText' value=''></form>");
         $("#myPrompt").dialog({
                                 modal: true,
                                 closeOnEscape: true,
                                 buttons: { "OK": function() {
                                                     var myPromptText = $("#myPromptText").val();
                                                     $(this).dialog("close");
                                                     callback(myPromptText);
                                                 }
                                         }
                             });
     },
 
     hit: function (menuItemClicked, menuObject, cmd, args)
     {
         setTimeout( function() {
                         rightClick.hitFinish(menuItemClicked, menuObject, cmd, args);
                     }, 1);
     },
 
     hitFinish: function (menuItemClicked, menuObject, cmd, args)
     {   // dispatcher for context menu hits
         var id = rightClick.selectedMenuItem.id;
         if(menuObject.shown) {
-            // showWarning("Spinning: menu is still shown");
+            // warn("Spinning: menu is still shown");
             setTimeout(function() { rightClick.hitFinish(menuItemClicked, menuObject, cmd); }, 10);
             return;
         }
         if(cmd == 'selectWholeGene' || cmd == 'getDna') {
                 // bring whole gene into view or redirect to DNA screen.
                 var href = rightClick.selectedMenuItem.href;
                 var chromStart, chromEnd;
                 var a = /hgg_chrom=(\w+)&/.exec(href);
                 // Many links leave out the chrom (b/c it's in the server side cart as "c")
                 var chrom = hgTracks.chromName;
                 if(a) {
                     if(a && a[1])
                         chrom = a[1];
                     a = /hgg_start=(\d+)/.exec(href);
                     if(a && a[1])
@@ -1676,31 +1676,31 @@
                     if(a && a[1])
                         chromEnd = a[1];
                 } else {
                     // a = /hgc.*\W+c=(\w+)/.exec(href);
                     a = /hgc.*\W+c=(\w+)/.exec(href);
                     if(a && a[1])
                         chrom = a[1];
                     a = /o=(\d+)/.exec(href);
                     if(a && a[1])
                         chromStart = parseInt(a[1]) + 1;
                     a = /t=(\d+)/.exec(href);
                     if(a && a[1])
                         chromEnd = parseInt(a[1]);
                 }
                 if(chrom == null || chromStart == null || chromEnd == null) {
-                    showWarning("couldn't parse out genomic coordinates");
+                    warn("couldn't parse out genomic coordinates");
                 } else {
                     if(cmd == 'getDna')
                     {
                         if(window.open("../cgi-bin/hgc?g=getDna&i=mixed&c=" +
                                         chrom + "&l=" + (chromStart - 1) + "&r=" + chromEnd
                                       ) == null) {
                             rightClick.windowOpenFailedMsg();
                         }
                     } else {
                         var newPosition = genomePos.setByCoordinates(chrom, chromStart, chromEnd);
                         var reg = new RegExp("hgg_gene=([^&]+)");
                         var a = reg.exec(href);
                         var name;
                         // pull item name out of the url so we can set hgFind.matches (redmine 3062)
                         if(a && a[1]) {
@@ -2612,113 +2612,113 @@
 
     updateImgAndMap: function (response, status)
     {   // Handle ajax response with an updated trackMap image, map and optional ideogram.
         //
         // this.cmd can be used to figure out which menu item triggered this.
         // this.id == appropriate track if we are retrieving just a single track.
 
         // update local hgTracks.trackDb to reflect possible side-effects of ajax request.
         var json = scrapeVariable(response, "hgTracks");
         var oldTrackDb = hgTracks.trackDb;
         var valid = false;
         if(json == undefined) {
             var stripped = new Object();
             stripJsEmbedded(response, true, stripped);
             if(stripped.warnMsg == null)
-                showWarning("hgTracks object is missing from the response");
+                warn("hgTracks object is missing from the response");
         } else {
             if(this.id != null) {
                 if(json.trackDb[this.id]) {
                     var visibility = vis.enumOrder[json.trackDb[this.id].visibility];
                     var limitedVis;
                     if(json.trackDb[this.id].limitedVis)
                         limitedVis = vis.enumOrder[json.trackDb[this.id].limitedVis];
                     if(this.newVisibility && limitedVis && this.newVisibility != limitedVis)
                         // see redmine 1333#note-9
                         alert("There are too many items to display the track in " +
                                 this.newVisibility + " mode.");
                     var rec = hgTracks.trackDb[this.id];
                     rec.limitedVis = json.trackDb[this.id].limitedVis;
                     vis.update(this.id, visibility);
                     valid = true;
                 } else {
-                    showWarning("Invalid hgTracks.trackDb received from the server");
+                    warn("Invalid hgTracks.trackDb received from the server");
                 }
             } else {
                 valid = true;
                 hgTracks.trackDb = json.trackDb;
             }
         }
         if(valid) {
             if(imageV2.enabled
             && this.id
             && this.cmd
             && this.cmd != 'wholeImage'
             && this.cmd != 'selectWholeGene') {
                 // Extract <TR id='tr_ID'>...</TR> and update appropriate row in imgTbl;
                 // this updates src in img_left_ID, img_center_ID and img_data_ID and map in map_data_ID
                 var id = this.id;
                 if(imageV2.updateImgForId(response, id)) {
                     imageV2.afterReload();
                 } else {
-                    showWarning("Couldn't parse out new image for id: " + id);
+                    warn("Couldn't parse out new image for id: " + id);
                     //alert("Couldn't parse out new image for id: " + id+"BR"+response);  // Very helpful
                 }
             } else {
                 if(imageV2.enabled) {
                     // Implement in-place updating of hgTracks image
                     genomePos.setByCoordinates(json.chromName, json.winStart + 1, json.winEnd);
                     $("input[name='c']").val(json.chromName);
                     $("input[name='l']").val(json.winStart);
                     $("input[name='r']").val(json.winEnd);
                     if(json.cgiVersion != hgTracks.cgiVersion) {
                         // Must reload whole page because of a new version on the server; this should happen very rarely.
                         // Note that we have already updated position based on the user's action.
                         jQuery('body').css('cursor', 'wait');
                         document.TrackHeaderForm.submit();
                     } else {
                         // We update rows one at a time (b/c updating the whole imgTable at one time doesn't work in IE).
                         for (var id in hgTracks.trackDb) {
                         // handle case where invisible items may be in the trackDb list (see redmine #5670).
                             if(hgTracks.trackDb[id].type != "remote"
                             && hgTracks.trackDb[id].visibility > 0 // && $('#tr_' + id).length > 0
                             && !imageV2.updateImgForId(response, id)) {
-                                showWarning("Couldn't parse out new image for id: " + id);
+                                warn("Couldn't parse out new image for id: " + id);
                             }
                         }
                     /* This (disabled) code handles dynamic addition of tracks:
                         for (var id in hgTracks.trackDb) {
                             if(oldTrackDb[id] == undefined) {
                                 // XXXX Tim, what s/d abbr attribute be?
                                 $('#imgTbl').append("<tr id='tr_" + id + "' class='imgOrd trDraggable'></tr>");
                                 imageV2.updateImgForId(response, id);
                                 vis.update(id, vis.enumOrder[hgTracks.trackDb[id].visibility]);
                             }
                         }
                     */
                         hgTracks = json;
                         genomePos.original = undefined;
                         initVars();
                         imageV2.afterReload();
                     }
                 } else {
                     warn("ASSERT: Attempt to update track without advanced javascript features.");
                 }
                 // now pull out and parse the map.
                 //a = /<MAP id='map' Name=map>([\s\S]+)<\/MAP>/.exec(response);
                 //if(!a[1])
-                //    showWarning("Couldn't parse out map");
+                //    warn("Couldn't parse out map");
             }
             // Parse out new ideoGram url (if available)
             // e.g.: <IMG SRC = "../trash/hgtIdeo/hgtIdeo_hgwdev_larrym_61d1_8b4a80.gif" BORDER=1 WIDTH=1039 HEIGHT=21 USEMAP=#ideoMap id='chrom'>
             // We do this last b/c it's least important.
             var a = /<IMG([^>]+SRC[^>]+id='chrom'[^>]*)>/.exec(response);
             if(a && a[1]) {
                 var b = /SRC\s*=\s*"([^")]+)"/.exec(a[1]);
                 if(b && b[1]) {
                     $('#chrom').attr('src', b[1]);
                 }
             }
             if(hgTracks.measureTiming) {
                 imageV2.updateTiming(response);
             }
         }