var localeStrings = dojo.i18n.getLocalization('openils.acq', 'acq');
}
-if (typeof unifiedSearchMode == 'undefined') {
- unifiedSearchMode = '';
-}
-
var termSelectorFactory;
var termManager;
var resultManager;
this.plCache = {};
this.invCache = {};
- if (unifiedSearchMode == 'invoice') {
+ if (window.unifiedSearchExternalMode) {
+
+ // external user will define result types and handlers
} else {
- this.result_types = {
- "lineitem": {
- "search_options": {
- "flesh_attrs": true,
- "flesh_cancel_reason": true,
- "flesh_notes": true
+ this.result_types = {
+ "lineitem": {
+ "search_options": {
+ "flesh_attrs": true,
+ "flesh_cancel_reason": true,
+ "flesh_notes": true
+ },
+ "revealer": function() {
+ self.liPager.show();
+ progressDialog.show(true);
+ },
+ "finisher": function() {
+ self.liPager.batch_length = self.count_results;
+ self.liPager.relabelControls();
+ self.liPager.enableControls(true);
+ progressDialog.hide();
+ },
+ "adder": function(li) {
+ self.liPager.liTable.addLineitem(li);
+ },
+ "interface": self.liPager
},
- "revealer": function() {
- self.liPager.show();
- progressDialog.show(true);
+ "purchase_order": {
+ "search_options": {
+ "no_flesh_cancel_reason": true
+ },
+ "revealer": function() {
+ self.poGrid.resetStore();
+ self.poGrid.showLoadProgressIndicator();
+ self.poCache = {};
+ },
+ "finisher": function() {
+ self.poGrid.hideLoadProgressIndicator();
+ },
+ "adder": function(po) {
+ self.poCache[po.id()] = po;
+ self.poGrid.store.newItem(acqpo.toStoreItem(po));
+ },
+ "interface": self.poGrid
},
- "finisher": function() {
- self.liPager.batch_length = self.count_results;
- self.liPager.relabelControls();
- self.liPager.enableControls(true);
- progressDialog.hide();
- },
- "adder": function(li) {
- self.liPager.liTable.addLineitem(li);
- },
- "interface": self.liPager
- },
- "purchase_order": {
- "search_options": {
- "no_flesh_cancel_reason": true
- },
- "revealer": function() {
- self.poGrid.resetStore();
- self.poGrid.showLoadProgressIndicator();
- self.poCache = {};
- },
- "finisher": function() {
- self.poGrid.hideLoadProgressIndicator();
- },
- "adder": function(po) {
- self.poCache[po.id()] = po;
- self.poGrid.store.newItem(acqpo.toStoreItem(po));
- },
- "interface": self.poGrid
- },
- "picklist": {
- "search_options": {
- "flesh_lineitem_count": true,
- "flesh_owner": true
+ "picklist": {
+ "search_options": {
+ "flesh_lineitem_count": true,
+ "flesh_owner": true
+ },
+ "revealer": function() {
+ self.plGrid.resetStore();
+ self.plGrid.showLoadProgressIndicator();
+ self.plCache = {};
+ },
+ "finisher": function() {
+ self.plGrid.hideLoadProgressIndicator();
+ },
+ "adder": function(pl) {
+ self.plCache[pl.id()] = pl;
+ self.plGrid.store.newItem(acqpl.toStoreItem(pl));
+ },
+ "interface": self.plGrid
},
- "revealer": function() {
- self.plGrid.resetStore();
- self.plGrid.showLoadProgressIndicator();
- self.plCache = {};
+ "invoice": {
+ "search_options": {
+ "no_flesh_misc": true
+ },
+ "finisher": function() {
+ self.invGrid.hideLoadProgressIndicator();
+ },
+ "revealer": function() {
+ self.invGrid.resetStore();
+ self.invCache = {};
+ },
+ "adder": function(inv) {
+ self.invCache[inv.id()] = inv;
+ self.invGrid.store.newItem(acqinv.toStoreItem(inv));
+ },
+ "interface": self.invGrid
},
- "finisher": function() {
- self.plGrid.hideLoadProgressIndicator();
- },
- "adder": function(pl) {
- self.plCache[pl.id()] = pl;
- self.plGrid.store.newItem(acqpl.toStoreItem(pl));
- },
- "interface": self.plGrid
- },
- "invoice": {
- "search_options": {
- "no_flesh_misc": true
- },
- "finisher": function() {
- self.invGrid.hideLoadProgressIndicator();
- },
- "revealer": function() {
- self.invGrid.resetStore();
- self.invCache = {};
- },
- "adder": function(inv) {
- self.invCache[inv.id()] = inv;
- self.invGrid.store.newItem(acqinv.toStoreItem(inv));
- },
- "interface": self.invGrid
- },
- "no_results": {
- "revealer": function() { alert(localeStrings.NO_RESULTS); }
+ "no_results": {
+ "revealer": function() { alert(localeStrings.NO_RESULTS); }
+ }
}
- }
};
this._dataLoader = function(opts) {
this.go = function(search_object) {
- if (unifiedSearchMode == 'invoice') { // TODO: s/invoice/inline/ or some such
+ if (window.unifiedSearchExternalMode) {
+ // assume for now that external mode implies inline results display
+
uriManager = new URIManager();
uriManager.search_object = search_object;
uriManager.result_type = dojo.byId("acq-unified-result-type").getValue();
openils.Util.addOnLoad(
function() {
- // onload handled by invoice UI
- if (unifiedSearchMode == 'invoice') return;
+ // onload handled by external user
+ if (window.unifiedSearchExternalMode) return;
termManager = new TermManager();