]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/javascript/lib/js/opac/config.js
web work
[working/Evergreen.git] / Open-ILS / src / javascript / lib / js / opac / config.js
1 /* Export some constants  ----------------------------------------------------- */
2
3 /* URL params */
4 var PARAM_TERM                                  = "term";               /* search term */
5 var PARAM_STYPE                         = "stype";              /* search type */
6 var PARAM_LOCATION                      = "location"    /* current location */;
7 var PARAM_DEPTH                         = "depth";              /* search depth */
8 var PARAM_FORM                                  = "format";             /* search format */
9 var PARAM_OFFSET                                = "offset";             /* search offset */
10 var PARAM_COUNT                         = "count";              /* hits per page */
11 var PARAM_HITCOUNT                      = "hitcount";   /* hits per page */
12 var PARAM_RANKS                         = "hitcount";   /* hits per page */
13 var PARAM_MRID                                  = "mrid";               /* metarecord id */
14 var PARAM_RID                                   = "rid";                        /* metarecord id */
15
16 /* cookies */
17 var COOKIE_SB = "sbe";
18 var COOKIE_SES = "ses";
19
20 /* these are the actual param values - set on page load */
21
22 /* pages */
23 var MRESULT             = "mresult";
24 var RRESULT             = "rresult";
25 var RDETAIL             = "rdetail";
26 var MYOPAC              = "myopac";
27 var ADVANCED    = "advanced";
28 var HOME                        = "home";
29
30 /* search type (STYPE) options */
31 STYPE_AUTHOR    = "author";
32 STYPE_TITLE             = "title";
33 STYPE_SUBJECT   = "subject";
34 STYPE_SERIES    = "series";
35 STYPE_KEYWORD   = "keyword";
36
37
38 /* container for global variables shared accross pages */
39 var G           = {};
40 G.user  = null; /* global user object */
41 G.ui            = {} /* cache of UI components */
42
43
44 /* call me after page init and I will load references 
45         to all of the ui object id's defined below 
46         They will be stored in G.ui.<page>.<thingy>
47  */
48 function loadUIObjects() {
49         for( var p in config.ids ) {
50                 G.ui[p] = {};
51                 for( var o in config.ids[p] ) 
52                         G.ui[p][o] = getId(config.ids[p][o]);
53         }
54 }
55
56 /* try our best to free memory */
57 function clearUIObjects() {
58         for( var p in config.ids ) {
59                 for( var o in config.ids[p] ) {
60                         if(G.ui[p][o]) {
61                                 G.ui[p][o].onclick = null;
62                                 G.ui[p][o].onkeydown = null;
63                                 G.ui[p][o] = null;
64                         }
65                 }
66                 G.ui[p] = null;
67         }
68 }
69
70
71
72 /* ---------------------------------------------------------------------------- */
73 /* Set up ID's and CSS classes */
74 /* ---------------------------------------------------------------------------- */
75
76 var config = {};
77 config.text = {};
78 config.ids = {};
79 config.names = {};
80
81 config.ids.common = {};
82 config.ids.common.loading               = "loading_div";                /* generic 'loading..' message */
83 config.ids.common.canvas                = "canvas";                             /* outer UI canvas that holds the main canvas and any other hidden help components*/    
84 config.ids.common.canvas_main   = "canvas_main";                /* main data display canvas */
85 config.ids.common.org_tree              = "org_tree";                   /* org tree selector thingy */
86 config.ids.common.org_container = "org_container";                      /* org tree selector thingy */
87
88 config.css = {};
89 config.css.hide_me = "hide_me";
90 config.css.color_1 = "color_1";
91 config.css.color_2 = "color_2";
92 config.css.color_3 = "color_3";
93
94 config.page = {};
95 config.page[HOME]                       = "/webxml/index.xml";
96 config.page[ADVANCED]   = "/webxml/advanced.xml";
97 config.page[MRESULT]            = "/webxml/mresult.xml";
98 config.page[RRESULT]            = "/webxml/rresult.xml";
99 config.page[MYOPAC]             = "/webxml/myopac/index.xml";
100 config.page[RDETAIL]            = "/webxml/rdetail.xml";
101
102
103 /* mresult */
104 config.ids.mresult = {};
105
106 /* result */
107 config.ids.result = {};
108 config.css.result = {};
109 config.names.result = {};
110 config.ids.result.offset_start  = "offset_start";
111 config.ids.result.offset_end            = "offset_end";
112 config.ids.result.result_count  = "result_count";
113 config.ids.result.next_link             = 'next_link';
114 config.ids.result.prev_link             = 'prev_link';
115 config.ids.result.home_link             = 'home_link';
116 config.ids.result.end_link                      = 'end_link';
117 config.ids.result.main_table            = 'result_table';
118 config.ids.result.row_template  = 'result_table_template';
119 config.ids.result.num_pages             = 'num_pages';
120 config.ids.result.current_page  = 'current_page';
121 config.css.result.nav_active            = "nav_link_active";
122 config.ids.result.top_div                       = "result_table_div";
123 config.ids.result.nav_links             = "search_nav_links";
124 config.ids.result.info                          = "result_info_div";
125
126 config.names.result.item_jacket = "item_jacket";
127 config.names.result.item_title  = "item_title";
128 config.names.result.item_author = "item_author";
129 config.names.result.counts_row  = "counts_row";
130 config.names.result.count_cell  = "copy_count_cell";
131
132 /* login page */
133 config.ids.login = {};
134 config.css.login = {};
135 config.ids.login.box                    = "login_box";
136 config.ids.login.username       = "login_username";
137 config.ids.login.password       = "login_password";
138 config.ids.login.button         = "login_button";
139 config.ids.login.cancel         = "login_cancel_button";
140
141
142
143 /* searchbar ids and css */
144 config.ids.searchbar = {};
145 config.css.searchbar = {};
146 config.ids.searchbar.text                               = 'search_box'; 
147 config.ids.searchbar.submit                     = 'search_submit';      
148 config.ids.searchbar.type_selector      = 'search_type_selector';
149 config.ids.searchbar.depth_selector     = 'depth_selector';
150 config.ids.searchbar.form_selector      = 'form_selector';
151 config.ids.searchbar.extra_row          = 'searchbar_extra';
152 config.ids.searchbar.main_row                   = 'searchbar_main_row';
153 config.ids.searchbar.table                              = 'searchbar_table';
154 config.ids.searchbar.tag                                = 'search_tag_link';
155 config.ids.searchbar.tag_on                     = 'searchbar_tag_on';
156 config.ids.searchbar.tag_off                    = 'searchbar_tag_off';
157 config.ids.searchbar.location_tag       = 'search_location_tag_link';
158
159
160 /*  sidebar */
161 config.ids.sidebar = {};
162 config.css.sidebar = {};
163 config.names.sidebar = {};
164 config.css.sidebar.item = {};
165 config.ids.sidebar.home                         = 'home_link_div';
166 config.ids.sidebar.advanced             = 'advanced_link_div';
167 config.ids.sidebar.myopac                       = 'myopac_link_div';
168 config.ids.sidebar.prefs                        = 'prefs_link_div';
169 config.ids.sidebar.mresult                      = 'mresult_link_div';
170 config.ids.sidebar.rresult                      = 'result_link_div';
171 config.ids.sidebar.login                        = 'login_link';
172 config.ids.sidebar.logout                       = 'logout_link';
173 config.ids.sidebar.logoutbox            = 'logout_link_div';
174 config.ids.sidebar.loginbox             = 'login_link_div';
175 config.ids.sidebar.logged_in_as = 'logged_in_as_div';
176 config.ids.sidebar.username_dest        = 'username_dest';
177 config.ids.sidebar.subject                      = 'subject_sidebar';
178 config.ids.sidebar.subject_item = 'subject_item';
179 config.ids.sidebar.author                       = 'author_sidebar';
180 config.ids.sidebar.author_item  = 'author_item';
181 config.ids.sidebar.series                       = 'series_sidebar';
182 config.ids.sidebar.series_item  = 'series_item';
183
184 config.names.sidebar.subject_item       = 'subject_item';
185 config.names.sidebar.author_item        = 'author_item';
186 config.names.sidebar.series_item        = 'series_item';
187
188
189
190 /* ---------------------------------------------------------------------------- */
191 /* These are pages that may replace the canvas */
192 /* ---------------------------------------------------------------------------- */
193 config.ids.altcanvas = {};
194 config.ids.altcanvas.login              = config.ids.login.box;
195 config.ids.altcanvas.org_tree    = config.ids.common.org_container;
196
197
198
199 /* ---------------------------------------------------------------------------- */
200 /* Methods are defined as service:method 
201         An optional 3rd component is when a method is followed by a :1, such methods
202         have a staff counterpart and should have ".staff" appended to the method 
203         before the method is called when in XUL mode */
204
205 var FETCH_MRCOUNT                               = "open-ils.search:open-ils.search.biblio.class.count:1";
206 var FETCH_MRIDS                         = "open-ils.search:open-ils.search.biblio.class:1";
207 var FETCH_MRMODS                                = "open-ils.search:open-ils.search.biblio.metarecord.mods_slim.retrieve";
208 var FETCH_MR_COPY_COUNTS        = "open-ils.search:open-ils.search.biblio.metarecord.copy_count:1";
209 var FETCH_RIDS                                  = "open-ils.search:open-ils.search.biblio.metarecord_to_records:1";
210 var FETCH_RMODS                         = "open-ils.search:open-ils.search.biblio.record.mods_slim.retrieve";
211 var FETCH_R_COPY_COUNTS         = "open-ils.search:open-ils.search.biblio.record.copy_count";
212 var FETCH_FLESHED_USER          = "open-ils.actor:open-ils.actor.user.fleshed.retrieve";
213 var FETCH_SESSION                               = "open-ils.auth:open-ils.auth.session.retrieve";
214 var LOGIN_INIT                                  = "open-ils.auth:open-ils.auth.authenticate.init";
215 var LOGIN_COMPLETE                      = "open-ils.auth:open-ils.auth.authenticate.complete";
216 var LOGIN_DELETE                                = "open-ils.auth:open-ils.auth.session.delete";
217 /* ---------------------------------------------------------------------------- */
218
219
220
221
222