]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/web/js/dojo/openils/acq/LineitemAttr.js
Merging acq-experiment to trunk, since rel_1_4 has been branched.
[working/Evergreen.git] / Open-ILS / web / js / dojo / openils / acq / LineitemAttr.js
1 /* ---------------------------------------------------------------------------
2  * Copyright (C) 2008  Georgia Public Library Service
3  * Bill Erickson <erickson@esilibrary.com>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  * ---------------------------------------------------------------------------
15  */
16 if(!dojo._hasResource['openils.acq.LineitemAttr']) {
17 dojo._hasResource['openils.acq.LineitemAttr'] = true;
18 dojo.provide('openils.acq.LineitemAttr');
19 dojo.require('fieldmapper.dojoData');
20 dojo.require('openils.User');
21 dojo.require('openils.Event');
22
23 /** Declare the LineitemAttr class with dojo */
24 dojo.declare('openils.acq.LineitemAttr', null, {});
25
26 /** Pile of static methods for handling the different types of 
27  * lineitem attributes and definitions
28  */
29
30
31 /**
32  * Creates a set of attr definition stores, one per definition type.
33  */
34 openils.acq.LineitemAttr.createAttrDefStores = function(onload) {
35     function process(r) {
36         var res = r.recv().content();
37         openils.Event.parse_and_raise(res);
38         var stores = {};
39         stores.marc = acqlimad.toStoreData(res.marc);
40         stores.usr = acqliuad.toStoreData(res.usr);
41         stores.local = acqlilad.toStoreData(res.local);
42         stores.generated = acqligad.toStoreData(res.generated);
43         stores.provider = acqlipad.toStoreData(res.provider);
44         onload(stores);
45     }
46
47     fieldmapper.standardRequest(
48         ['open-ils.acq', 'open-ils.acq.lineitem_attr_definition.retrieve.all'],
49         {   async: true,
50             params: [openils.User.authtoken],
51             oncomplete: process
52         }
53     );
54 }
55 }