From e55fd9c09c7406663eeb33e596244ff5ae64a444 Mon Sep 17 00:00:00 2001 From: senator Date: Wed, 14 Apr 2010 21:40:50 +0000 Subject: [PATCH] Acq: unified search UI bugfix - timestamp searches were broken git-svn-id: svn://svn.open-ils.org/ILS/trunk@16239 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/js/ui/default/acq/search/unified.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Open-ILS/web/js/ui/default/acq/search/unified.js b/Open-ILS/web/js/ui/default/acq/search/unified.js index 49ebda2fbf..bcd4008dca 100644 --- a/Open-ILS/web/js/ui/default/acq/search/unified.js +++ b/Open-ILS/web/js/ui/default/acq/search/unified.js @@ -89,7 +89,9 @@ function TermSelectorFactory(terms) { "datatype": self.terms[parts[0]][parts[1]].datatype }; }, - "makeWidget": function(parentNode, wStore, matchHow, value, callback) { + "makeWidget": function( + parentNode, wStore, matchHow, value, noFocus, callback + ) { var term = this.getTerm(); var widgetKey = this.uniq; if (matchHow.getValue() == "__in") { @@ -116,7 +118,8 @@ function TermSelectorFactory(terms) { ); if (typeof(value) != "undefined") wStore[widgetKey].value = value; - wStore[widgetKey].focus(); + if (!noFocus) + wStore[widgetKey].focus(); if (typeof(callback) == "function") callback(term, widgetKey); } else { @@ -130,7 +133,8 @@ function TermSelectorFactory(terms) { wStore[widgetKey] = w; if (typeof(value) != "undefined") w.attr("value", value); - w.focus(); + if (!noFocus) + w.focus(); if (typeof(callback) == "function") callback(term, widgetKey); } @@ -274,14 +278,14 @@ function TermManager() { field_map[term.field]["class"]; }; - this.updateRowWidget = function(id, value) { + this.updateRowWidget = function(id, value, noFocus) { var where = nodeByName("widget", this._row(id)); delete this.widgets[id]; dojo.empty(where); this._selector(id).makeWidget( - where, this.widgets, this._match_how(id), value, + where, this.widgets, this._match_how(id), value, noFocus, this._updateMatchHowForField ); }; @@ -353,14 +357,18 @@ function TermManager() { dojo.place(row, "acq-unified-terms-tbody", "last"); if (term && hint) { - var field = hint + ":" + this._term_reverse_selector_field(term); + var attr = this._term_reverse_selector_field(term); + var field = hint + ":" + attr; selector.setValue(field); var match_how_value = this._term_reverse_match_how(term); if (match_how_value) match_how.setValue(match_how_value); - this.updateRowWidget(uniq, this._term_reverse_selector_value(term)); + var value = this._term_reverse_selector_value(term); + if (this.terms[hint][attr].datatype == "timestamp") + value = dojo.date.stamp.fromISOString(value); + this.updateRowWidget(uniq, value, /* noFocus */ true); } } -- 2.11.0