106895cbff17848866e9b5cfeefb0ce1985203a1 tdreszer Wed Oct 5 16:52:11 2011 -0700 More tightening of screws. Several special cases solved. Altererd which right-click menu items for cfg appear and regularized this with subCfg availability. diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index 3e34a2c..f91e364 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -2323,38 +2323,43 @@ } o[str] = { onclick: function(menuItemClicked, menuObject) { contextMenuHit(menuItemClicked, menuObject, "dragZoomMode"); return true; }}; menu.push(o); o = new Object(); // console.dir(ele); str = "hilight mode"; if(!autoHideSetting) { str += selectedImg; } o[str] = { onclick: function(menuItemClicked, menuObject) { contextMenuHit(menuItemClicked, menuObject, "hilightMode"); return true; }}; menu.push(o); } //menu.push({"view image": {onclick: function(menuItemClicked, menuObject) { contextMenuHit(menuItemClicked, menuObject, "viewImg"); return true; }}}); } - if(selectedMenuItem && rec && rec["configureBy"] != 'none') { + if(selectedMenuItem && rec) { // Add cfg options at just shy of end... + // configureBy==none, subtracks get folder, stand-alones get nothing + // configureBy==clickThrough, subtracks get folder, stand-alones get wrench but it will not be a popup + // configureBy==popup subtracks get wrench and folder, stand-alones get wrench as popup var o = new Object(); if(tdbIsLeaf(rec)) { + if ( rec["configureBy"] != 'none' + && (rec["configureBy"] != 'clickThrough' || rec.parentTrack == undefined)) o[makeImgTag("wrench.png") + " Configure " + rec.shortLabel] = {onclick: function(menuItemClicked, menuObject) { contextMenuHit(menuItemClicked, menuObject, "hgTrackUi_popup"); return true; }}; if(rec.parentTrack != undefined) o[makeImgTag("folderWrench.png") + " Configure " + rec.parentLabel + " track set..."] = {onclick: function(menuItemClicked, menuObject) { contextMenuHit(menuItemClicked, menuObject, "hgTrackUi_follow"); return true; }}; - } else + } else if (rec["configureBy"] != 'none') o[makeImgTag("folderWrench.png") + " Configure " + rec.shortLabel + " track set..."] = {onclick: function(menuItemClicked, menuObject) { contextMenuHit(menuItemClicked, menuObject, "hgTrackUi_follow"); return true; }}; if(jQuery.floatMgr) { o[(selectedMenuItem.id == floatingMenuItem ? selectedImg : blankImg) + " float"] = {onclick: function(menuItemClicked, menuObject) { contextMenuHit(menuItemClicked, menuObject, "float"); return true; }}; } menu.push($.contextMenu.separator); menu.push(o); } // Add view image at end var o = new Object(); o[makeImgTag("eye.png") + " View image"] = {onclick: function(menuItemClicked, menuObject) { contextMenuHit(menuItemClicked, menuObject, "viewImg"); return true; }}; menu.push($.contextMenu.separator); menu.push(o); return menu; @@ -2508,66 +2513,44 @@ } } } } function handleTrackUi(response, status) { // Take html from hgTrackUi and put it up as a modal dialog. // make sure all links (e.g. help links) open up in a new window response = response.replace(/<a /ig, "<a target='_blank' "); // TODO: Shlurp up any javascript files from the response and load them with $.getScript() // example <script type='text/javascript' SRC='../js/tdreszer/jquery.contextmenu-1296177766.js'></script> var cleanHtml = response; - var shlurpPattern=/\<script type=\'text\/javascript\' SRC\=\'.*\'\>\<\/script\>/gi; - var jsFiles = cleanHtml.match(shlurpPattern); - cleanHtml = cleanHtml.replace(shlurpPattern,""); - shlurpPattern=/\<script type=\'text\/javascript\'>.*\<\/script\>/gi; - var jsEmbeded = cleanHtml.match(shlurpPattern); - cleanHtml = cleanHtml.replace(shlurpPattern,""); - //<LINK rel='STYLESHEET' href='../style/ui.dropdownchecklist-1276528376.css' TYPE='text/css' /> - shlurpPattern=/\<LINK rel=\'STYLESHEET\' href\=\'.*\' TYPE=\'text\/css\' \/\>/gi; - var cssFiles = cleanHtml.match(shlurpPattern); - cleanHtml = cleanHtml.replace(shlurpPattern,""); + cleanHtml = stripJsFiles(cleanHtml, false); // true means show error msg + cleanHtml = stripCssFiles(cleanHtml, false); + cleanHtml = stripJsEmbedded(cleanHtml,false);// NOTE: embeded warnBox msgs will be put into the warnbox $('#hgTrackUiDialog').html("<div id='pop' style='font-size:.9em;'>" + cleanHtml + "</div>"); // Strategy for poups with js: // - jsFiles and CSS should not be included in html. Here they are shluped out. // - The resulting files ought to be loadable dynamically (with getScript()), but this was not working nicely with the modal dialog // Therefore include files must be included with hgTracks CGI ! // - embedded js should not be in the popup box. // - Somethings should be in a popup.ready() function, and this is emulated below, as soon as the cleanHtml is added // Since there are many possible popup cfg dialogs, the ready should be all inclusive. - /* //in open ? Will load of css work this way? - $(cssFiles).each(function (i) { - bix = "<LINK rel='STYLESHEET' href='".length; - eix = this.lastIndexOf("' TYPE='text/css' />"); - file = this.substring(bix,eix); - $.getScript(file); // Should protect against already loaded files. - }); */ - /* //in open ? Loads fine, but then dialog gets confused - $(jsFiles).each(function (i) { - bix = "<script type='text/javascript' SRC='".length; - eix = this.lastIndexOf("'></script>"); - file = this.substring(bix,eix); - //$.getScript(file,function(data) { warn(data.substring(0,20) + " loaded")}); - });*/ - if( ! popUpTrackDescriptionOnly ) { var subtrack = tdbIsSubtrack(hgTracks.trackDb[popUpTrackName]) ? popUpTrackName :""; // If subtrack then vis rules differ popSaveAllVars = getAllVars( $('#hgTrackUiDialog'), subtrack ); // Saves the vars that may get changed by the popup cfg. // -- popup.ready() -- Here is the place to do things that might otherwise go into a $('#pop').ready() routine! } // Searching for some selblance of size suitability var popMaxHeight = ($(window).height() - 40); var popMaxWidth = ($(window).width() - 40); var popWidth = 740; if (popWidth > popMaxWidth) popWidth > popMaxWidth; $('#hgTrackUiDialog').dialog({