From: erickson Date: Mon, 21 Apr 2008 17:40:54 +0000 (+0000) Subject: as promised, moving ACQ JS from the Pylons section of the repo into the global JS... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0e21e1aa1c446189796ee88c004829824b8ece72;p=Evergreen.git as promised, moving ACQ JS from the Pylons section of the repo into the global JS area git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@9405 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/js/dojo/openils/acq/CurrencyType.js b/Open-ILS/web/js/dojo/openils/acq/CurrencyType.js new file mode 100644 index 0000000000..c041b3e6c6 --- /dev/null +++ b/Open-ILS/web/js/dojo/openils/acq/CurrencyType.js @@ -0,0 +1,43 @@ +/* --------------------------------------------------------------------------- + * Copyright (C) 2008 Georgia Public Library Service + * Bill Erickson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * --------------------------------------------------------------------------- + */ + +if(!dojo._hasResource["openils.acq.CurrencyType"]) { + + dojo._hasResource["openils.acq.CurrencyType"] = true; + dojo.provide("openils.acq.CurrencyType"); + dojo.declare('openils.acq.CurrencyType', null, { + }); + + openils.acq.CurrencyType.cache = {}; + + /** + * Retrieves all of the currency types + */ + openils.acq.CurrencyType.fetchAll = function(onComplete) { + var req = new OpenSRF.ClientSession('open-ils.acq').request( + 'open-ils.acq.currency_type.all.retrieve', openils.User.authtoken); + + req.oncomplete = function(r) { + var msg = r.recv(); + var types = msg.content(); + for(var i in types) + openils.acq.CurrencyType.cache[types[i].code()] = types[i]; + onComplete(types); + } + req.send(); + } +} + diff --git a/Open-ILS/web/js/dojo/openils/acq/Fund.js b/Open-ILS/web/js/dojo/openils/acq/Fund.js new file mode 100644 index 0000000000..621cac86ec --- /dev/null +++ b/Open-ILS/web/js/dojo/openils/acq/Fund.js @@ -0,0 +1,57 @@ +/* --------------------------------------------------------------------------- + * Copyright (C) 2008 Georgia Public Library Service + * Bill Erickson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * --------------------------------------------------------------------------- + */ + +if(!dojo._hasResource['openils.acq.Fund']) { +dojo._hasResource['openils.acq.Fund'] = true; +dojo.provide('openils.acq.Fund'); +dojo.require('util.Dojo'); + +/** Declare the Fund class with dojo */ +dojo.declare('openils.acq.Fund', null, { + /* add instance methods here if necessary */ +}); + + +openils.acq.Fund.loadGrid = function(domId, columns) { + /** Fetches the list of funds and builds a grid from them */ + + var gridRefs = util.Dojo.buildSimpleGrid(domId, columns, [], 'id', true); + var ses = new OpenSRF.ClientSession('open-ils.acq'); + var req = ses.request('open-ils.acq.fund.org.retrieve', + openils.User.authtoken, null, {flesh_summary:1}); + + req.oncomplete = function(r) { + var msg + gridRefs.grid.setModel(gridRefs.model); + while(msg = r.recv()) { + var fund = msg.content(); + gridRefs.store.newItem({ + id:fund.id(), + name:fund.name(), + org: findOrgUnit(fund.org()).name(), + currency_type:fund.currency_type(), + year:fund.year(), + combined_balance:fund.summary()['combined_balance'] + }); + } + gridRefs.grid.update(); + }; + + req.send(); + return gridRefs.grid; +}; +} + diff --git a/Open-ILS/web/js/dojo/openils/acq/FundingSource.js b/Open-ILS/web/js/dojo/openils/acq/FundingSource.js new file mode 100644 index 0000000000..624bbfd33c --- /dev/null +++ b/Open-ILS/web/js/dojo/openils/acq/FundingSource.js @@ -0,0 +1,125 @@ +/* --------------------------------------------------------------------------- + * Copyright (C) 2008 Georgia Public Library Service + * Bill Erickson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * --------------------------------------------------------------------------- + */ + +if(!dojo._hasResource['openils.acq.FundingSource']) { +dojo._hasResource['openils.acq.FundingSource'] = true; +dojo.provide('openils.acq.FundingSource'); + +/** Declare the FundingSource class with dojo */ +dojo.declare('openils.acq.FundingSource', null, { + /* add instance methods here if necessary */ +}); + +/** cached funding_source objects */ +openils.acq.FundingSource.cache = {}; + +openils.acq.FundingSource.createStore = function(onComplete) { + /** Fetches the list of funding_sources and builds a grid from them */ + var ses = new OpenSRF.ClientSession('open-ils.acq'); + var req = ses.request('open-ils.acq.funding_source.org.retrieve', + openils.User.authtoken, null, {flesh_summary:1}); + + req.oncomplete = function(r) { + var msg + var items = []; + var src = null; + while(msg = r.recv()) { + src = msg.content(); + openils.acq.FundingSource.cache[src.id()] = src; + items.push(src); + } + onComplete(acqfs.toStoreData(items)); + }; + + req.send(); +}; + + + +/** + * Create a new funding source object + * @param fields Key/value pairs used to create the new funding source + */ +openils.acq.FundingSource.create = function(fields, onCreateComplete) { + + var fs = new acqfs() + for(var field in fields) + fs[field](fields[field]); + + var ses = new OpenSRF.ClientSession('open-ils.acq'); + var req = ses.request('open-ils.acq.funding_source.create', openils.User.authtoken, fs); + + req.oncomplete = function(r) { + var msg = r.recv(); + var id = msg.content(); + if(onCreateComplete) + onCreateComplete(id); + }; + req.send(); +}; + + +openils.acq.FundingSource.createCredit = function(fields, onCreateComplete) { + + var fsc = new acqfscred() + for(var field in fields) + fsc[field](fields[field]); + + var ses = new OpenSRF.ClientSession('open-ils.acq'); + var req = ses.request( + 'open-ils.acq.funding_source_credit.create', openils.User.authtoken, fsc); + + req.oncomplete = function(r) { + var msg = r.recv(); + var id = msg.content(); + if(onCreateComplete) + onCreateComplete(id); + }; + req.send(); +}; + + +openils.acq.FundingSource.deleteFromGrid = function(grid, onComplete) { + var list = [] + var selected = grid.selection.getSelected(); + for(var rowIdx in selected) + list.push(grid.model.getDatum(selected[rowIdx], 0)); + openils.acq.FundingSource.deleteList(list, onComplete); +}; + +openils.acq.FundingSource.deleteList = function(list, onComplete) { + openils.acq.FundingSource._deleteList(list, 0, onComplete); +} + +openils.acq.FundingSource._deleteList = function(list, idx, onComplete) { + if(idx >= list.length) + return onComplete(); + + var ses = new OpenSRF.ClientSession('open-ils.acq'); + var req = ses.request('open-ils.acq.funding_source.delete', openils.User.authtoken, list[idx]); + delete openils.acq.FundingSource.cache[list[idx]]; + + req.oncomplete = function(r) { + msg = r.recv() + stat = msg.content(); + /* XXX CHECH FOR EVENT */ + openils.acq.FundingSource._deleteList(list, ++idx, onComplete); + } + req.send(); +}; + + +} /* end dojo._hasResource[] */ diff --git a/Open-ILS/web/js/dojo/openils/acq/Picklist.js b/Open-ILS/web/js/dojo/openils/acq/Picklist.js new file mode 100644 index 0000000000..ad318944c1 --- /dev/null +++ b/Open-ILS/web/js/dojo/openils/acq/Picklist.js @@ -0,0 +1,52 @@ +if(!dojo._hasResource['openils.acq.Picklist']) { +dojo._hasResource['openils.acq.Picklist'] = true; +dojo.provide('openils.acq.Picklist'); +dojo.require('util.Dojo'); + +/** Declare the Picklist class with dojo */ +dojo.declare('openils.acq.Picklist', null, { + /* add instance methods here if necessary */ +}); + + openils.acq.Picklist.find_attr = function(li, at_name, at_type) { + for (var i in li.attributes()) { + var attr = li.attributes()[i]; + if (attr.attr_type() == at_type && attr.attr_name() == at_name) { + return attr.attr_value(); + } + } + return ''; + }; + + + openils.acq.Picklist.loadGrid = function(domId, columns, pl_id) { + /** Fetches the list of picklists and builds a grid from them */ + + var gridRefs = util.Dojo.buildSimpleGrid(domId, columns, [], 'id', true); + var ses = new OpenSRF.ClientSession('open-ils.acq'); + var req = ses.request('open-ils.acq.lineitem.picklist.retrieve', + openils.User.authtoken, pl_id, {flesh_attrs:1}); + + req.oncomplete = function(r) { + var msg + gridRefs.grid.setModel(gridRefs.model); + gridRefs.model.query = {id:'*'}; + while(msg = r.recv()) { + var jub = msg.content(); + //alert(js2JSON(jub)); + gridRefs.store.newItem({ + id:jub.id(), + title:openils.acq.Picklist.find_attr(jub, "title", "lineitem_marc_attr_definition"), + price:openils.acq.Picklist.find_attr(jub, "price", "lineitem_marc_attr_definition"), + provider:jub.provider(), + copies:jub.item_count() + }); + } + gridRefs.grid.update(); + }; + + req.send(); + return gridRefs.grid; +}; +} + diff --git a/Open-ILS/web/js/dojo/openils/acq/Provider.js b/Open-ILS/web/js/dojo/openils/acq/Provider.js new file mode 100644 index 0000000000..523ba854b9 --- /dev/null +++ b/Open-ILS/web/js/dojo/openils/acq/Provider.js @@ -0,0 +1,55 @@ +/* --------------------------------------------------------------------------- + * Copyright (C) 2008 Georgia Public Library Service + * Bill Erickson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * --------------------------------------------------------------------------- + */ + +if(!dojo._hasResource['openils.acq.Provider']) { +dojo._hasResource['openils.acq.Provider'] = true; +dojo.provide('openils.acq.Provider'); +dojo.require('util.Dojo'); + +/** Declare the Provider class with dojo */ +dojo.declare('openils.acq.Provider', null, { + /* add instance methods here if necessary */ +}); + +/* define some static provider methods ------- */ + +openils.acq.Provider.loadGrid = function(domId, columns) { + /** Fetches the list of providers and builds a grid from them */ + + var gridRefs = util.Dojo.buildSimpleGrid(domId, columns, [], 'id', true); + var ses = new OpenSRF.ClientSession('open-ils.acq'); + var req = ses.request('open-ils.acq.provider.org.retrieve', openils.User.authtoken); + + req.oncomplete = function(r) { + var msg + gridRefs.grid.setModel(gridRefs.model); + while(msg = r.recv()) { + var prov = msg.content(); + gridRefs.store.newItem({ + id:prov.id(), + name:prov.name(), + owner: findOrgUnit(prov.owner()).name(), + currency_type:prov.currency_type() + }); + } + gridRefs.grid.update(); + }; + + req.send(); + return gridRefs.grid; +}; +} + diff --git a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/CurrencyType.js b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/CurrencyType.js deleted file mode 100644 index c041b3e6c6..0000000000 --- a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/CurrencyType.js +++ /dev/null @@ -1,43 +0,0 @@ -/* --------------------------------------------------------------------------- - * Copyright (C) 2008 Georgia Public Library Service - * Bill Erickson - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * --------------------------------------------------------------------------- - */ - -if(!dojo._hasResource["openils.acq.CurrencyType"]) { - - dojo._hasResource["openils.acq.CurrencyType"] = true; - dojo.provide("openils.acq.CurrencyType"); - dojo.declare('openils.acq.CurrencyType', null, { - }); - - openils.acq.CurrencyType.cache = {}; - - /** - * Retrieves all of the currency types - */ - openils.acq.CurrencyType.fetchAll = function(onComplete) { - var req = new OpenSRF.ClientSession('open-ils.acq').request( - 'open-ils.acq.currency_type.all.retrieve', openils.User.authtoken); - - req.oncomplete = function(r) { - var msg = r.recv(); - var types = msg.content(); - for(var i in types) - openils.acq.CurrencyType.cache[types[i].code()] = types[i]; - onComplete(types); - } - req.send(); - } -} - diff --git a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Fund.js b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Fund.js deleted file mode 100644 index 621cac86ec..0000000000 --- a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Fund.js +++ /dev/null @@ -1,57 +0,0 @@ -/* --------------------------------------------------------------------------- - * Copyright (C) 2008 Georgia Public Library Service - * Bill Erickson - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * --------------------------------------------------------------------------- - */ - -if(!dojo._hasResource['openils.acq.Fund']) { -dojo._hasResource['openils.acq.Fund'] = true; -dojo.provide('openils.acq.Fund'); -dojo.require('util.Dojo'); - -/** Declare the Fund class with dojo */ -dojo.declare('openils.acq.Fund', null, { - /* add instance methods here if necessary */ -}); - - -openils.acq.Fund.loadGrid = function(domId, columns) { - /** Fetches the list of funds and builds a grid from them */ - - var gridRefs = util.Dojo.buildSimpleGrid(domId, columns, [], 'id', true); - var ses = new OpenSRF.ClientSession('open-ils.acq'); - var req = ses.request('open-ils.acq.fund.org.retrieve', - openils.User.authtoken, null, {flesh_summary:1}); - - req.oncomplete = function(r) { - var msg - gridRefs.grid.setModel(gridRefs.model); - while(msg = r.recv()) { - var fund = msg.content(); - gridRefs.store.newItem({ - id:fund.id(), - name:fund.name(), - org: findOrgUnit(fund.org()).name(), - currency_type:fund.currency_type(), - year:fund.year(), - combined_balance:fund.summary()['combined_balance'] - }); - } - gridRefs.grid.update(); - }; - - req.send(); - return gridRefs.grid; -}; -} - diff --git a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/FundingSource.js b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/FundingSource.js deleted file mode 100644 index 4506efaecb..0000000000 --- a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/FundingSource.js +++ /dev/null @@ -1,126 +0,0 @@ -/* --------------------------------------------------------------------------- - * Copyright (C) 2008 Georgia Public Library Service - * Bill Erickson - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * --------------------------------------------------------------------------- - */ - -if(!dojo._hasResource['openils.acq.FundingSource']) { -dojo._hasResource['openils.acq.FundingSource'] = true; -dojo.provide('openils.acq.FundingSource'); -dojo.require('util.Dojo'); - -/** Declare the FundingSource class with dojo */ -dojo.declare('openils.acq.FundingSource', null, { - /* add instance methods here if necessary */ -}); - -/** cached funding_source objects */ -openils.acq.FundingSource.cache = {}; - -openils.acq.FundingSource.createStore = function(onComplete) { - /** Fetches the list of funding_sources and builds a grid from them */ - var ses = new OpenSRF.ClientSession('open-ils.acq'); - var req = ses.request('open-ils.acq.funding_source.org.retrieve', - openils.User.authtoken, null, {flesh_summary:1}); - - req.oncomplete = function(r) { - var msg - var items = []; - var src = null; - while(msg = r.recv()) { - src = msg.content(); - openils.acq.FundingSource.cache[src.id()] = src; - items.push(src); - } - onComplete(acqfs.toStoreData(items)); - }; - - req.send(); -}; - - - -/** - * Create a new funding source object - * @param fields Key/value pairs used to create the new funding source - */ -openils.acq.FundingSource.create = function(fields, onCreateComplete) { - - var fs = new acqfs() - for(var field in fields) - fs[field](fields[field]); - - var ses = new OpenSRF.ClientSession('open-ils.acq'); - var req = ses.request('open-ils.acq.funding_source.create', openils.User.authtoken, fs); - - req.oncomplete = function(r) { - var msg = r.recv(); - var id = msg.content(); - if(onCreateComplete) - onCreateComplete(id); - }; - req.send(); -}; - - -openils.acq.FundingSource.createCredit = function(fields, onCreateComplete) { - - var fsc = new acqfscred() - for(var field in fields) - fsc[field](fields[field]); - - var ses = new OpenSRF.ClientSession('open-ils.acq'); - var req = ses.request( - 'open-ils.acq.funding_source_credit.create', openils.User.authtoken, fsc); - - req.oncomplete = function(r) { - var msg = r.recv(); - var id = msg.content(); - if(onCreateComplete) - onCreateComplete(id); - }; - req.send(); -}; - - -openils.acq.FundingSource.deleteFromGrid = function(grid, onComplete) { - var list = [] - var selected = grid.selection.getSelected(); - for(var rowIdx in selected) - list.push(grid.model.getDatum(selected[rowIdx], 0)); - openils.acq.FundingSource.deleteList(list, onComplete); -}; - -openils.acq.FundingSource.deleteList = function(list, onComplete) { - openils.acq.FundingSource._deleteList(list, 0, onComplete); -} - -openils.acq.FundingSource._deleteList = function(list, idx, onComplete) { - if(idx >= list.length) - return onComplete(); - - var ses = new OpenSRF.ClientSession('open-ils.acq'); - var req = ses.request('open-ils.acq.funding_source.delete', openils.User.authtoken, list[idx]); - delete openils.acq.FundingSource.cache[list[idx]]; - - req.oncomplete = function(r) { - msg = r.recv() - stat = msg.content(); - /* XXX CHECH FOR EVENT */ - openils.acq.FundingSource._deleteList(list, ++idx, onComplete); - } - req.send(); -}; - - -} /* end dojo._hasResource[] */ diff --git a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Picklist.js b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Picklist.js deleted file mode 100644 index ad318944c1..0000000000 --- a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Picklist.js +++ /dev/null @@ -1,52 +0,0 @@ -if(!dojo._hasResource['openils.acq.Picklist']) { -dojo._hasResource['openils.acq.Picklist'] = true; -dojo.provide('openils.acq.Picklist'); -dojo.require('util.Dojo'); - -/** Declare the Picklist class with dojo */ -dojo.declare('openils.acq.Picklist', null, { - /* add instance methods here if necessary */ -}); - - openils.acq.Picklist.find_attr = function(li, at_name, at_type) { - for (var i in li.attributes()) { - var attr = li.attributes()[i]; - if (attr.attr_type() == at_type && attr.attr_name() == at_name) { - return attr.attr_value(); - } - } - return ''; - }; - - - openils.acq.Picklist.loadGrid = function(domId, columns, pl_id) { - /** Fetches the list of picklists and builds a grid from them */ - - var gridRefs = util.Dojo.buildSimpleGrid(domId, columns, [], 'id', true); - var ses = new OpenSRF.ClientSession('open-ils.acq'); - var req = ses.request('open-ils.acq.lineitem.picklist.retrieve', - openils.User.authtoken, pl_id, {flesh_attrs:1}); - - req.oncomplete = function(r) { - var msg - gridRefs.grid.setModel(gridRefs.model); - gridRefs.model.query = {id:'*'}; - while(msg = r.recv()) { - var jub = msg.content(); - //alert(js2JSON(jub)); - gridRefs.store.newItem({ - id:jub.id(), - title:openils.acq.Picklist.find_attr(jub, "title", "lineitem_marc_attr_definition"), - price:openils.acq.Picklist.find_attr(jub, "price", "lineitem_marc_attr_definition"), - provider:jub.provider(), - copies:jub.item_count() - }); - } - gridRefs.grid.update(); - }; - - req.send(); - return gridRefs.grid; -}; -} - diff --git a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Provider.js b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Provider.js deleted file mode 100644 index 523ba854b9..0000000000 --- a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Provider.js +++ /dev/null @@ -1,55 +0,0 @@ -/* --------------------------------------------------------------------------- - * Copyright (C) 2008 Georgia Public Library Service - * Bill Erickson - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * --------------------------------------------------------------------------- - */ - -if(!dojo._hasResource['openils.acq.Provider']) { -dojo._hasResource['openils.acq.Provider'] = true; -dojo.provide('openils.acq.Provider'); -dojo.require('util.Dojo'); - -/** Declare the Provider class with dojo */ -dojo.declare('openils.acq.Provider', null, { - /* add instance methods here if necessary */ -}); - -/* define some static provider methods ------- */ - -openils.acq.Provider.loadGrid = function(domId, columns) { - /** Fetches the list of providers and builds a grid from them */ - - var gridRefs = util.Dojo.buildSimpleGrid(domId, columns, [], 'id', true); - var ses = new OpenSRF.ClientSession('open-ils.acq'); - var req = ses.request('open-ils.acq.provider.org.retrieve', openils.User.authtoken); - - req.oncomplete = function(r) { - var msg - gridRefs.grid.setModel(gridRefs.model); - while(msg = r.recv()) { - var prov = msg.content(); - gridRefs.store.newItem({ - id:prov.id(), - name:prov.name(), - owner: findOrgUnit(prov.owner()).name(), - currency_type:prov.currency_type() - }); - } - gridRefs.grid.update(); - }; - - req.send(); - return gridRefs.grid; -}; -} -