]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/web/opac/skin/default/js/container.js
Don't hardcode our password forms to en-US
[working/Evergreen.git] / Open-ILS / web / opac / skin / default / js / container.js
1
2 function containerDoRequest( req, callback, args ) {
3
4         if( callback ) {
5                 req.callback( callback );
6                 req.request.args = args;
7                 req.send();
8                 return null;
9         }
10
11         req.send(true); 
12         return req.result();
13 }
14
15
16 function containerFetchAll( callback, args ) {
17         var req = new Request( 
18                 FETCH_CONTAINERS, G.user.session, G.user.id(), 'biblio', 'bookbag' );
19         return containerDoRequest( req, callback, args );
20 }
21
22 function containerFlesh( id, callback, args ) {
23         var req = new Request( FLESH_CONTAINER, G.user.session, 'biblio', id );
24         return containerDoRequest( req, callback, args );
25 }
26
27 function containerDelete( id, callback, args ) {
28         var req = new Request( DELETE_CONTAINER, G.user.session, 'biblio', id );
29         return containerDoRequest(req, callback, args );
30 }
31
32
33 function containerCreate( name, pub, callback, args ) {
34
35         var container = new cbreb();
36         container.btype('bookbag');
37         container.owner( G.user.id() );
38         container.name( name );
39         if(pub) container.pub('t');
40         else container.pub('f');
41
42         var req = new Request( 
43                 CREATE_CONTAINER, G.user.session, 'biblio', container );
44         return containerDoRequest( req, callback, args );
45 }
46
47 function containerUpdate( container, callback, args ) {
48         var req = new Request(UPDATE_CONTAINER, G.user.session, 'biblio', container);
49         return containerDoRequest(req, callback, args);
50 }
51
52 function containerCreateItem( containerId, target, callback, args ) {
53
54         var item = new cbrebi();
55         item.target_biblio_record_entry(target);
56         item.bucket(containerId);
57
58         var req = new Request( CREATE_CONTAINER_ITEM, 
59                 G.user.session, 'biblio', item );
60
61         return containerDoRequest( req, callback, args );
62 }
63
64 function containerRemoveItem( id, callback, args ) {
65         var req = new Request( DELETE_CONTAINER_ITEM, G.user.session, 'biblio', id );
66         return containerDoRequest( req, callback, args );
67 }