From 60e3bc781ea9e67cdc455094689aa07e0b92bbbc Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Tue, 30 Oct 2012 06:15:34 -0400
Subject: [PATCH] Fixed: FS#2509 - Intermittent 500 responses in access.log without corresponding entries in error.log

---
 interface/web/js/jquery.tipsy.js |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/interface/web/js/jquery.tipsy.js b/interface/web/js/jquery.tipsy.js
index bd52335..52c35b3 100644
--- a/interface/web/js/jquery.tipsy.js
+++ b/interface/web/js/jquery.tipsy.js
@@ -250,12 +250,13 @@
             var input,
                 self = this,
                 select = this.element,
+                internal = false,
                 selected = select.children( ":selected" ),
                 value = selected.val() ? selected.text() : "",
                 wrapper = this.wrapper = $( "<span>" )
                     .addClass( "ui-combobox" )
                     .insertAfter( select );
-
+            
             input = $( "<input>" ).css( { "width": (select.is(':visible') ? (elwidth > 15 ? elwidth - 15 : 1) : 350), "height": (elheight > 0 ? elheight : 16) });
             select.hide();
             input.appendTo( wrapper )
@@ -269,7 +270,7 @@
                         response( select.children( "option" ).map(function() {
                             var text = $( this ).text();
                             //if ( this.value && ( !request.term || matcher.test(text) ) )
-                            if ( !request.term || matcher.test(text) )
+                            if ( (!request.term || matcher.test(text)) && $(this).css('display') != 'none' )
                                 return {
                                     label: (text == "" ? "&nbsp;" : text.replace(
                                         new RegExp(
@@ -293,7 +294,10 @@
                         } else if($(select).attr('onchange')) {
                             eval($(select).attr('onchange'));
                         } else {
-                            if(!ui.item.internal) $(select).change();
+                            if(!ui.item.internal) {
+                                internal = true;
+                                $(select).change();
+                            }
                         }
                         if (jQuery(".panel #Filter").length > 0) {
                             jQuery(".panel #Filter").trigger('click');
@@ -305,7 +309,7 @@
                                 matchtext = $(this).val();
                                 valid = false;
                             select.children( "option" ).each(function() {
-                                if( ($(this).text() == "" && matchtext == "") || $( this ).text().match( matcher ) ) {
+                                if( (($(this).text() == "" && matchtext == "") || $( this ).text().match( matcher )) && $(this).css('display') != 'none' ) {
                                     select.val($(this).val());
                                     this.selected = valid = true;
                                     return false;
@@ -329,7 +333,7 @@
                             valid = false,
                             selected = false;
                         select.children( "option" ).each(function() {
-                            if( ($(this).val() == "" && matchtext == "") || $( this ).text().match( matcher ) ) {
+                            if( (($(this).val() == "" && matchtext == "") || $( this ).text().match( matcher )) && $(this).css('display') != 'none' ) {
                                 valid = true;
                                 selected = $(this);
                                 return false;
@@ -352,12 +356,16 @@
                 return el;
             };
             select.change(function(e) {
+                if(internal == true) {
+                    internal = false;
+                    return;
+                }
                 var matcher = new RegExp( "" + $.ui.autocomplete.escapeRegex( $(this).val() ) + "", "i" ),
                     matchtext = $(this).val();
                     valid = false,
                     selected = false;
                 select.children( "option" ).each(function() {
-                    if( ($(this).val() == "" && matchtext == "") || $( this ).text().match( matcher ) ) {
+                    if( (($(this).val() == "" && matchtext == "") || $( this ).text().match( matcher )) && $(this).css('display') != 'none' ) {
                         valid = true;
                         selected = $(this);
                         return false;

--
Gitblit v1.9.1