]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/javascript/lib/js/opac/config.js
made the sidebar display code more generic
[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 var COOKIE_IDS  = "ids";
20
21 /* these are the actual param values - set on page load */
22
23 /* pages */
24 var MRESULT             = "mresult";
25 var RRESULT             = "rresult";
26 var RDETAIL             = "rdetail";
27 var MYOPAC              = "myopac";
28 var ADVANCED    = "advanced";
29 var HOME                        = "home";
30
31 /* search type (STYPE) options */
32 STYPE_AUTHOR    = "author";
33 STYPE_TITLE             = "title";
34 STYPE_SUBJECT   = "subject";
35 STYPE_SERIES    = "series";
36 STYPE_KEYWORD   = "keyword";
37
38
39 /* container for global variables shared accross pages */
40 var G           = {};
41 G.user  = null; /* global user object */
42 G.ui            = {} /* cache of UI components */
43
44
45 /* call me after page init and I will load references 
46         to all of the ui object id's defined below 
47         They will be stored in G.ui.<page>.<thingy>
48  */
49 function loadUIObjects() {
50         for( var p in config.ids ) {
51                 G.ui[p] = {};
52                 for( var o in config.ids[p] ) 
53                         G.ui[p][o] = getId(config.ids[p][o]);
54         }
55 }
56
57 /* try our best to free memory */
58 function clearUIObjects() {
59         for( var p in config.ids ) {
60                 for( var o in config.ids[p] ) {
61                         if(G.ui[p][o]) {
62                                 G.ui[p][o].onclick = null;
63                                 G.ui[p][o].onkeydown = null;
64                                 G.ui[p][o] = null;
65                         }
66                 }
67                 G.ui[p] = null;
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";                
83 config.ids.common.canvas                = "canvas";                             
84 config.ids.common.canvas_main   = "canvas_main";                
85 config.ids.common.org_tree              = "org_tree";                   
86 config.ids.common.org_container = "org_container";
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 /* 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 /* searchbar ids and css */
142 config.ids.searchbar = {};
143 config.css.searchbar = {};
144 config.ids.searchbar.text                               = 'search_box'; 
145 config.ids.searchbar.submit                     = 'search_submit';      
146 config.ids.searchbar.type_selector      = 'search_type_selector';
147 config.ids.searchbar.depth_selector     = 'depth_selector';
148 config.ids.searchbar.form_selector      = 'form_selector';
149 config.ids.searchbar.extra_row          = 'searchbar_extra';
150 config.ids.searchbar.main_row                   = 'searchbar_main_row';
151 config.ids.searchbar.table                              = 'searchbar_table';
152 config.ids.searchbar.tag                                = 'search_tag_link';
153 config.ids.searchbar.tag_on                     = 'searchbar_tag_on';
154 config.ids.searchbar.tag_off                    = 'searchbar_tag_off';
155 config.ids.searchbar.location_tag       = 'search_location_tag_link';
156
157
158 /*  sidebar */
159 config.ids.sidebar = {};
160 config.css.sidebar = {};
161 config.names.sidebar = {};
162 config.css.sidebar.item = {};
163 config.ids.sidebar.home                         = 'home_link_div';
164 config.ids.sidebar.advanced             = 'advanced_link_div';
165 config.ids.sidebar.myopac                       = 'myopac_link_div';
166 config.ids.sidebar.prefs                        = 'prefs_link_div';
167 config.ids.sidebar.mresult                      = 'mresult_link_div';
168 config.ids.sidebar.rresult                      = 'result_link_div';
169 config.ids.sidebar.login                        = 'login_link';
170 config.ids.sidebar.logout                       = 'logout_link';
171 config.ids.sidebar.logoutbox            = 'logout_link_div';
172 config.ids.sidebar.loginbox             = 'login_link_div';
173 config.ids.sidebar.logged_in_as = 'logged_in_as_div';
174 config.ids.sidebar.username_dest        = 'username_dest';
175 config.ids.sidebar.subject                      = 'subject_sidebar';
176 config.ids.sidebar.subject_item = 'subject_item';
177 config.ids.sidebar.author                       = 'author_sidebar';
178 config.ids.sidebar.author_item  = 'author_item';
179 config.ids.sidebar.series                       = 'series_sidebar';
180 config.ids.sidebar.series_item  = 'series_item';
181
182 config.names.sidebar.subject_item       = 'subject_item';
183 config.names.sidebar.author_item        = 'author_item';
184 config.names.sidebar.series_item        = 'series_item';
185
186
187
188 /* ---------------------------------------------------------------------------- */
189 /* These are pages that may replace the canvas */
190 /* ---------------------------------------------------------------------------- */
191 config.ids.altcanvas = {};
192 config.ids.altcanvas.login              = config.ids.login.box;
193 config.ids.altcanvas.org_tree    = config.ids.common.org_container;
194
195
196
197 /* ---------------------------------------------------------------------------- */
198 /* Methods are defined as service:method 
199         An optional 3rd component is when a method is followed by a :1, such methods
200         have a staff counterpart and should have ".staff" appended to the method 
201         before the method is called when in XUL mode */
202
203 var FETCH_MRCOUNT                               = "open-ils.search:open-ils.search.biblio.class.count:1";
204 var FETCH_MRIDS                         = "open-ils.search:open-ils.search.biblio.class:1";
205 var FETCH_MRIDS_FULL                    = "open-ils.search:open-ils.search.biblio.class.full:1";
206 var FETCH_MRMODS                                = "open-ils.search:open-ils.search.biblio.metarecord.mods_slim.retrieve";
207 var FETCH_MR_COPY_COUNTS        = "open-ils.search:open-ils.search.biblio.metarecord.copy_count:1";
208 var FETCH_RIDS                                  = "open-ils.search:open-ils.search.biblio.metarecord_to_records:1";
209 var FETCH_RMODS                         = "open-ils.search:open-ils.search.biblio.record.mods_slim.retrieve";
210 var FETCH_R_COPY_COUNTS         = "open-ils.search:open-ils.search.biblio.record.copy_count";
211 var FETCH_FLESHED_USER          = "open-ils.actor:open-ils.actor.user.fleshed.retrieve";
212 var FETCH_SESSION                               = "open-ils.auth:open-ils.auth.session.retrieve";
213 var LOGIN_INIT                                  = "open-ils.auth:open-ils.auth.authenticate.init";
214 var LOGIN_COMPLETE                      = "open-ils.auth:open-ils.auth.authenticate.complete";
215 var LOGIN_DELETE                                = "open-ils.auth:open-ils.auth.session.delete";
216 /* ---------------------------------------------------------------------------- */
217
218
219
220
221