ce35e717129dc543a902e935c86ddecbe762f557
tdreszer
  Fri Aug 27 14:12:50 2010 -0700
Checking in work on making hgTrackUi subtrack cfg work by popup just as right-click does.  This is ifdef'd out.
diff --git src/hg/js/hui.js src/hg/js/hui.js
index 7d1ca56..2606efd 100644
--- src/hg/js/hui.js
+++ src/hg/js/hui.js
@@ -585,6 +585,69 @@
     });
 }
 
+var popUpTrackName;
+var popUpTitle = "";
+function popUpCfg(content, status)
+{ // Kicks off a Modal Dialog for the provided content.
+    // Set up the modal dialog
+    var popit = $('#popit');
+    $(popit).html("<div style='font-size:80%'>" + content + "</div>");
+    $(popit).dialog({
+        ajaxOptions: { cache: true }, // This doesn't work
+        resizable: true,
+        bgiframe: true,
+        height: 'auto',
+        width: 'auto',
+        minHeight: 200,
+        minWidth: 700,
+        modal: true,
+        closeOnEscape: true,
+        autoOpen: false,
+        buttons: { "Ok": function() {
+            setAllVars($('#popit'),popUpTrackName); // Assumes subtrack, will do the right thing with "_sel" on hide // FIXME: sets vis even if same as inherited or unchanged!
+            var vis = $(this).find('select[name="'+popUpTrackName+'"]');
+            var sel = $('input[name="'+popUpTrackName+'_sel"]:checkbox');
+            if(vis != undefined && sel != undefined) {
+                var check = ($(vis).attr('selectedIndex') > 0);
+                $(sel).each( function (i) { matSubCBcheckOne(this,check); });  // Though there is only one, the each works but the direct call does not!
+                setCartVar( $(sel).attr('name'), $(sel).val() );
+                matSubCBsSelected();
+                // FIXME: These settings will be lost, unless the composite/view settings are ajaxed over on change!
+            }
+            $(this).dialog("close");
+        }},
+        close: function() { $('#popit').empty(); }
+    });
+    // Apparently the options above to dialog take only once, so we set title explicitly.
+    if(popUpTitle != undefined && popUpTitle.length > 0)
+        $(popit).dialog('option' , 'title' , popUpTitle );
+    else
+        $(popit).dialog('option' , 'title' , "Please Respond");
+    $(popit).dialog('open');
+}
+
+function _popUpSubrackCfg(trackName,label)
+{ // popup cfg dialog
+    popUpTrackName = trackName;
+    popUpTitle = label;
+
+    // FIXME: Avoid this getting into history and making the back button not work!
+    $.ajax({
+        type: "GET",
+        url: "../cgi-bin/hgTrackUi?ajax=1&g=" + trackName + "&hgsid=" + getHgsid() + "&db=" + getDb(),
+        dataType: "html",
+        trueSuccess: popUpCfg,
+        success: catchErrorOrDispatch,
+        cmd: "cfg",
+        cache: false
+    });
+}
+
+function popUpSubtrackCfg(trackName,label)
+{
+    waitOnFunction( _popUpSubrackCfg, trackName, label );  // Launches the popup but shields the ajax with a waitOnFunction
+}
+
 function subtrackCfgShow(tableName)
 {
 // Will show subtrack specific configuration controls