[open-ils-commits] r16239 - trunk/Open-ILS/web/js/ui/default/acq/search (senator)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Apr 14 17:40:56 EDT 2010


Author: senator
Date: 2010-04-14 17:40:50 -0400 (Wed, 14 Apr 2010)
New Revision: 16239

Modified:
   trunk/Open-ILS/web/js/ui/default/acq/search/unified.js
Log:
Acq: unified search UI bugfix - timestamp searches were broken


Modified: trunk/Open-ILS/web/js/ui/default/acq/search/unified.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/search/unified.js	2010-04-14 18:54:15 UTC (rev 16238)
+++ trunk/Open-ILS/web/js/ui/default/acq/search/unified.js	2010-04-14 21:40:50 UTC (rev 16239)
@@ -89,7 +89,9 @@
                 "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 @@
                 );
                 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 @@
                         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 @@
             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 @@
         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);
 
         }
     }



More information about the open-ils-commits mailing list