]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/javascript/lib/js/opac/config.js
more 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] = null;
63                         }
64                 }
65                 G.ui[p] = null;
66         }
67 }
68
69
70
71 /* ---------------------------------------------------------------------------- */
72 /* Set up ID's and CSS classes */
73 /* ---------------------------------------------------------------------------- */
74
75 var config = {};
76 config.text = {};
77 config.ids = {};
78 config.names = {};
79
80 config.ids.common = {};
81 config.ids.common.loading               = "loading_div";                /* generic 'loading..' message */
82 config.ids.common.canvas                = "canvas";                             /* outer UI canvas that holds the main canvas and any other hidden help components*/    
83 config.ids.common.canvas_main   = "canvas_main";                /* main data display canvas */
84 config.ids.common.org_tree              = "org_tree";                   /* org tree selector thingy */
85 config.ids.common.org_container = "org_container";                      /* org tree selector thingy */
86
87 config.css = {};
88 config.css.hide_me = "hide_me";
89 config.css.color_1 = "color_1";
90 config.css.color_2 = "color_2";
91 config.css.color_3 = "color_3";
92
93 config.page = {};
94 config.page[HOME]                       = "/webxml/index.xml";
95 config.page[ADVANCED]   = "/webxml/advanced.xml";
96 config.page[MRESULT]            = "/webxml/mresult.xml";
97 config.page[RRESULT]            = "/webxml/rresult.xml";
98 config.page[MYOPAC]             = "/webxml/myopac/index.xml";
99 config.page[RDETAIL]            = "/webxml/rdetail.xml";
100
101
102 /* mresult */
103 config.ids.mresult = {};
104
105 /* result */
106 config.ids.result = {};
107 config.css.result = {};
108 config.names.result = {};
109 config.ids.result.offset_start  = "offset_start";
110 config.ids.result.offset_end            = "offset_end";
111 config.ids.result.result_count  = "result_count";
112 config.ids.result.next_link             = 'next_link';
113 config.ids.result.prev_link             = 'prev_link';
114 config.ids.result.home_link             = 'home_link';
115 config.ids.result.end_link                      = 'end_link';
116 config.ids.result.main_table            = 'result_table';
117 config.ids.result.row_template  = 'result_table_template';
118 config.ids.result.num_pages             = 'num_pages';
119 config.ids.result.current_page  = 'current_page';
120 config.css.result.nav_active            = "nav_link_active";
121 config.ids.result.top_div                       = "result_table_div";
122 config.ids.result.nav_links             = "search_nav_links";
123 config.ids.result.info                          = "result_info_div";
124
125 config.names.result.item_jacket = "item_jacket";
126 config.names.result.item_title  = "item_title";
127 config.names.result.item_author = "item_author";
128 config.names.result.counts_row  = "counts_row";
129 config.names.result.count_cell  = "copy_count_cell";
130
131 /* login page */
132 config.ids.login = {};
133 config.css.login = {};
134 config.ids.login.box                    = "login_box";
135 config.ids.login.username       = "login_username";
136 config.ids.login.password       = "login_password";
137 config.ids.login.button         = "login_button";
138 config.ids.login.cancel         = "login_cancel_button";
139
140
141
142 /* searchbar ids and css */
143 config.ids.searchbar = {};
144 config.css.searchbar = {};
145 config.ids.searchbar.text                               = 'search_box'; 
146 config.ids.searchbar.submit                     = 'search_submit';      
147 config.ids.searchbar.type_selector      = 'search_type_selector';
148 config.ids.searchbar.depth_selector     = 'depth_selector';
149 config.ids.searchbar.form_selector      = 'form_selector';
150 config.ids.searchbar.extra_row          = 'searchbar_extra';
151 config.ids.searchbar.main_row                   = 'searchbar_main_row';
152 config.ids.searchbar.table                              = 'searchbar_table';
153 config.ids.searchbar.tag                                = 'search_tag_link';
154 config.ids.searchbar.tag_on                     = 'searchbar_tag_on';
155 config.ids.searchbar.tag_off                    = 'searchbar_tag_off';
156 config.ids.searchbar.location_tag       = 'search_location_tag_link';
157
158
159 /*  sidebar */
160 config.ids.sidebar = {};
161 config.css.sidebar = {};
162 config.names.sidebar = {};
163 config.css.sidebar.item = {};
164 config.ids.sidebar.home                         = 'home_link_div';
165 config.ids.sidebar.advanced             = 'advanced_link_div';
166 config.ids.sidebar.myopac                       = 'myopac_link_div';
167 config.ids.sidebar.prefs                        = 'prefs_link_div';
168 config.ids.sidebar.mresult                      = 'mresult_link_div';
169 config.ids.sidebar.rresult                      = 'result_link_div';
170 config.ids.sidebar.login                        = 'login_link';
171 config.ids.sidebar.logout                       = 'logout_link';
172 config.ids.sidebar.logoutbox            = 'logout_link_div';
173 config.ids.sidebar.loginbox             = 'login_link_div';
174 config.ids.sidebar.logged_in_as = 'logged_in_as_div';
175 config.ids.sidebar.username_dest        = 'username_dest';
176 config.ids.sidebar.subject                      = 'subject_sidebar';
177
178 config.names.sidebar.subject            = "subject_item";
179
180
181
182 /* ---------------------------------------------------------------------------- */
183 /* These are pages that may replace the canvas */
184 /* ---------------------------------------------------------------------------- */
185 config.ids.altcanvas = {};
186 config.ids.altcanvas.login              = config.ids.login.box;
187 config.ids.altcanvas.org_tree    = config.ids.common.org_container;
188
189
190
191 /* ---------------------------------------------------------------------------- */
192 /* Methods are defined as service:method 
193         An optional 3rd component is when a method is followed by a :1, such methods
194         have a staff counterpart and should have ".staff" appended to the method 
195         before the method is called when in XUL mode */
196
197 var FETCH_MRCOUNT                               = "open-ils.search:open-ils.search.biblio.class.count:1";
198 var FETCH_MRIDS                         = "open-ils.search:open-ils.search.biblio.class:1";
199 var FETCH_MRMODS                                = "open-ils.search:open-ils.search.biblio.metarecord.mods_slim.retrieve";
200 var FETCH_MR_COPY_COUNTS        = "open-ils.search:open-ils.search.biblio.metarecord.copy_count:1";
201 var FETCH_RIDS                                  = "open-ils.search:open-ils.search.biblio.metarecord_to_records:1";
202 var FETCH_RMODS                         = "open-ils.search:open-ils.search.biblio.record.mods_slim.retrieve";
203 var FETCH_R_COPY_COUNTS         = "open-ils.search:open-ils.search.biblio.record.copy_count";
204 var FETCH_FLESHED_USER          = "open-ils.actor:open-ils.actor.user.fleshed.retrieve";
205 var FETCH_SESSION                               = "open-ils.auth:open-ils.auth.session.retrieve";
206 var LOGIN_INIT                                  = "open-ils.auth:open-ils.auth.authenticate.init";
207 var LOGIN_COMPLETE                      = "open-ils.auth:open-ils.auth.authenticate.complete";
208 var LOGIN_DELETE                                = "open-ils.auth:open-ils.auth.session.delete";
209 /* ---------------------------------------------------------------------------- */
210
211
212
213
214