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);
24 if( G.user && G.user.session ) {
25 /* if the user is logged in, all activity resets the timeout
26 This is not entirely accurate in the sense that not all
27 requests will reset the server timeout - this should
28 get close enough, however.
30 var at = getAuthtime();
31 if(at) new AuthTimer(at).run();
35 for( var x = 1; x!= arguments.length; x++ ) {
37 this.request.addParam(arguments[x]);
42 for( var i = 0; i != p.length; i++ ) {
43 if( i > 0 ) str += ", "
46 _debug('request ' + s[0] + ' ' + s[1] + ' ' + str );
50 Request.prototype.callback = function(cal) {this.request.setCompleteCallback(cal);}
51 Request.prototype.send = function(block){this.request.send(block);}
52 Request.prototype.result = function(){return this.request.getResultObject();}
54 function showCanvas() {
55 for( var x in G.ui.altcanvas ) {
56 hideMe(G.ui.altcanvas[x]);
58 hideMe(G.ui.common.loading);
59 unHideMe(G.ui.common.canvas_main);
60 try{G.ui.searchbar.text.focus();}catch(e){}
63 function swapCanvas(newNode) {
64 for( var x in G.ui.altcanvas )
65 hideMe(G.ui.altcanvas[x]);
67 hideMe(G.ui.common.loading);
68 hideMe(G.ui.common.canvas_main);
72 /* finds the name of the current page */
73 var currentPage = null;
74 function findCurrentPage() {
75 if(currentPage) return currentPage;
78 for( var p in config.page ) pages.push(config.page[p]);
79 pages = pages.sort( function(a,b){ return - (a.length - b.length); } );
81 var path = location.pathname;
82 if(!path.match(/.*\.xml$/))
83 path += "index.xml"; /* in case they go to / */
86 for( var p in pages ) {
87 if( path.indexOf(pages[p]) != -1)
91 for( var p in config.page ) {
92 if(config.page[p] == page) {
101 /* sets all of the params values ----------------------------- */
102 function initParams() {
105 /* handle the location var */
107 var loc = cgi.param(PARAM_LOCATION);
109 org = findOrgUnit(loc);
110 if(!org) org = findOrgUnitSN(loc);
112 LOCATION = (org) ? org.id() : null;
115 loc = cgi.param(PARAM_ORIGLOC);
117 org = findOrgUnit(loc);
118 if(!org) org = findOrgUnitSN(loc);
120 ORIGLOC = (org) ? org.id() : null;
123 DEPTH = parseInt(cgi.param(PARAM_DEPTH));
124 if(isNaN(DEPTH)) DEPTH = null;
127 TERM = cgi.param(PARAM_TERM);
128 STYPE = cgi.param(PARAM_STYPE);
129 FORM = cgi.param(PARAM_FORM);
130 //DEPTH = parseInt(cgi.param(PARAM_DEPTH));
131 OFFSET = parseInt(cgi.param(PARAM_OFFSET));
132 COUNT = parseInt(cgi.param(PARAM_COUNT));
133 HITCOUNT = parseInt(cgi.param(PARAM_HITCOUNT));
134 MRID = parseInt(cgi.param(PARAM_MRID));
135 RID = parseInt(cgi.param(PARAM_RID));
136 AUTHTIME = parseInt(cgi.param(PARAM_AUTHTIME));
137 ADVTERM = cgi.param(PARAM_ADVTERM);
138 ADVTYPE = cgi.param(PARAM_ADVTYPE);
139 RTYPE = cgi.param(PARAM_RTYPE);
140 SORT = cgi.param(PARAM_SORT);
141 SORT_DIR = cgi.param(PARAM_SORT_DIR);
142 DEBUG = cgi.param(PARAM_DEBUG);
143 CALLNUM = cgi.param(PARAM_CN);
144 LITFORM = cgi.param(PARAM_LITFORM);
145 ITEMFORM = cgi.param(PARAM_ITEMFORM);
146 ITEMTYPE = cgi.param(PARAM_ITEMTYPE);
147 AUDIENCE = cgi.param(PARAM_AUDIENCE);
148 SEARCHES = cgi.param(PARAM_SEARCHES);
149 LANGUAGE = cgi.param(PARAM_LANGUAGE);
150 TFORM = cgi.param(PARAM_TFORM);
151 RDEPTH = cgi.param(PARAM_RDEPTH);
153 /* set up some sane defaults */
154 //if(isNaN(DEPTH)) DEPTH = 0;
155 if(isNaN(RDEPTH)) RDEPTH = 0;
156 if(isNaN(OFFSET)) OFFSET = 0;
157 if(isNaN(COUNT)) COUNT = 10;
158 if(isNaN(HITCOUNT)) HITCOUNT = 0;
159 if(isNaN(MRID)) MRID = 0;
160 if(isNaN(RID)) RID = 0;
161 if(isNaN(ORIGLOC)) ORIGLOC = 0; /* so we know it hasn't been set */
162 if(isNaN(AUTHTIME)) AUTHTIME = 0;
163 if(ADVTERM==null) ADVTERM = "";
166 function clearSearchParams() {
191 function initCookies() {
192 FONTSIZE = "regular";
193 var font = cookieManager.read(COOKIE_FONT);
195 if(font) FONTSIZE = font;
196 SKIN = cookieManager.read(COOKIE_SKIN);
199 /* URL param accessors */
200 function getTerm(){return TERM;}
201 function getStype(){return STYPE;}
202 function getLocation(){return LOCATION;}
203 function getDepth(){return DEPTH;}
204 function getForm(){return FORM;}
205 function getTform(){return TFORM;}
206 function getOffset(){return OFFSET;}
207 function getDisplayCount(){return COUNT;}
208 function getHitCount(){return HITCOUNT;}
209 function getMrid(){return MRID;};
210 function getRid(){return RID;};
211 function getOrigLocation(){return ORIGLOC;}
212 function getAuthtime() { return AUTHTIME; }
213 function getSearchBarExtras(){return SBEXTRAS;}
214 function getFontSize(){return FONTSIZE;};
215 function getSkin(){return SKIN;};
216 function getAdvTerm(){return ADVTERM;}
217 function getAdvType(){return ADVTYPE;}
218 function getRtype(){return RTYPE;}
219 function getSort(){return SORT;}
220 function getSortDir(){return SORT_DIR;}
221 function getDebug(){return DEBUG;}
222 function getCallnumber() { return CALLNUM; }
223 function getLitForm() { return LITFORM; }
224 function getItemForm() { return ITEMFORM; }
225 function getItemType() { return ITEMTYPE; }
226 function getAudience() { return AUDIENCE; }
227 function getSearches() { return SEARCHES; }
228 function getLanguage() { return LANGUAGE; }
229 function getRdepth() { return RDEPTH; }
232 function findBasePath() {
233 var path = location.pathname;
234 if(!path.match(/.*\.xml$/)) path += "index.xml";
235 var idx = path.indexOf(config.page[findCurrentPage()]);
236 return path.substring(0, idx);
239 function findBaseURL(ssl) {
240 var path = findBasePath();
241 var proto = (ssl) ? "https:" : "http:";
242 return proto + "//" + location.host + path;
246 function buildISBNSrc(isbn) {
247 return "http://" + location.host + "/jackets/" + isbn;
251 function buildImageLink(name, ssl) {
252 return findBaseURL(ssl) + "../../../../images/" + name;
255 function buildExtrasLink(name, ssl) {
256 return findBaseURL(ssl) + "../../../../extras/" + name;
260 function _debug(str) {
261 try { dump('dbg: ' + str + '\n'); } catch(e) {}
263 /* potentially useful, but usually just annoying */
266 if(!consoleService) {
268 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
269 this.consoleService = Components.classes['@mozilla.org/consoleservice;1']
270 .getService(Components.interfaces.nsIConsoleService);
276 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
277 consoleService.logStringMessage(str + '\n');
284 function buildOPACLink(args, slim, ssl) {
290 string = findBaseURL(ssl);
291 if(args.page) string += config.page[args.page];
292 else string += config.page[findCurrentPage()];
295 /* this may seem unnecessary.. safety precaution for now */
297 if( args[PARAM_DEPTH] == null )
298 args[PARAM_DEPTH] = getDepth();
303 for( var x in args ) {
305 if(x == "page" || v == null || v == undefined || v+'' == 'NaN' ) continue;
306 if(x == PARAM_OFFSET && v == 0) continue;
307 if(x == PARAM_COUNT && v == 10) continue;
308 if(x == PARAM_FORM && v == 'all' ) continue;
309 if( instanceOf(v, Array) && v.length ) {
310 for( var i = 0; i < v.length; i++ ) {
311 string += "&" + x + "=" + encodeURIComponent(v[i]);
314 string += "&" + x + "=" + encodeURIComponent(v);
319 string += _appendParam(DEBUG, PARAM_DEBUG, args, getDebug, string);
320 if(getOrigLocation() != 1)
321 string += _appendParam(ORIGLOC, PARAM_ORIGLOC, args, getOrigLocation, string);
323 string += _appendParam(TERM, PARAM_TERM, args, getTerm, string);
325 string += _appendParam(STYPE, PARAM_STYPE, args, getStype, string);
326 if(getLocation() != 1)
327 string += _appendParam(LOCATION, PARAM_LOCATION, args, getLocation, string);
328 if(getDepth() != null)
329 string += _appendParam(DEPTH, PARAM_DEPTH, args, getDepth, string);
330 if(getForm() && (getForm() != 'all') )
331 string += _appendParam(FORM, PARAM_FORM, args, getForm, string);
332 if(getTform() && (getTform() != 'all') )
333 string += _appendParam(TFORM, PARAM_TFORM, args, getTform, string);
335 string += _appendParam(OFFSET, PARAM_OFFSET, args, getOffset, string);
336 if(getDisplayCount() != 10)
337 string += _appendParam(COUNT, PARAM_COUNT, args, getDisplayCount, string);
339 string += _appendParam(HITCOUNT, PARAM_HITCOUNT, args, getHitCount, string);
341 string += _appendParam(MRID, PARAM_MRID, args, getMrid, string);
343 string += _appendParam(RID, PARAM_RID, args, getRid, string);
345 string += _appendParam(AUTHTIME, PARAM_AUTHTIME, args, getAuthtime, string);
347 string += _appendParam(ADVTERM, PARAM_ADVTERM, args, getAdvTerm, string);
349 string += _appendParam(ADVTYPE, PARAM_ADVTYPE, args, getAdvType, string);
351 string += _appendParam(RTYPE, PARAM_RTYPE, args, getRtype, string);
353 string += _appendParam(ITEMFORM, PARAM_ITEMFORM, args, getItemForm, string);
355 string += _appendParam(ITEMTYPE, PARAM_ITEMTYPE, args, getItemType, string);
357 string += _appendParam(LITFORM, PARAM_LITFORM, args, getLitForm, string);
359 string += _appendParam(AUDIENCE, PARAM_AUDIENCE, args, getAudience, string);
361 string += _appendParam(SEARCHES, PARAM_SEARCHES, args, getSearches, string);
363 string += _appendParam(LANGUAGE, PARAM_LANGUAGE, args, getLanguage, string);
364 if(getRdepth() != null)
365 string += _appendParam(RDEPTH, PARAM_RDEPTH, args, getRdepth, string);
366 if(getSort() != null)
367 string += _appendParam(SORT, PARAM_SORT, args, getSort, string);
368 if(getSortDir() != null)
369 string += _appendParam(SORT_DIR, PARAM_SORT_DIR, args, getSortDir, string);
371 return string.replace(/\&$/,'').replace(/\?\&/,"?");
375 function _appendParam( fieldVar, fieldName, overrideArgs, getFunc, string ) {
379 if( fieldVar != null &&
380 (fieldVar +'' != 'NaN') &&
381 overrideArgs[fieldName] == null &&
383 getFunc()+'' != '' ) {
385 ret = "&" + fieldName + "=" + encodeURIComponent(getFunc());
391 /* ----------------------------------------------------------------------- */
392 function cleanISBN(isbn) {
394 isbn = isbn.toString().replace(/^\s+/,"");
395 var idx = isbn.indexOf(" ");
396 if(idx > -1) { isbn = isbn.substring(0, idx); }
402 /* builds a link that goes to the title listings for a metarecord */
403 function buildTitleLink(rec, link) {
405 link.appendChild(text(normalize(truncate(rec.title(), 65))));
408 args[PARAM_OFFSET] = 0;
409 args[PARAM_MRID] = rec.doc_id();
410 args[PARAM_RTYPE] = RTYPE_MRID;
411 link.setAttribute("href", buildOPACLink(args));
414 function buildTitleDetailLink(rec, link) {
416 link.appendChild(text(normalize(truncate(rec.title(), 65))));
419 //args[PARAM_OFFSET] = 0;
420 args[PARAM_RID] = rec.doc_id();
421 link.setAttribute("href", buildOPACLink(args));
424 /* 'type' is one of STYPE_AUTHOR, STYPE_SUBJECT, ... found in config.js
425 'trunc' is the number of characters to show in the string, defaults to 65 */
426 function buildSearchLink(type, string, linknode, trunc) {
427 if(!trunc) trunc = 65;
429 if( SHOW_MR_DEFAULT) {
433 args[PARAM_RTYPE] = type;
435 args[PARAM_OFFSET] = 0;
436 args[PARAM_TERM] = string;
437 args[PARAM_STYPE] = type;
438 linknode.appendChild(text(normalize(truncate(string, trunc))));
439 linknode.setAttribute("href", buildOPACLink(args));
443 /* ----------------------------------------------------------------------- */
444 /* user session handling */
445 /* ----------------------------------------------------------------------- */
446 /* session is the login session. If no session is provided, we attempt
447 to find one in the cookies. If 'force' is true we retrieve the
448 user from the server even if there is already a global user present.
449 if ses != G.user.session, we also force a grab */
450 function grabUser(ses, force) {
452 if(!ses && isXUL()) ses = xulG['authtoken'];
455 ses = cookieManager.read(COOKIE_SES);
456 /* https cookies don't show up in http servers.. */
459 if(!ses) return false;
462 if(G.user && G.user.session == ses)
465 /* first make sure the session is valid */
466 var request = new Request(FETCH_SESSION, ses, 1 );
467 request.request.alertEvent = false;
469 var user = request.result();
473 return false; /* unable to grab the session */
476 if( !(typeof user == 'object' && user._isfieldmapper) ) {
482 G.user.fleshed = false;
483 G.user.session = ses;
484 cookieManager.write(COOKIE_SES, ses, -1);
487 if(G.user.prefs['opac.hits_per_page'])
488 COUNT = parseInt(G.user.prefs['opac.hits_per_page']);
490 if(G.user.prefs[PREF_DEF_FONT])
491 setFontSize(G.user.prefs[PREF_DEF_FONT]);
493 var at = getAuthtime();
494 //if(isXUL()) at = xulG['authtime'];
496 if(at && !isXUL()) new AuthTimer(at).run();
501 /* sets the 'prefs' field of the user object to their preferences
502 and returns the preferences */
503 function grabUserPrefs(user, force) {
504 if(user == null) user = G.user;
505 if(!force && user.prefs) return user.prefs;
506 var req = new Request(FETCH_USER_PREFS, user.session, user.id());
508 user.prefs = req.result();
512 function grabFleshedUser() {
514 if(!G.user || !G.user.session) {
516 if(!G.user || !G.user.session) return null;
519 if(G.user.fleshed) return G.user;
521 var req = new Request(FETCH_FLESHED_USER, G.user.session);
524 G.user = req.result();
526 if(!G.user || G.user.length == 0) {
527 G.user = null; return false;
528 cookieManager.write(COOKIE_SES,"");
531 G.user.session = ses;
532 G.user.fleshed = true;
534 cookieManager.write(COOKIE_SES, ses, '+1y'); /* update the cookie */
538 function checkUserSkin(new_skin) {
540 return; /* XXX do some debugging with this... */
542 var user_skin = getSkin();
543 var cur_skin = grabSkinFromURL();
545 if(new_skin) user_skin = new_skin;
550 if(grabUserPrefs()) {
551 user_skin = G.user.prefs["opac.skin"];
552 cookieManager.write( COOKIE_SKIN, user_skin, '+1y' );
557 if(!user_skin) return;
559 if( cur_skin != user_skin ) {
560 var url = buildOPACLink();
561 goTo(url.replace(cur_skin, user_skin));
565 function updateUserSetting(setting, value, user) {
566 if(user == null) user = G.user;
569 var req = new Request( UPDATE_USER_PREFS, user.session, a );
574 function commitUserPrefs() {
575 var req = new Request(
576 UPDATE_USER_PREFS, G.user.session, null, G.user.prefs );
581 function grabSkinFromURL() {
582 var path = findBasePath();
583 path = path.replace("/xml/", "");
585 for( var i = path.length - 1; i >= 0; i-- ) {
586 var ch = path.charAt(i);
592 for( i = skin.length - 1; i >= 0; i--)
593 skin2 += skin.charAt(i);
599 /* returns a fleshed G.user on success, false on failure */
600 function doLogin(suppressEvents) {
604 var uname = G.ui.login.username.value;
605 var passwd = G.ui.login.password.value;
607 var init_request = new Request( LOGIN_INIT, uname );
608 init_request.send(true);
609 var seed = init_request.result();
611 if( ! seed || seed == '0') {
612 alert( "Error Communicating with Authentication Server" );
617 password : hex_md5(seed + hex_md5(passwd)),
619 org : getOrigLocation()
622 if( uname.match(REGEX_BARCODE) ) args.barcode = uname; /* make this better */
623 else args.username = uname;
625 var auth_request = new Request( LOGIN_COMPLETE, args );
627 auth_request.request.alertEvent = false;
628 auth_request.send(true);
629 var auth_result = auth_request.result();
632 alertId('patron_login_failed');
636 if( checkILSEvent(auth_result) ) {
638 if( auth_result.textcode == 'PATRON_INACTIVE' ) {
639 alertId('patron_inactive_alert');
643 if( auth_result.textcode == 'PATRON_CARD_INACTIVE' ) {
644 alertId('patron_card_inactive_alert');
648 if( auth_result.textcode == 'LOGIN_FAILED' ||
649 auth_result.textcode == 'PERM_FAILURE' ) {
650 alertId('patron_login_failed');
656 AUTHTIME = parseInt(auth_result.payload.authtime);
657 var u = grabUser(auth_result.payload.authtoken, true);
658 if(u && ! suppressEvents)
659 runEvt( "common", "locationChanged", u.ws_ou(), findOrgDepth(u.ws_ou()) );
666 function doLogout(noredirect) {
668 /* cancel everything else */
671 /* be nice and delete the session from the server */
672 if(G.user && G.user.session) {
673 var req = new Request(LOGIN_DELETE, G.user.session);
675 try { req.result(); } catch(E){}
680 /* remove any cached data */
681 //cookieManager.remove(COOKIE_IDS);
682 //cookieManager.remove(COOKIE_SRIDS);
683 cookieManager.remove(COOKIE_RIDS);
684 cookieManager.remove(COOKIE_SES);
685 cookieManager.remove(COOKIE_SKIN);
687 checkUserSkin("default");
692 args[PARAM_TERM] = "";
693 args[PARAM_LOCATION] = getOrigLocation();
694 args[PARAM_DEPTH] = findOrgDepth(getOrigLocation());
699 try{ if(isFrontPage) nored = true; } catch(e){nored = false;}
700 if(!nored) goTo(buildOPACLink(args));
704 function hideMe(obj) { addCSSClass(obj, config.css.hide_me); }
705 function unHideMe(obj) { removeCSSClass(obj, config.css.hide_me); }
708 /* ----------------------------------------------------------------------- */
709 /* build the org tree */
710 /* ----------------------------------------------------------------------- */
711 function drawOrgTree() {
712 //setTimeout( 'buildOrgSelector(G.ui.common.org_tree, orgTreeSelector);', 10 );
713 setTimeout( 'buildOrgSelector(G.ui.common.org_tree, orgTreeSelector);', 1 );
717 function buildOrgSelector(node) {
718 var tree = new SlimTree(node,'orgTreeSelector');
719 orgTreeSelector = tree;
720 for( var i in orgArraySearcher ) {
721 var node = orgArraySearcher[i];
722 if( node == null ) continue;
723 if(node.parent_ou() == null)
724 tree.addNode(node.id(), -1, node.name(),
725 "javascript:orgSelect(" + node.id() + ");", node.name());
727 tree.addNode(node.id(), findOrgUnit(node.parent_ou()).id(), node.name(),
728 "javascript:orgSelect(" + node.id() + ");", node.name());
731 hideMe($('org_loading_div'));
732 unHideMe($('org_selector_tip'));
736 function orgSelect(id) {
738 runEvt("common", "locationChanged", id, findOrgDepth(id) );
740 removeChildren(G.ui.common.now_searching);
741 G.ui.common.now_searching.appendChild(text(findOrgUnit(id).name()));
744 function setFontSize(size) {
746 cookieManager.write(COOKIE_FONT, size, '+1y');
750 var resourceFormats = [
753 "sound recording", "software, multimedia",
758 "three dimensional object" ];
761 function modsFormatToMARC(format) {
767 case "sound recording":
769 case "sound recording-nonmusical":
771 case "sound recording-musical":
773 case "software, multimedia":
779 case "mixed material":
781 case "notated music":
783 case "three dimensional object":
790 function MARCFormatToMods(format) {
796 return "moving image";
798 return "sound recording-nonmusical";
800 return "sound recording-musical";
802 return "software, multimedia";
804 return "still images";
807 return "cartographic";
810 return "mixed material";
813 return "notated music";
815 return "three dimensional object";
820 function MARCTypeToFriendly(format) {
821 var words = $('format_words');
824 case 't' : return $n(words, 'at').innerHTML;
826 var node = $n(words,format);
827 if( node ) return node.innerHTML;
832 function setResourcePic( img, resource ) {
833 img.setAttribute( "src", "../../../../images/tor/" + resource + ".jpg");
834 img.title = resource;
839 function msg( text ) {
840 try { alert( text ); } catch(e) {}
843 function findRecord(id,type) {
845 for( var i = 0; i != recordsCache.length; i++ ) {
846 var rec = recordsCache[i];
847 if( rec && rec.doc_id() == id ) return rec;
850 var meth = FETCH_RMODS
851 if(type == 'M') meth = FETCH_MRMODS;
852 var req = new Request(meth, id);
853 req.request.alertEvent = false;
855 var res = req.result();
856 if( checkILSEvent(res) ) return null;
859 function Timer(name, node){
864 Timer.prototype.start =
865 function(){_timerRun(this.name);}
866 Timer.prototype.stop =
867 function(){this.done = true;}
868 function _timerRun(tname) {
872 if(_t.count > 100) return;
874 if( (_t.count % 5) == 0 )
876 _t.node.appendChild(text(str));
877 setTimeout("_timerRun('"+tname+"');", 200);
881 function checkILSEvent(obj) {
882 if( obj && obj.ilsevent != null && obj.ilsevent != 0 )
883 return parseInt(obj.ilsevent);
888 function alertILSEvent(evt, msg) {
891 alert(msg +'\n' + evt.textcode + '\n' + evt.desc );
893 alert(evt.textcode + '\n' + evt.desc );
898 function AuthTimer(time) {
899 this.time = (time - LOGOUT_WARNING_TIME) * 1000;
901 try {clearTimeout(__authTimer.id)} catch(e){}
905 AuthTimer.prototype.run = function() {
906 this.id = setTimeout('_authTimerAlert()', this.time);
909 function _authTimerAlert() {
910 alert( $('auth_session_expiring').innerHTML );
911 if(!grabUser(null, true)) doLogout();
915 function grabUserByBarcode( authtoken, barcode ) {
916 var req = new Request( FETCH_USER_BYBARCODE, authtoken, barcode );
923 goTo(buildOPACLink({page:HOME}));
927 function buildOrgSel(selector, org, offset) {
928 insertSelectorVal( selector, -1,
929 org.name(), org.id(), null, findOrgDepth(org) - offset );
930 for( var c in org.children() )
931 buildOrgSel( selector, org.children()[c], offset);
935 function parseForm(form) {
938 var it = form.replace(/-\w+$/,"");
943 if(form.match(/-/)) itf = form.replace(/^\w+-/,"");
947 for( var i = 0; i < it.length; i++ )
948 item_type.push( it.charAt(i) );
953 for( var i = 0; i < itf.length; i++ )
954 item_form.push( itf.charAt(i) );
957 return {item_type: item_type, item_form:item_form};
961 function isTrue(x) { return ( x && x != "0" && !(x+'').match(/^f$/i) ); }
963 function fetchPermOrgs() {
964 var a = []; /* why does arguments come accross as an object and not an array? */
965 for( var i = 0; i < arguments.length; i++ )
968 var preq = new Request(FETCH_HIGHEST_PERM_ORG,
969 G.user.session, G.user.id(), a );
971 return preq.result();