1 /* Export some constants ----------------------------------------------------- */
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_MRID = "mrid"; /* metarecord id */
13 var PARAM_RID = "rid"; /* record id */
14 var PARAM_ORIGLOC = "orgloc" /* the original location */
16 /* URL param values (see comments above) */
35 var COOKIE_SB = "sbe";
36 var COOKIE_SES = "ses";
37 var COOKIE_IDS = "ids";
38 var COOKIE_FONT = "fnt";
39 var COOKIE_SKIN = "skin";
41 /* these are the actual param values - set on page load */
44 var MRESULT = "mresult";
45 var RRESULT = "rresult";
46 var RDETAIL = "rdetail";
47 var MYOPAC = "myopac";
48 var ADVANCED = "advanced";
51 /* search type (STYPE) options */
52 var STYPE_AUTHOR = "author";
53 var STYPE_TITLE = "title";
54 var STYPE_SUBJECT = "subject";
55 var STYPE_SERIES = "series";
56 var STYPE_KEYWORD = "keyword";
59 /* container for global variables shared accross pages */
61 G.user = null; /* global user object */
62 G.ui = {} /* cache of UI components */
65 /* call me after page init and I will load references
66 to all of the ui object id's defined below
67 They will be stored in G.ui.<page>.<thingy>
69 function loadUIObjects() {
70 for( var p in config.ids ) {
72 for( var o in config.ids[p] )
73 G.ui[p][o] = getId(config.ids[p][o]);
77 /* try our best to free memory */
78 function clearUIObjects() {
79 for( var p in config.ids ) {
80 for( var o in config.ids[p] ) {
82 G.ui[p][o].onclick = null;
83 G.ui[p][o].onkeydown = null;
91 /* ----------------------------------------------------------------------------
92 Set up ID's and CSS classes
93 Any new ids, css, etc. may be added by giving the unique names and putting
94 them into the correct scope
95 /* ---------------------------------------------------------------------------- */
99 /* Set up the page names */
101 config.page[HOME] = "index.xml";
102 config.page[ADVANCED] = "advanced.xml";
103 config.page[MRESULT] = "mresult.xml";
104 config.page[RRESULT] = "rresult.xml";
105 config.page[MYOPAC] = "myopac.xml";
106 config.page[RDETAIL] = "rdetail.xml";
113 config.images.logo = "main_logo.jpg";
116 /* set up ID's, CSS, and node names */
118 config.ids.result = {};
119 config.ids.mresult = {};
120 config.ids.advanced = {};
121 config.ids.rresult = {};
122 config.ids.myopac = {};
123 config.ids.rdetail = {};
126 config.css.result = {};
127 config.css.mresult = {};
128 config.css.advanced = {};
129 config.css.rresult = {};
130 config.css.myopac = {};
131 config.css.rdetail = {};
134 config.names.result = {};
135 config.names.mresult = {};
136 config.names.advanced = {};
137 config.names.rresult = {};
138 config.names.myopac = {};
139 config.names.rdetail = {};
142 /* id's shared accross skins. These *must* be defined */
143 config.ids.common = {};
144 config.ids.common.loading = "loading_div";
145 config.ids.common.canvas = "canvas";
146 config.ids.common.canvas_main = "canvas_main";
147 config.ids.common.org_tree = "org_tree";
148 config.ids.common.org_container = "org_container";
154 config.css.hide_me = "hide_me";
157 /* ---------------------------------------------------------------------------- */
158 /* These are pages that may replace the canvas */
159 /* ---------------------------------------------------------------------------- */
160 config.ids.altcanvas = {};
164 /* ---------------------------------------------------------------------------- */
165 /* Methods are defined as service:method
166 An optional 3rd component is when a method is followed by a :1, such methods
167 have a staff counterpart and should have ".staff" appended to the method
168 before the method is called when in XUL mode */
170 var FETCH_MRCOUNT = "open-ils.search:open-ils.search.biblio.class.count:1";
171 var FETCH_MRIDS = "open-ils.search:open-ils.search.biblio.class:1";
172 var FETCH_MRIDS_FULL = "open-ils.search:open-ils.search.biblio.class.full:1";
173 var FETCH_MRMODS = "open-ils.search:open-ils.search.biblio.metarecord.mods_slim.retrieve";
174 var FETCH_MR_COPY_COUNTS = "open-ils.search:open-ils.search.biblio.metarecord.copy_count:1";
175 var FETCH_RIDS = "open-ils.search:open-ils.search.biblio.metarecord_to_records:1";
176 var FETCH_RMODS = "open-ils.search:open-ils.search.biblio.record.mods_slim.retrieve";
177 var FETCH_R_COPY_COUNTS = "open-ils.search:open-ils.search.biblio.record.copy_count";
178 var FETCH_FLESHED_USER = "open-ils.actor:open-ils.actor.user.fleshed.retrieve";
179 var FETCH_SESSION = "open-ils.auth:open-ils.auth.session.retrieve";
180 var LOGIN_INIT = "open-ils.auth:open-ils.auth.authenticate.init";
181 var LOGIN_COMPLETE = "open-ils.auth:open-ils.auth.authenticate.complete";
182 var LOGIN_DELETE = "open-ils.auth:open-ils.auth.session.delete";
183 var FETCH_USER_PREFS = "open-ils.actor:open-ils.actor.patron.settings.retrieve";
184 var UPDATE_USER_PREFS = "open-ils.actor:open-ils.actor.patron.settings.update";
185 /* ---------------------------------------------------------------------------- */
189 /* ---------------------------------------------------------------------------- */
190 /* event callback functions. Other functions may be appended to these vars to
191 for added functionality. */
193 G.evt = {}; /* events container */
195 function runEvt(scope, name, a, b, c, d, e, f, g) {
196 var evt = G.evt[scope][name];
197 for( var i in evt ) {
198 evt[i](a, b, c, d, e, f, g);
202 /* creates a new event if it doesn't already exist */
203 function createEvt(scope, name) {
204 if(!G.evt[scope]) G.evt[scope] = {};
205 if(G.evt[scope][name] == null)
206 G.evt[scope][name] = [];
209 function attachEvt(scope, name, action) {
210 createEvt(scope, name);
211 G.evt[scope][name].push(action);
214 createEvt("common", "init"); /* f() : what happens on page init */
215 createEvt("common", "pageRendered"); /* f() : what happens when the page is done (up to the skin to call this even)*/
216 createEvt("common", "unload"); /* f() : what happens on window unload (clean memory, etc.)*/
217 createEvt("common", "run"); /* f() : make the page do stuff */
218 createEvt("mresult", "idsReceived"); /* f(ids) */
219 createEvt("rresult", "idsReceived"); /* f(ids) */
220 createEvt("rresult", "recordDrawn"); /* f(recordid, linkDOMNode) : after record is drawn, allow others (xul) to plugin actions */
222 createEvt("result", "hitCountReceived"); /* f() : display hit info, pagination, etc. */
223 createEvt("result", "recordReceived"); /* f(mvr, pagePosition, isMr) : display the record*/
224 createEvt("result", "recordDrawn"); /* f(recordid, linkDOMNode) : after record is drawn, allow others (xul) to plugin actions */
225 createEvt("result", "copyCountsReceived"); /* f(mvr, pagePosition, copyCountInfo) : display copy counts*/
226 createEvt("result", "allRecordsReceived"); /* f(mvrsArray) : add other page stuff, sidebars, etc.*/
228 createEvt("rdetail", "recordDrawn"); /* f() : the record has been drawn */