676782ddc52f070ba0ebd615c41aa94802e447d0 tdreszer Tue Jun 28 12:27:36 2011 -0700 Fix to redmine 2813 note 20. In IE8, the first 'advanced' track search often failed because 'any' was replaces with every option, thus producing a gigantic submit URL. diff --git src/hg/js/utils.js src/hg/js/utils.js index c4e102b..5e80d0f 100644 --- src/hg/js/utils.js +++ src/hg/js/utils.js @@ -2497,46 +2497,46 @@ if (index > 0) $(this).attr('checked',false); }); } } function ddclOnComplete(selector) { // Called by ui.dropdownchecklist.js when selections have been made // Also called at init to fill the selector with current choices // Warning: In IE this gets called when still selecting! var id = $(selector).attr('id'); // If no options are selected, may have to force all - if ($(selector).attr('noneIsAll') == 'true') { var chosen = $(selector).find('option:selected'); if (chosen.length == 0) { + if ($(selector).hasClass('noneIsAll')) { //$(selector).first('option').first().attr('selected',true); selector.options[0].selected = true; // How to check the first item? var dropWrapper = $('#ddcl-' + id + '-ddw'); $(dropWrapper).find("input").first().attr("checked",true); + } } else if (chosen.length == $(selector).find('option').length) { // If all are chosen then select only the first! $(chosen).each(function(index) { if (index > 0) $(this).attr('selected',false); }); } - } var msg = ddclTextOfCurrentSelections(selector.options); var control = this.controlWrapper; if (control == null || control == undefined) { // caller is not constant control = $('#ddcl-' + id); } var newColor = ''; if ($(selector).find('option:selected').length == 0) newColor = '#AA0000'; // red //else if (msg.search(/color:/i) == -1) // newColor = 'black'; ddclLabelSet(control,msg,newColor,'Click to select...'); } @@ -2623,31 +2623,32 @@ } maxWidth = (Math.ceil(maxWidth / 10) * 10) + 10; // Makes for more even boxes var style = $(obj).attr('style'); // The magic starts here: $(obj).dropdownchecklist({ firstItemChecksAll: true, noneIsAll: myNoneIsAll, maxDropHeight: myDropHeight, icon: myIcon, emptyText: myEmptyText, explicitClose: myClose, textFormatFunction: function () { return 'selecting...'; } , onComplete: ddclOnComplete }); - $(obj).attr('noneIsAll',myNoneIsAll); // Declare this as none selected same as all selected + if (myNoneIsAll) + $(obj).addClass('noneIsAll'); // Declare this as none selected same as all selected ddclOnComplete(obj); // shows selected items in multiple lines // Set up the selector (control seen always and replacing select) control = $('#ddcl-' + id); if (control == null || control == undefined) { warn('ddclSetup('+id+') failed to create drop-down checkbox-list'); return; } var controlSelector = $(control).find(".ui-dropdownchecklist-selector"); $(controlSelector).click(ddclOnOpen); $(controlSelector).css({width:maxWidth+'px'}); var controlText = $(control).find(".ui-dropdownchecklist-text"); $(controlText).css({width:maxWidth+'px'}); // Set up the drop list (control seen only on fucus and with items to choose)