60c5496c1df3ae97de10b263e01b7698afbfc743 tdreszer Fri Oct 28 14:28:10 2011 -0700 Eliminated a couple more vars from cart and FINALY got rid of funky comp.view.vis cart name. All vis is not standardized to trackName since view is a track. diff --git src/hg/js/subCfg.js src/hg/js/subCfg.js index 83dfae4..3eb1109 100644 --- src/hg/js/subCfg.js +++ src/hg/js/subCfg.js @@ -13,69 +13,55 @@ // parentObj: composite or view level obj which has subtrack level childObjs associated // childObj: subtrack level obj that has composite and or view level parentObjs // cfg: subtrack level embedded dialog which can be opened or closed (hidden) and isn't // populated till first opened. Can also be a viewCfg and maybe a compositeCfg // populate: act of filling a subtrack cfg with controls // fauxVis: fake control for subtrack visDD, which will be replaced with true vis when clicked. // TESTED: // OK subCBs enable/disable subVis and subCfg // OK subCBs set compVis to full // OK subVis faux works // OK subVis ajaxed on click // OK subVis change is persistent (as seen in: hgTracks image, rightClick, return to hgTrackUi) // OK subVis overridden by viewVis // OK subVis overridden by compVis -// BUG subVis set compVis to full (when compVis set to hide, but subVis already populated, setting subVis to non-hide DOES NOT set compVis to full) +// - subVis DOES NOT set compVis to full (when compVis set to hide, but subVis already populated) OK because this slips towords reshaping. // OK subCfg wrench disabled // OK subCfg wrench enable/disable by subCB // OK subCfg wrench enable/disable by subVis // OK subCfg populates (vias ajax) on click // OK subCfg settings persist (as seen in hgTracks rightClick) // OK subCfg open closes mdbArrow display // OK subCfg closed by mdbArrow open // OK subCfgs all closed on a table sort // OK subCfg overridden by viewCfg // STRANGE: clicking wrench to open does not leave viewCfg so viewCfg change isn't (yet) seen. // OK subCfg overridden by compCfg // OK matrix clicks enable/disable sub // OK matrix clicks set compVis to full // OK matrix [+][-] enable/disable subs // OK matrix [+] set compVis to full // OK viewVis changes set compVis to full // OK subVis correct in hgTrackUi, hgTracks image, rightClick memnu, rightClick poCfg // - cart limited to minimum changed // TODO: // - SOLVED: checkboxes: working with name = boolshad.{name} FIXME: multishad? -// - SOLVED: filterBy,filterComp working: they rely upon a unique id, and id with '.' screwed it all up. So replaced '.' with '_-' -// - SOLVED: OpenChromSynth: subtrack filterby needs to be updated by composite filterBy. -// - SOLVED: check subtrack to enable/disable fauxVis and wrench -// - SOLVED: matCB should effect subCb including enable/disable fauxVis and wrench -// - SOLVED: composite/view vis should effect subVis and enable/disable fauxVis and wrench -// - SOLVED: inside out: changing subtrack vis should affect subCB and matCB -// - SOLVED: Loosing checked tracks!!! Setting vis clears checkboxes? -// - TESTED: hui.c #ifdef SUBTRACK_CFG should switch full functionality on/off -// - SOLVED: Make "disabled" subCB clickable! -// - SOLVED: PROBLEM is fauxDisabled. SOLUTION is convert fauxDisabled to true disabled on form.submit() // - DECIDED: When parent vis makes subs hidden, should they go to unchecked? No, disabled! // - DECIDED: Should user be able to click on disabled vis to check the CB? No, not important. -// - DECIDED: Make vis changes "reshape" composite! NOTE: Do we want to do this??? I am against this as too disruptive. We may want to end reshaping in CGIs as well! -// - DECIDED: Decide on a name (scm, subCfg, ? ) and then make a module file like ddcl.js. -// - SOLVED: subtrack selected count is wrong! -// - SOLVED: matCb unclick leaves vis/wrench enabled. Vis/Wrench is usually only enabled for checked and visible. -// - SOLVED: subCfg tracks going non-visible should have subCfg div closed. +// - DECIDED: Make vis changes "reshape" composite! NO, I am against this as too disruptive. We may want to end reshaping in CGIs as well! // - Verify all composites work (hg19 hg18 mm9 mm8 panTro3 galGal3 braFlo1 dm3 ce10 homPan20 sacCer3 hg19Patch5 tested so far) // - Speed up massive composites! HAIB TFBS SYDH TFBS // - Remove debug code when ready // NOTE: // Current implementation relies upon '.' delimiter in name and no '_-' in name. Nothing breaks rule yet... var subCfg = { // subtrack config module. //mySelf: null, // There is no need for a "mySelf" unless this object is being instantiated. // There is one instance and these vars are page wide compositeName: undefined, visIndependent: false, viewTags: [], markChange: function (eventObj, obj) @@ -167,31 +153,31 @@ if (viewCfg == undefined) { warn('DEBUG: Could not find viewCfg for '+viewTag); } return viewCfg; }, viewObjFind: function (viewTag,suffix) { // returns the control belonging to this view and suffix var viewObj; if (suffix != undefined) { var viewCfg = subCfg.viewCfgFind(viewTag); viewObj = normed($(viewCfg).find("[name$='\\."+suffix+"']")); if (viewObj == undefined) viewObj = normed($(viewCfg).find("[name$='_"+suffix+"']")); } else - viewObj = normed($("[name='"+subCfg.compositeName+"\\."+viewTag+"\\.vis']")); + viewObj = normed($("select.viewDD."+viewTag)); return viewObj; }, childObjsFind: function (viewTag,suffix) { // returns an array of objs for this view and suffix // Assumes composite wide if viewTag is not provided // Assumes vis if suffix is not provided if (viewTag != undefined) { var childCfgs = $('div.subCfg.filled.'+viewTag); } else { var childCfgs = $('div.subCfg.filled'); } if (childCfgs == undefined) @@ -351,49 +337,41 @@ } return allChildren; } else { // if no views then just get them all return subCfg.childObjsFind(undefined,suffix); } } else { return subCfg.childObjsFind(viewTag,suffix); } }, visChildrenFind: function (parentObj) { // returns array of all currently faux and populated vis child controls (which are not in subCfg div) // parentObj could be composite level or view level - var isVis = false; - var suffix = subCfg.objSuffixGet(parentObj); - isVis = (suffix == undefined || suffix == 'vis'); - var isComposite = (suffix == undefined); - var subVis = $('.subVisDD'); // select:vis or faux:div - if (isComposite) { - + if ($(parentObj).hasClass('visDD')) // composite. views have .viewDD and sub .subVisDD return subVis; - } else { var classList = $( parentObj ).attr("class").split(" "); classList = aryRemove(classList,["viewDD","normalText","changed"]); if (classList.length != 1) { warn("DEBUG: Unexpected view vis class list:"+classList); return []; } return $(subVis).filter('.' + classList[0]); - } }, checkOneSubtrack: function (subCb,check,enable) { // Handle a single check of a single subCb // called by changing subVis to/from 'hide' subCb.checked = check; if (enable) fauxDisable(subCb,false,""); else fauxDisable(subCb,true, "View is hidden"); subCfg.markChange(null,subCb); subCfg.enableCfg(subCb,check); matSubCbClick(subCb); // needed to mark matCBs, shadow and show/hide }, @@ -643,36 +621,37 @@ success: catchErrorOrDispatch, error: errorHandler, cmd: "cfg", cache: false }); }, replaceWithVis: function (obj,subtrack,open) { // Replaces the current fauxVis object with a true visibility selector if ($(obj).hasClass('disabled')) return; var classList = $( obj ).attr("class").split(" "); classList = aryRemove(classList,["disabled"]); var view = classList[classList.length - 1]; // This relies on view being the last class!!! - var selectHtml = "<SELECT name='"+subtrack+"' class='normalText subVisDD "+view+"' style='width:70px;'"; - selectHtml += ">"; + var selectHtml = "<SELECT name='"+subtrack+"' class='normalText subVisDD "+view+"'"; + selectHtml += " style='width:70px;'>"; var selected = $(obj).text(); var visibilities = ['hide','dense','squish','pack','full']; $(visibilities).each( function (ix) { - selectHtml += "<OPTION" + (visibilities[ix] == selected ? " SELECTED":"") + ">"+visibilities[ix]+"</OPTION>"; + selectHtml += "<OPTION"+(visibilities[ix] == selected ? " SELECTED":"")+">"; + selectHtml += visibilities[ix]+"</OPTION>"; }); selectHtml += "</SELECT>"; $(obj).replaceWith(selectHtml); if (open) { var newObj = $("select[name='"+subtrack+"']"); $(newObj).css({'zIndex':'2','vertical-align':'top'}); $(newObj).attr('size',5); $(newObj).one('blur',function (e) { $(this).attr('size',1); $(this).unbind('click'); }); $(newObj).one('click',function (e) { $(this).attr('size',1); $(this).unbind('blur'); }); @@ -680,32 +659,36 @@ if ($(this).attr('size') > 1) { $(this).attr('size',1); $(this).unbind('blur'); $(this).unbind('click'); } if (this.selectedIndex == 0) { // setting to hide so uncheck and disable. // Easiest is to uncheck subCB and reset vis // so that the reverse action makes sense var subCb = normed($("input[name='" + this.name + "_sel']")); if (subCb != undefined) { subCfg.checkOneSubtrack(subCb,false,true); subCfg.inheritSetting(this,true); } else { warn('DEBUG: Cant find subCB for ' + this.name); } - } else + } else { subCfg.markChange(e,this); + // if just being made visible then composite to full? NO (implications to other subs) + // Make view visible? NO (subtrack override) + // reshape? NO (much too complex) + } }); $(newObj).focus(); } }, enableCfg: function (subCb,setTo) { // Enables or disables subVis and wrench var td = normed($(subCb).parent('td')); if (td == undefined) { warn("DEBUG: subCfg.enableCfg() could not find TD for CB: "+subCb.name); return false; } var subFaux = normed($(td).find('div.subVisDD')); if (subFaux != undefined) { if (setTo == true) @@ -774,31 +757,31 @@ return; } var viewObjs = $(tr).find('input,select'); if (viewObjs.length > 0) { $(viewObjs).each(function (i) { if (this.type != 'hidden') { $(this).bind('change',function (e) { subCfg.markChange(e,this); subCfg.propagateSetting(this); }); } }); } // Now vis control - var viewVis = normed($("select[name='"+subCfg.compositeName+"\\."+viewTag+"\\.vis']")); + var viewVis = normed($("select.viewDD."+viewTag)); if (viewVis == undefined) { warn('DEBUG: Did not find visibility control for view: ' + viewTag); return; } $(viewVis).bind('change',function (e) { subCfg.markChange(e,viewVis); subCfg.propagateVis(viewVis,viewTag); }); }, initialize: function () { // unnames all composite controls and then all view controls // names will be added back in onchange events // mySelf = this; // There is no need for a "mySelf" unless this object is being instantiated. @@ -859,30 +842,30 @@ && $(this).hasClass('filterBy') == false && $(this).hasClass('filterComp') == false) warn('DEBUG: Not expected control with name ['+this.name + '], and id #'+this.id); // DEBUG ------------- $(this).change(function (e) { subCfg.markChange(e,this); subCfg.propagateSetting(this); }); } }); } // Because of fauxDisabled subCBs, it is necessary to truly disable them before submitting. $("FORM").submit(function (i) { - $('input.subCB.changed.disabled').attr('disabled',true); + $('input.subCB.changed.disabled').attr('disabled',true); // shadows will go to cart as they should // Names will be removed for all controls that have not changed $('select,input').filter("[name]").not(".allOrOnly").not('.changed').each( function (i) { - if (this.type != 'hidden' || $(this).hasClass('trPos') || $(this).hasClass('cbShadow')) { - //this.disabled = true; // FIXME: which is faster: name or disabled ? + if (this.type != 'hidden' || $(this).hasClass('trPos') || $(this).hasClass('cbShadow') || $(this).hasClass('sortOrder')) { + // hiddens except priority and boolshad are all sent to the cart + //this.disabled = true; // QESTION: which is better: name or disabled ? this.name = ""; // Unname goes straight to the point: doesn't send in the form } }); // to do: other hiddens? - // matCb uncheck failed to update cart properly }); } };