From 99190aac36a196e3c5dfcbaefd748a4c2ffa798a Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Wed, 13 Jul 2016 21:03:10 +0200 Subject: [PATCH] [jan] Allow to use the pretty autocompleter without Ajax requests. --- framework/Core/js/prettyautocomplete.js | 21 ++++++++++++--------- framework/Core/package.xml | 6 ++++-- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/framework/Core/js/prettyautocomplete.js b/framework/Core/js/prettyautocomplete.js index 51820f1e6f5..653e7e80a7e 100644 --- a/framework/Core/js/prettyautocomplete.js +++ b/framework/Core/js/prettyautocomplete.js @@ -91,15 +91,17 @@ var PrettyAutocompleter = Class.create({ this.input.observe('keyup', this.resize.bind(this)); this.input.observe('keydown', this.keyDownHandler.bindAsEventListener(this)); - // Create the underlaying Autocompleter - this.p.uri += '&input=' + this.p.trigger; + if (this.p.uri) { + // Create the underlaying Autocompleter + this.p.uri += '&input=' + this.p.trigger; - this.p.onShow = this.knlShow.bind(this); - this.p.onHide = this.knlHide.bind(this); + this.p.onShow = this.knlShow.bind(this); + this.p.onHide = this.knlHide.bind(this); - // Make sure the knl is contained in the overlay - this.p.domParent = this.p.box; - this.aac = new Ajax.Autocompleter(this.p.trigger, this.p.uri, this.p); + // Make sure the knl is contained in the overlay + this.p.domParent = this.p.box; + this.aac = new Ajax.Autocompleter(this.p.trigger, this.p.uri, this.p); + } this.initialized = true; // Prepopulate the items and the container elements? @@ -305,8 +307,9 @@ var PrettyAutocompleter = Class.create({ honorReturn: function() { - return (this.aac.knl && !this.aac.knl.getCurrentEntry()) || - !this.aac.knl; + return this.aac && + ((this.aac.knl && !this.aac.knl.getCurrentEntry()) || + !this.aac.knl); }, clickHandler: function(e) diff --git a/framework/Core/package.xml b/framework/Core/package.xml index cc9bd5516e8..e6e3a126bc8 100644 --- a/framework/Core/package.xml +++ b/framework/Core/package.xml @@ -28,7 +28,7 @@ mrubinsk@horde.org yes - 2016-07-12 + 2016-07-13 2.25.0 2.25.0 @@ -39,6 +39,7 @@ LGPL-2.1 +* [jan] Allow to use the pretty autocompleter without Ajax requests. * [mjr] Allow adding CSS files with Ajax response. * [mjr] Use syntaxhighlighter version 4. * [jan] Fix issue with prototype.js that keeps images in HTML messages from loading. @@ -4198,9 +4199,10 @@ stable stable - 2016-07-12 + 2016-07-13 LGPL-2.1 +* [jan] Allow to use the pretty autocompleter without Ajax requests. * [mjr] Allow adding CSS files with Ajax response. * [mjr] Use syntaxhighlighter version 4. * [jan] Fix issue with prototype.js that keeps images in HTML messages from loading.