1 /* - Request ------------------------------------------------------------- */
3 /* define it again here for pages that don't load RemoteRequest */
4 function isXUL() { try { if(IAMXUL) return true;}catch(e){return false;}; }
7 var cookieManager = new HTTP.Cookies();
9 var __ilsEvent; /* the last event the occurred */
11 function Request(type) {
13 var s = type.split(":");
14 if(s[2] == "1" && isXUL()) s[1] += ".staff";
15 this.request = new RemoteRequest(s[0], s[1]);
19 if(!location.href.match(/^https:/))
20 this.request.setSecure(false);
23 for( var x = 1; x!= arguments.length; x++ ) {
25 this.request.addParam(arguments[x]);
30 for( var i = 0; i != p.length; i++ ) {
31 if( i > 0 ) str += ", "
34 _debug('request ' + s[0] + ' ' + s[1] + ' ' + str );
38 Request.prototype.callback = function(cal) {this.request.setCompleteCallback(cal);}
39 Request.prototype.send = function(block){this.request.send(block);}
40 Request.prototype.result = function(){return this.request.getResultObject();}
42 function showCanvas() {
43 for( var x in G.ui.altcanvas ) {
44 hideMe(G.ui.altcanvas[x]);
46 hideMe(G.ui.common.loading);
47 unHideMe(G.ui.common.canvas_main);
48 try{G.ui.searchbar.text.focus();}catch(e){}
51 function swapCanvas(newNode) {
52 for( var x in G.ui.altcanvas )
53 hideMe(G.ui.altcanvas[x]);
55 hideMe(G.ui.common.loading);
56 hideMe(G.ui.common.canvas_main);
60 /* finds the name of the current page */
61 var currentPage = null;
62 function findCurrentPage() {
63 if(currentPage) return currentPage;
66 for( var p in config.page ) pages.push(config.page[p]);
67 pages = pages.sort( function(a,b){ return - (a.length - b.length); } );
69 var path = location.pathname;
70 if(!path.match(/.*\.xml$/))
71 path += "index.xml"; /* in case they go to / */
74 for( var p in pages ) {
75 if( path.indexOf(pages[p]) != -1)
79 for( var p in config.page ) {
80 if(config.page[p] == page) {
89 /* sets all of the params values ----------------------------- */
90 function initParams() {
93 /* handle the location var */
95 var loc = cgi.param(PARAM_LOCATION);
97 org = findOrgUnit(loc);
98 if(!org) org = findOrgUnitSN(loc);
100 LOCATION = (org) ? org.id() : null;
103 loc = cgi.param(PARAM_ORIGLOC);
105 org = findOrgUnit(loc);
106 if(!org) org = findOrgUnitSN(loc);
108 ORIGLOC = (org) ? org.id() : null;
111 DEPTH = parseInt(cgi.param(PARAM_DEPTH));
112 if(isNaN(DEPTH)) DEPTH = null;
115 TERM = cgi.param(PARAM_TERM);
116 STYPE = cgi.param(PARAM_STYPE);
117 FORM = cgi.param(PARAM_FORM);
118 //DEPTH = parseInt(cgi.param(PARAM_DEPTH));
119 OFFSET = parseInt(cgi.param(PARAM_OFFSET));
120 COUNT = parseInt(cgi.param(PARAM_COUNT));
121 HITCOUNT = parseInt(cgi.param(PARAM_HITCOUNT));
122 MRID = parseInt(cgi.param(PARAM_MRID));
123 RID = parseInt(cgi.param(PARAM_RID));
124 AUTHTIME = parseInt(cgi.param(PARAM_AUTHTIME));
125 ADVTERM = cgi.param(PARAM_ADVTERM);
126 ADVTYPE = cgi.param(PARAM_ADVTYPE);
127 RTYPE = cgi.param(PARAM_RTYPE);
128 SORT = cgi.param(PARAM_SORT);
129 SORT_DIR = cgi.param(PARAM_SORT_DIR);
130 DEBUG = cgi.param(PARAM_DEBUG);
131 CALLNUM = cgi.param(PARAM_CN);
132 LITFORM = cgi.param(PARAM_LITFORM);
133 ITEMFORM = cgi.param(PARAM_ITEMFORM);
134 ITEMTYPE = cgi.param(PARAM_ITEMTYPE);
135 AUDIENCE = cgi.param(PARAM_AUDIENCE);
136 SEARCHES = cgi.param(PARAM_SEARCHES);
137 LANGUAGE = cgi.param(PARAM_LANGUAGE);
138 TFORM = cgi.param(PARAM_TFORM);
139 RDEPTH = cgi.param(PARAM_RDEPTH);
141 /* set up some sane defaults */
142 //if(isNaN(DEPTH)) DEPTH = 0;
143 if(isNaN(RDEPTH)) RDEPTH = 0;
144 if(isNaN(OFFSET)) OFFSET = 0;
145 if(isNaN(COUNT)) COUNT = 10;
146 if(isNaN(HITCOUNT)) HITCOUNT = 0;
147 if(isNaN(MRID)) MRID = 0;
148 if(isNaN(RID)) RID = 0;
149 if(isNaN(ORIGLOC)) ORIGLOC = 0; /* so we know it hasn't been set */
150 if(isNaN(AUTHTIME)) AUTHTIME = 0;
151 if(ADVTERM==null) ADVTERM = "";
154 function clearSearchParams() {
179 function initCookies() {
180 FONTSIZE = "regular";
181 var font = cookieManager.read(COOKIE_FONT);
183 if(font) FONTSIZE = font;
184 SKIN = cookieManager.read(COOKIE_SKIN);
187 /* URL param accessors */
188 function getTerm(){return TERM;}
189 function getStype(){return STYPE;}
190 function getLocation(){return LOCATION;}
191 function getDepth(){return DEPTH;}
192 function getForm(){return FORM;}
193 function getTform(){return TFORM;}
194 function getOffset(){return OFFSET;}
195 function getDisplayCount(){return COUNT;}
196 function getHitCount(){return HITCOUNT;}
197 function getMrid(){return MRID;};
198 function getRid(){return RID;};
199 function getOrigLocation(){return ORIGLOC;}
200 function getAuthtime() { return AUTHTIME; }
201 function getSearchBarExtras(){return SBEXTRAS;}
202 function getFontSize(){return FONTSIZE;};
203 function getSkin(){return SKIN;};
204 function getAdvTerm(){return ADVTERM;}
205 function getAdvType(){return ADVTYPE;}
206 function getRtype(){return RTYPE;}
207 function getSort(){return SORT;}
208 function getSortDir(){return SORT_DIR;}
209 function getDebug(){return DEBUG;}
210 function getCallnumber() { return CALLNUM; }
211 function getLitForm() { return LITFORM; }
212 function getItemForm() { return ITEMFORM; }
213 function getItemType() { return ITEMTYPE; }
214 function getAudience() { return AUDIENCE; }
215 function getSearches() { return SEARCHES; }
216 function getLanguage() { return LANGUAGE; }
217 function getRdepth() { return RDEPTH; }
220 function findBasePath() {
221 var path = location.pathname;
222 if(!path.match(/.*\.xml$/)) path += "index.xml";
223 var idx = path.indexOf(config.page[findCurrentPage()]);
224 return path.substring(0, idx);
227 function findBaseURL(ssl) {
228 var path = findBasePath();
229 var proto = (ssl) ? "https:" : "http:";
230 return proto + "//" + location.host + path;
234 function buildISBNSrc(isbn) {
235 return "http://" + location.host + "/jackets/" + isbn;
239 function buildImageLink(name, ssl) {
240 return findBaseURL(ssl) + "../../../../images/" + name;
243 function buildExtrasLink(name, ssl) {
244 return findBaseURL(ssl) + "../../../../extras/" + name;
248 function _debug(str) {
249 try { dump('dbg: ' + str + '\n'); } catch(e) {}
251 /* potentially useful, but usually just annoying */
254 if(!consoleService) {
256 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
257 this.consoleService = Components.classes['@mozilla.org/consoleservice;1']
258 .getService(Components.interfaces.nsIConsoleService);
264 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
265 consoleService.logStringMessage(str + '\n');
272 function buildOPACLink(args, slim, ssl) {
278 string = findBaseURL(ssl);
279 if(args.page) string += config.page[args.page];
280 else string += config.page[findCurrentPage()];
283 /* this may seem unnecessary.. safety precaution for now */
285 if( args[PARAM_DEPTH] == null )
286 args[PARAM_DEPTH] = getDepth();
291 for( var x in args ) {
293 if(x == "page" || v == null || v == undefined || v+'' == 'NaN' ) continue;
294 if(x == PARAM_OFFSET && v == 0) continue;
295 if(x == PARAM_COUNT && v == 10) continue;
296 if(x == PARAM_FORM && v == 'all' ) continue;
297 if( instanceOf(v, Array) && v.length ) {
298 for( var i = 0; i < v.length; i++ ) {
299 string += "&" + x + "=" + encodeURIComponent(v[i]);
302 string += "&" + x + "=" + encodeURIComponent(v);
307 string += _appendParam(DEBUG, PARAM_DEBUG, args, getDebug, string);
308 if(getOrigLocation() != 1)
309 string += _appendParam(ORIGLOC, PARAM_ORIGLOC, args, getOrigLocation, string);
311 string += _appendParam(TERM, PARAM_TERM, args, getTerm, string);
313 string += _appendParam(STYPE, PARAM_STYPE, args, getStype, string);
314 if(getLocation() != 1)
315 string += _appendParam(LOCATION, PARAM_LOCATION, args, getLocation, string);
316 if(getDepth() != null)
317 string += _appendParam(DEPTH, PARAM_DEPTH, args, getDepth, string);
318 if(getForm() && (getForm() != 'all') )
319 string += _appendParam(FORM, PARAM_FORM, args, getForm, string);
320 if(getTform() && (getTform() != 'all') )
321 string += _appendParam(TFORM, PARAM_TFORM, args, getTform, string);
323 string += _appendParam(OFFSET, PARAM_OFFSET, args, getOffset, string);
324 if(getDisplayCount() != 10)
325 string += _appendParam(COUNT, PARAM_COUNT, args, getDisplayCount, string);
327 string += _appendParam(HITCOUNT, PARAM_HITCOUNT, args, getHitCount, string);
329 string += _appendParam(MRID, PARAM_MRID, args, getMrid, string);
331 string += _appendParam(RID, PARAM_RID, args, getRid, string);
333 string += _appendParam(AUTHTIME, PARAM_AUTHTIME, args, getAuthtime, string);
335 string += _appendParam(ADVTERM, PARAM_ADVTERM, args, getAdvTerm, string);
337 string += _appendParam(ADVTYPE, PARAM_ADVTYPE, args, getAdvType, string);
339 string += _appendParam(RTYPE, PARAM_RTYPE, args, getRtype, string);
341 string += _appendParam(ITEMFORM, PARAM_ITEMFORM, args, getItemForm, string);
343 string += _appendParam(ITEMTYPE, PARAM_ITEMTYPE, args, getItemType, string);
345 string += _appendParam(LITFORM, PARAM_LITFORM, args, getLitForm, string);
347 string += _appendParam(AUDIENCE, PARAM_AUDIENCE, args, getAudience, string);
349 string += _appendParam(SEARCHES, PARAM_SEARCHES, args, getSearches, string);
351 string += _appendParam(LANGUAGE, PARAM_LANGUAGE, args, getLanguage, string);
352 if(getRdepth() != null)
353 string += _appendParam(RDEPTH, PARAM_RDEPTH, args, getRdepth, string);
354 if(getSort() != null)
355 string += _appendParam(SORT, PARAM_SORT, args, getSort, string);
356 if(getSortDir() != null)
357 string += _appendParam(SORT_DIR, PARAM_SORT_DIR, args, getSortDir, string);
359 return string.replace(/\&$/,'').replace(/\?\&/,"?");
363 function _appendParam( fieldVar, fieldName, overrideArgs, getFunc, string ) {
367 if( fieldVar != null &&
368 (fieldVar +'' != 'NaN') &&
369 overrideArgs[fieldName] == null &&
371 getFunc()+'' != '' ) {
373 ret = "&" + fieldName + "=" + encodeURIComponent(getFunc());
379 /* ----------------------------------------------------------------------- */
380 function cleanISBN(isbn) {
382 isbn = isbn.toString().replace(/^\s+/,"");
383 var idx = isbn.indexOf(" ");
384 if(idx > -1) { isbn = isbn.substring(0, idx); }
390 /* builds a link that goes to the title listings for a metarecord */
391 function buildTitleLink(rec, link) {
393 link.appendChild(text(normalize(truncate(rec.title(), 65))));
396 args[PARAM_OFFSET] = 0;
397 args[PARAM_MRID] = rec.doc_id();
398 args[PARAM_RTYPE] = RTYPE_MRID;
399 link.setAttribute("href", buildOPACLink(args));
402 function buildTitleDetailLink(rec, link) {
404 link.appendChild(text(normalize(truncate(rec.title(), 65))));
407 //args[PARAM_OFFSET] = 0;
408 args[PARAM_RID] = rec.doc_id();
409 link.setAttribute("href", buildOPACLink(args));
412 /* 'type' is one of STYPE_AUTHOR, STYPE_SUBJECT, ... found in config.js
413 'trunc' is the number of characters to show in the string, defaults to 65 */
414 function buildSearchLink(type, string, linknode, trunc) {
415 if(!trunc) trunc = 65;
418 args[PARAM_OFFSET] = 0;
419 args[PARAM_TERM] = string;
420 args[PARAM_STYPE] = type;
421 linknode.appendChild(text(normalize(truncate(string, trunc))));
422 linknode.setAttribute("href", buildOPACLink(args));
426 /* ----------------------------------------------------------------------- */
427 /* user session handling */
428 /* ----------------------------------------------------------------------- */
429 /* session is the login session. If no session is provided, we attempt
430 to find one in the cookies. If 'force' is true we retrieve the
431 user from the server even if there is already a global user present.
432 if ses != G.user.session, we also force a grab */
433 function grabUser(ses, force) {
435 if(!ses && isXUL()) ses = xulG['authtoken'];
438 ses = cookieManager.read(COOKIE_SES);
439 /* https cookies don't show up in http servers.. */
442 if(!ses) return false;
445 if(G.user && G.user.session == ses)
448 /* first make sure the session is valid */
449 var request = new Request(FETCH_SESSION, ses, 1 );
450 request.request.alertEvent = false;
452 var user = request.result();
456 return false; /* unable to grab the session */
459 if( !(typeof user == 'object' && user._isfieldmapper) ) {
465 G.user.fleshed = false;
466 G.user.session = ses;
467 cookieManager.write(COOKIE_SES, ses, '+1d');
471 if(G.user.prefs['opac.hits_per_page'])
472 COUNT = parseInt(G.user.prefs['opac.hits_per_page']);
474 if(G.user.prefs[PREF_DEF_FONT])
475 setFontSize(G.user.prefs[PREF_DEF_FONT]);
477 var at = getAuthtime();
478 //if(isXUL()) at = xulG['authtime'];
480 if(at && !isXUL()) new AuthTimer(at).run();
485 /* sets the 'prefs' field of the user object to their preferences
486 and returns the preferences */
487 function grabUserPrefs(user, force) {
488 if(user == null) user = G.user;
489 if(!force && user.prefs) return user.prefs;
490 var req = new Request(FETCH_USER_PREFS, user.session, user.id());
492 user.prefs = req.result();
496 function grabFleshedUser() {
498 if(!G.user || !G.user.session) {
500 if(!G.user || !G.user.session) return null;
503 if(G.user.fleshed) return G.user;
505 var req = new Request(FETCH_FLESHED_USER, G.user.session);
508 G.user = req.result();
510 if(!G.user || G.user.length == 0) {
511 G.user = null; return false;
512 cookieManager.write(COOKIE_SES,"");
515 G.user.session = ses;
516 G.user.fleshed = true;
518 cookieManager.write(COOKIE_SES, ses, '+1y'); /* update the cookie */
522 function checkUserSkin(new_skin) {
524 return; /* XXX do some debugging with this... */
526 var user_skin = getSkin();
527 var cur_skin = grabSkinFromURL();
529 if(new_skin) user_skin = new_skin;
534 if(grabUserPrefs()) {
535 user_skin = G.user.prefs["opac.skin"];
536 cookieManager.write( COOKIE_SKIN, user_skin, '+1y' );
541 if(!user_skin) return;
543 if( cur_skin != user_skin ) {
544 var url = buildOPACLink();
545 goTo(url.replace(cur_skin, user_skin));
549 function updateUserSetting(setting, value, user) {
550 if(user == null) user = G.user;
553 var req = new Request( UPDATE_USER_PREFS, user.session, a );
558 function commitUserPrefs() {
559 var req = new Request(
560 UPDATE_USER_PREFS, G.user.session, null, G.user.prefs );
565 function grabSkinFromURL() {
566 var path = findBasePath();
567 path = path.replace("/xml/", "");
569 for( var i = path.length - 1; i >= 0; i-- ) {
570 var ch = path.charAt(i);
576 for( i = skin.length - 1; i >= 0; i--)
577 skin2 += skin.charAt(i);
583 /* returns a fleshed G.user on success, false on failure */
584 function doLogin(suppressEvents) {
588 var uname = G.ui.login.username.value;
589 var passwd = G.ui.login.password.value;
591 var init_request = new Request( LOGIN_INIT, uname );
592 init_request.send(true);
593 var seed = init_request.result();
595 if( ! seed || seed == '0') {
596 alert( "Error Communicating with Authentication Server" );
601 password : hex_md5(seed + hex_md5(passwd)),
603 org : getOrigLocation()
606 if( uname.match(REGEX_BARCODE) ) args.barcode = uname; /* make this better */
607 else args.username = uname;
609 var auth_request = new Request( LOGIN_COMPLETE, args );
611 auth_request.request.alertEvent = false;
612 auth_request.send(true);
613 var auth_result = auth_request.result();
616 alertId('patron_login_failed');
620 if( checkILSEvent(auth_result) ) {
622 if( auth_result.textcode == 'PATRON_INACTIVE' ) {
623 alertId('patron_inactive_alert');
627 if( auth_result.textcode == 'PATRON_CARD_INACTIVE' ) {
628 alertId('patron_card_inactive_alert');
632 if( auth_result.textcode == 'LOGIN_FAILED' ||
633 auth_result.textcode == 'PERM_FAILURE' ) {
634 alertId('patron_login_failed');
640 AUTHTIME = parseInt(auth_result.payload.authtime);
641 var u = grabUser(auth_result.payload.authtoken, true);
642 if(u && ! suppressEvents)
643 runEvt( "common", "locationChanged", u.ws_ou(), findOrgDepth(u.ws_ou()) );
650 function doLogout(noredirect) {
652 /* cancel everything else */
655 /* be nice and delete the session from the server */
656 if(G.user && G.user.session) {
657 var req = new Request(LOGIN_DELETE, G.user.session);
659 try { req.result(); } catch(E){}
664 /* remove any cached data */
665 //cookieManager.remove(COOKIE_IDS);
666 //cookieManager.remove(COOKIE_SRIDS);
667 cookieManager.remove(COOKIE_RIDS);
668 cookieManager.remove(COOKIE_SES);
669 cookieManager.remove(COOKIE_SKIN);
671 checkUserSkin("default");
676 args[PARAM_TERM] = "";
677 args[PARAM_LOCATION] = getOrigLocation();
678 args[PARAM_DEPTH] = findOrgDepth(getOrigLocation());
683 try{ if(isFrontPage) nored = true; } catch(e){nored = false;}
684 if(!nored) goTo(buildOPACLink(args));
688 function hideMe(obj) { addCSSClass(obj, config.css.hide_me); }
689 function unHideMe(obj) { removeCSSClass(obj, config.css.hide_me); }
692 /* ----------------------------------------------------------------------- */
693 /* build the org tree */
694 /* ----------------------------------------------------------------------- */
695 function drawOrgTree() {
696 //setTimeout( 'buildOrgSelector(G.ui.common.org_tree, orgTreeSelector);', 10 );
697 setTimeout( 'buildOrgSelector(G.ui.common.org_tree, orgTreeSelector);', 1 );
701 function buildOrgSelector(node) {
702 var tree = new SlimTree(node,'orgTreeSelector');
703 orgTreeSelector = tree;
704 for( var i in orgArraySearcher ) {
705 var node = orgArraySearcher[i];
706 if( node == null ) continue;
707 if(node.parent_ou() == null)
708 tree.addNode(node.id(), -1, node.name(),
709 "javascript:orgSelect(" + node.id() + ");", node.name());
711 tree.addNode(node.id(), findOrgUnit(node.parent_ou()).id(), node.name(),
712 "javascript:orgSelect(" + node.id() + ");", node.name());
715 hideMe($('org_loading_div'));
716 unHideMe($('org_selector_tip'));
720 function orgSelect(id) {
722 runEvt("common", "locationChanged", id, findOrgDepth(id) );
724 removeChildren(G.ui.common.now_searching);
725 G.ui.common.now_searching.appendChild(text(findOrgUnit(id).name()));
728 function setFontSize(size) {
730 cookieManager.write(COOKIE_FONT, size, '+1y');
734 var resourceFormats = [
737 "sound recording", "software, multimedia",
742 "three dimensional object" ];
745 function modsFormatToMARC(format) {
751 case "sound recording":
753 case "sound recording-nonmusical":
755 case "sound recording-musical":
757 case "software, multimedia":
763 case "mixed material":
765 case "notated music":
767 case "three dimensional object":
774 function MARCFormatToMods(format) {
780 return "moving image";
782 return "sound recording-nonmusical";
784 return "sound recording-musical";
786 return "software, multimedia";
788 return "still images";
791 return "cartographic";
794 return "mixed material";
797 return "notated music";
799 return "three dimensional object";
804 function MARCTypeToFriendly(format) {
805 var words = $('format_words');
808 case 't' : return $n(words, 'at').innerHTML;
810 var node = $n(words,format);
811 if( node ) return node.innerHTML;
816 function setResourcePic( img, resource ) {
817 img.setAttribute( "src", "../../../../images/tor/" + resource + ".jpg");
818 img.title = resource;
823 function msg( text ) {
824 try { alert( text ); } catch(e) {}
827 function findRecord(id,type) {
829 for( var i = 0; i != recordsCache.length; i++ ) {
830 var rec = recordsCache[i];
831 if( rec && rec.doc_id() == id ) return rec;
834 var meth = FETCH_RMODS
835 if(type == 'M') meth = FETCH_MRMODS;
836 var req = new Request(meth, id);
837 req.request.alertEvent = false;
839 var res = req.result();
840 if( checkILSEvent(res) ) return null;
843 function Timer(name, node){
848 Timer.prototype.start =
849 function(){_timerRun(this.name);}
850 Timer.prototype.stop =
851 function(){this.done = true;}
852 function _timerRun(tname) {
856 if(_t.count > 100) return;
858 if( (_t.count % 5) == 0 )
860 _t.node.appendChild(text(str));
861 setTimeout("_timerRun('"+tname+"');", 200);
865 function checkILSEvent(obj) {
866 if( obj && obj.ilsevent != null && obj.ilsevent != 0 )
867 return parseInt(obj.ilsevent);
872 function alertILSEvent(evt, msg) {
875 alert(msg +'\n' + evt.textcode + '\n' + evt.desc );
877 alert(evt.textcode + '\n' + evt.desc );
882 function AuthTimer(time) {
883 this.time = (time - LOGOUT_WARNING_TIME) * 1000;
887 AuthTimer.prototype.run = function() {
888 setTimeout('_authTimerAlert()', this.time);
891 function _authTimerAlert() {
892 alert( $('auth_session_expiring').innerHTML );
893 if(!grabUser(null, true)) doLogout();
897 function grabUserByBarcode( authtoken, barcode ) {
898 var req = new Request( FETCH_USER_BYBARCODE, authtoken, barcode );
905 goTo(buildOPACLink({page:HOME}));
909 function buildOrgSel(selector, org, offset) {
910 insertSelectorVal( selector, -1,
911 org.name(), org.id(), null, findOrgDepth(org) - offset );
912 for( var c in org.children() )
913 buildOrgSel( selector, org.children()[c], offset);
917 function parseForm(form) {
920 var it = form.replace(/-\w+$/,"");
925 if(form.match(/-/)) itf = form.replace(/^\w+-/,"");
929 for( var i = 0; i < it.length; i++ )
930 item_type.push( it.charAt(i) );
935 for( var i = 0; i < itf.length; i++ )
936 item_form.push( itf.charAt(i) );
939 return {item_type: item_type, item_form:item_form};
943 function isTrue(x) { return ( x && x != "0" && !(x+'').match(/^f$/i) ); }
945 function fetchPermOrgs() {
946 var a = []; /* why does arguments come accross as an object and not an array? */
947 for( var i = 0; i < arguments.length; i++ )
950 var preq = new Request(FETCH_HIGHEST_PERM_ORG,
951 G.user.session, G.user.id(), a );
953 return preq.result();