]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/server/circ/util.js
do not repeat yourself ;)
[Evergreen.git] / Open-ILS / xul / staff_client / server / circ / util.js
1 dump('entering circ/util.js\n');
2
3 if (typeof circ == 'undefined') var circ = {};
4 circ.util = {};
5
6 circ.util.EXPORT_OK     = [ 
7         'columns'
8 ];
9 circ.util.EXPORT_TAGS   = { ':all' : circ.util.EXPORT_OK };
10
11 circ.util.columns = function(modify) {
12         
13         function getString(s) { return obj.OpenILS.data.entities[s]; }
14
15         var c = [
16                 {
17                         'id' : 'acp_id', 'label' : getString('staff.acp_label_id'), 'flex' : 1,
18                         'primary' : false, 'hidden' : true, 'render' : 'my.acp.id()'
19                 },
20                 {
21                         'id' : 'circ_id', 'label' : getString('staff.circ_label_id'), 'flex' : 1,
22                         'primary' : false, 'hidden' : true, 'render' : 'my.circ.id()'
23                 },
24                 {
25                         'id' : 'mvr_doc_id', 'label' : getString('staff.mvr_label_doc_id'), 'flex' : 1,
26                         'primary' : false, 'hidden' : true, 'render' : 'my.mvr.doc_id()'
27                 },
28                 {
29                         'id' : 'barcode', 'label' : getString('staff.acp_label_barcode'), 'flex' : 1,
30                         'primary' : false, 'hidden' : true, 'render' : 'my.acp.barcode()'
31                 },
32                 {
33                         'id' : 'call_number', 'label' : getString('staff.acp_label_call_number'), 'flex' : 1,
34                         'primary' : false, 'hidden' : true, 'render' : 'my.acp.call_number()'
35                 },
36                 {
37                         'id' : 'copy_number', 'label' : getString('staff.acp_label_copy_number'), 'flex' : 1,
38                         'primary' : false, 'hidden' : true, 'render' : 'my.acp.copy_number()'
39                 },
40                 {
41                         'id' : 'location', 'label' : getString('staff.acp_label_location'), 'flex' : 1,
42                         'primary' : false, 'hidden' : true, 'render' : 'my.acp.location()'
43                 },
44                 {
45                         'id' : 'loan_duration', 'label' : getString('staff.acp_label_loan_duration'), 'flex' : 1,
46                         'primary' : false, 'hidden' : true, 'render' : 'my.acp.loan_duration()'
47                 },
48                 {
49                         'id' : 'circ_lib', 'label' : getString('staff.acp_label_circ_lib'), 'flex' : 1,
50                         'primary' : false, 'hidden' : true, 'render' : 'my.acp.circ_lib()'
51                 },
52                 {
53                         'id' : 'fine_level', 'label' : getString('staff.acp_label_fine_level'), 'flex' : 1,
54                         'primary' : false, 'hidden' : true, 'render' : 'my.acp.fine_level()'
55                 },
56                 {
57                         'id' : 'deposit', 'label' : getString('staff.acp_label_deposit'), 'flex' : 1,
58                         'primary' : false, 'hidden' : true, 'render' : 'my.acp.deposit()'
59                 },
60                 {
61                         'id' : 'deposit_amount', 'label' : getString('staff.acp_label_deposit_amount'), 'flex' : 1,
62                         'primary' : false, 'hidden' : true, 'render' : 'my.acp.deposit_amount()'
63                 },
64                 {
65                         'id' : 'price', 'label' : getString('staff.acp_label_price'), 'flex' : 1,
66                         'primary' : false, 'hidden' : true, 'render' : 'my.acp.price()'
67                 },
68                 {
69                         'id' : 'circ_as_type', 'label' : getString('staff.acp_label_circ_as_type'), 'flex' : 1,
70                         'primary' : false, 'hidden' : true, 'render' : 'my.acp.circ_as_type()'
71                 },
72                 {
73                         'id' : 'circ_modifier', 'label' : getString('staff.acp_label_circ_modifier'), 'flex' : 1,
74                         'primary' : false, 'hidden' : true, 'render' : 'my.acp.circ_modifier()'
75                 },
76                 {
77                         'id' : 'xact_start', 'label' : getString('staff.circ_label_xact_start'), 'flex' : 1,
78                         'primary' : false, 'hidden' : true, 'render' : 'my.circ.xact_start()'
79                 },
80                 {
81                         'id' : 'xact_finish', 'label' : getString('staff.circ_label_xact_finish'), 'flex' : 1,
82                         'primary' : false, 'hidden' : true, 'render' : 'my.circ.xact_finish()'
83                 },
84                 {
85                         'id' : 'due_date', 'label' : getString('staff.circ_label_due_date'), 'flex' : 1,
86                         'primary' : false, 'hidden' : true, 'render' : 'my.circ.due_date().substr(0,10)'
87                 },
88                 {
89                         'id' : 'title', 'label' : getString('staff.mvr_label_title'), 'flex' : 2,
90                         'primary' : false, 'hidden' : true, 'render' : 'my.mvr.title()'
91                 },
92                 {
93                         'id' : 'author', 'label' : getString('staff.mvr_label_author'), 'flex' : 1,
94                         'primary' : false, 'hidden' : true, 'render' : 'my.mvr.author()'
95                 },
96                 {
97                         'id' : 'renewal_remaining', 'label' : getString('staff.circ_label_renewal_remaining'), 'flex' : 0,
98                         'primary' : false, 'hidden' : true, 'render' : 'my.circ.renewal_remaining()'
99                 },
100                 {
101                         'id' : 'status', 'label' : getString('staff.acp_label_status'), 'flex' : 1,
102                         'primary' : false, 'hidden' : true, 'render' : 'obj.OpenILS.data.hash.ccs[ my.acp.status() ].name()'
103                 },
104         ];
105         for (var i = 0; i < c.length; c++) {
106                 if (modify[ c[i].id ]) {
107                         for (var j in modify) {
108                                 c[i][j] = modify[j];
109                         }
110                 }
111         }
112         return c;
113 }
114
115 dump('exiting circ/util.js\n');