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;
430 args[PARAM_OFFSET] = 0;
431 args[PARAM_TERM] = string;
432 args[PARAM_STYPE] = type;
433 linknode.appendChild(text(normalize(truncate(string, trunc))));
434 linknode.setAttribute("href", buildOPACLink(args));
438 /* ----------------------------------------------------------------------- */
439 /* user session handling */
440 /* ----------------------------------------------------------------------- */
441 /* session is the login session. If no session is provided, we attempt
442 to find one in the cookies. If 'force' is true we retrieve the
443 user from the server even if there is already a global user present.
444 if ses != G.user.session, we also force a grab */
445 function grabUser(ses, force) {
447 if(!ses && isXUL()) ses = xulG['authtoken'];
450 ses = cookieManager.read(COOKIE_SES);
451 /* https cookies don't show up in http servers.. */
454 if(!ses) return false;
457 if(G.user && G.user.session == ses)
460 /* first make sure the session is valid */
461 var request = new Request(FETCH_SESSION, ses, 1 );
462 request.request.alertEvent = false;
464 var user = request.result();
468 return false; /* unable to grab the session */
471 if( !(typeof user == 'object' && user._isfieldmapper) ) {
477 G.user.fleshed = false;
478 G.user.session = ses;
479 cookieManager.write(COOKIE_SES, ses, -1);
483 if(G.user.prefs['opac.hits_per_page'])
484 COUNT = parseInt(G.user.prefs['opac.hits_per_page']);
486 if(G.user.prefs[PREF_DEF_FONT])
487 setFontSize(G.user.prefs[PREF_DEF_FONT]);
489 var at = getAuthtime();
490 //if(isXUL()) at = xulG['authtime'];
492 if(at && !isXUL()) new AuthTimer(at).run();
497 /* sets the 'prefs' field of the user object to their preferences
498 and returns the preferences */
499 function grabUserPrefs(user, force) {
500 if(user == null) user = G.user;
501 if(!force && user.prefs) return user.prefs;
502 var req = new Request(FETCH_USER_PREFS, user.session, user.id());
504 user.prefs = req.result();
508 function grabFleshedUser() {
510 if(!G.user || !G.user.session) {
512 if(!G.user || !G.user.session) return null;
515 if(G.user.fleshed) return G.user;
517 var req = new Request(FETCH_FLESHED_USER, G.user.session);
520 G.user = req.result();
522 if(!G.user || G.user.length == 0) {
523 G.user = null; return false;
524 cookieManager.write(COOKIE_SES,"");
527 G.user.session = ses;
528 G.user.fleshed = true;
530 cookieManager.write(COOKIE_SES, ses, '+1y'); /* update the cookie */
534 function checkUserSkin(new_skin) {
536 return; /* XXX do some debugging with this... */
538 var user_skin = getSkin();
539 var cur_skin = grabSkinFromURL();
541 if(new_skin) user_skin = new_skin;
546 if(grabUserPrefs()) {
547 user_skin = G.user.prefs["opac.skin"];
548 cookieManager.write( COOKIE_SKIN, user_skin, '+1y' );
553 if(!user_skin) return;
555 if( cur_skin != user_skin ) {
556 var url = buildOPACLink();
557 goTo(url.replace(cur_skin, user_skin));
561 function updateUserSetting(setting, value, user) {
562 if(user == null) user = G.user;
565 var req = new Request( UPDATE_USER_PREFS, user.session, a );
570 function commitUserPrefs() {
571 var req = new Request(
572 UPDATE_USER_PREFS, G.user.session, null, G.user.prefs );
577 function grabSkinFromURL() {
578 var path = findBasePath();
579 path = path.replace("/xml/", "");
581 for( var i = path.length - 1; i >= 0; i-- ) {
582 var ch = path.charAt(i);
588 for( i = skin.length - 1; i >= 0; i--)
589 skin2 += skin.charAt(i);
595 /* returns a fleshed G.user on success, false on failure */
596 function doLogin(suppressEvents) {
600 var uname = G.ui.login.username.value;
601 var passwd = G.ui.login.password.value;
603 var init_request = new Request( LOGIN_INIT, uname );
604 init_request.send(true);
605 var seed = init_request.result();
607 if( ! seed || seed == '0') {
608 alert( "Error Communicating with Authentication Server" );
613 password : hex_md5(seed + hex_md5(passwd)),
615 org : getOrigLocation()
618 if( uname.match(REGEX_BARCODE) ) args.barcode = uname; /* make this better */
619 else args.username = uname;
621 var auth_request = new Request( LOGIN_COMPLETE, args );
623 auth_request.request.alertEvent = false;
624 auth_request.send(true);
625 var auth_result = auth_request.result();
628 alertId('patron_login_failed');
632 if( checkILSEvent(auth_result) ) {
634 if( auth_result.textcode == 'PATRON_INACTIVE' ) {
635 alertId('patron_inactive_alert');
639 if( auth_result.textcode == 'PATRON_CARD_INACTIVE' ) {
640 alertId('patron_card_inactive_alert');
644 if( auth_result.textcode == 'LOGIN_FAILED' ||
645 auth_result.textcode == 'PERM_FAILURE' ) {
646 alertId('patron_login_failed');
652 AUTHTIME = parseInt(auth_result.payload.authtime);
653 var u = grabUser(auth_result.payload.authtoken, true);
654 if(u && ! suppressEvents)
655 runEvt( "common", "locationChanged", u.ws_ou(), findOrgDepth(u.ws_ou()) );
662 function doLogout(noredirect) {
664 /* cancel everything else */
667 /* be nice and delete the session from the server */
668 if(G.user && G.user.session) {
669 var req = new Request(LOGIN_DELETE, G.user.session);
671 try { req.result(); } catch(E){}
676 /* remove any cached data */
677 //cookieManager.remove(COOKIE_IDS);
678 //cookieManager.remove(COOKIE_SRIDS);
679 cookieManager.remove(COOKIE_RIDS);
680 cookieManager.remove(COOKIE_SES);
681 cookieManager.remove(COOKIE_SKIN);
683 checkUserSkin("default");
688 args[PARAM_TERM] = "";
689 args[PARAM_LOCATION] = getOrigLocation();
690 args[PARAM_DEPTH] = findOrgDepth(getOrigLocation());
695 try{ if(isFrontPage) nored = true; } catch(e){nored = false;}
696 if(!nored) goTo(buildOPACLink(args));
700 function hideMe(obj) { addCSSClass(obj, config.css.hide_me); }
701 function unHideMe(obj) { removeCSSClass(obj, config.css.hide_me); }
704 /* ----------------------------------------------------------------------- */
705 /* build the org tree */
706 /* ----------------------------------------------------------------------- */
707 function drawOrgTree() {
708 //setTimeout( 'buildOrgSelector(G.ui.common.org_tree, orgTreeSelector);', 10 );
709 setTimeout( 'buildOrgSelector(G.ui.common.org_tree, orgTreeSelector);', 1 );
713 function buildOrgSelector(node) {
714 var tree = new SlimTree(node,'orgTreeSelector');
715 orgTreeSelector = tree;
716 for( var i in orgArraySearcher ) {
717 var node = orgArraySearcher[i];
718 if( node == null ) continue;
719 if(node.parent_ou() == null)
720 tree.addNode(node.id(), -1, node.name(),
721 "javascript:orgSelect(" + node.id() + ");", node.name());
723 tree.addNode(node.id(), findOrgUnit(node.parent_ou()).id(), node.name(),
724 "javascript:orgSelect(" + node.id() + ");", node.name());
727 hideMe($('org_loading_div'));
728 unHideMe($('org_selector_tip'));
732 function orgSelect(id) {
734 runEvt("common", "locationChanged", id, findOrgDepth(id) );
736 removeChildren(G.ui.common.now_searching);
737 G.ui.common.now_searching.appendChild(text(findOrgUnit(id).name()));
740 function setFontSize(size) {
742 cookieManager.write(COOKIE_FONT, size, '+1y');
746 var resourceFormats = [
749 "sound recording", "software, multimedia",
754 "three dimensional object" ];
757 function modsFormatToMARC(format) {
763 case "sound recording":
765 case "sound recording-nonmusical":
767 case "sound recording-musical":
769 case "software, multimedia":
775 case "mixed material":
777 case "notated music":
779 case "three dimensional object":
786 function MARCFormatToMods(format) {
792 return "moving image";
794 return "sound recording-nonmusical";
796 return "sound recording-musical";
798 return "software, multimedia";
800 return "still images";
803 return "cartographic";
806 return "mixed material";
809 return "notated music";
811 return "three dimensional object";
816 function MARCTypeToFriendly(format) {
817 var words = $('format_words');
820 case 't' : return $n(words, 'at').innerHTML;
822 var node = $n(words,format);
823 if( node ) return node.innerHTML;
828 function setResourcePic( img, resource ) {
829 img.setAttribute( "src", "../../../../images/tor/" + resource + ".jpg");
830 img.title = resource;
835 function msg( text ) {
836 try { alert( text ); } catch(e) {}
839 function findRecord(id,type) {
841 for( var i = 0; i != recordsCache.length; i++ ) {
842 var rec = recordsCache[i];
843 if( rec && rec.doc_id() == id ) return rec;
846 var meth = FETCH_RMODS
847 if(type == 'M') meth = FETCH_MRMODS;
848 var req = new Request(meth, id);
849 req.request.alertEvent = false;
851 var res = req.result();
852 if( checkILSEvent(res) ) return null;
855 function Timer(name, node){
860 Timer.prototype.start =
861 function(){_timerRun(this.name);}
862 Timer.prototype.stop =
863 function(){this.done = true;}
864 function _timerRun(tname) {
868 if(_t.count > 100) return;
870 if( (_t.count % 5) == 0 )
872 _t.node.appendChild(text(str));
873 setTimeout("_timerRun('"+tname+"');", 200);
877 function checkILSEvent(obj) {
878 if( obj && obj.ilsevent != null && obj.ilsevent != 0 )
879 return parseInt(obj.ilsevent);
884 function alertILSEvent(evt, msg) {
887 alert(msg +'\n' + evt.textcode + '\n' + evt.desc );
889 alert(evt.textcode + '\n' + evt.desc );
894 function AuthTimer(time) {
895 this.time = (time - LOGOUT_WARNING_TIME) * 1000;
897 try {clearTimeout(__authTimer.id)} catch(e){}
901 AuthTimer.prototype.run = function() {
902 this.id = setTimeout('_authTimerAlert()', this.time);
905 function _authTimerAlert() {
906 alert( $('auth_session_expiring').innerHTML );
907 if(!grabUser(null, true)) doLogout();
911 function grabUserByBarcode( authtoken, barcode ) {
912 var req = new Request( FETCH_USER_BYBARCODE, authtoken, barcode );
919 goTo(buildOPACLink({page:HOME}));
923 function buildOrgSel(selector, org, offset) {
924 insertSelectorVal( selector, -1,
925 org.name(), org.id(), null, findOrgDepth(org) - offset );
926 for( var c in org.children() )
927 buildOrgSel( selector, org.children()[c], offset);
931 function parseForm(form) {
934 var it = form.replace(/-\w+$/,"");
939 if(form.match(/-/)) itf = form.replace(/^\w+-/,"");
943 for( var i = 0; i < it.length; i++ )
944 item_type.push( it.charAt(i) );
949 for( var i = 0; i < itf.length; i++ )
950 item_form.push( itf.charAt(i) );
953 return {item_type: item_type, item_form:item_form};
957 function isTrue(x) { return ( x && x != "0" && !(x+'').match(/^f$/i) ); }
959 function fetchPermOrgs() {
960 var a = []; /* why does arguments come accross as an object and not an array? */
961 for( var i = 0; i < arguments.length; i++ )
964 var preq = new Request(FETCH_HIGHEST_PERM_ORG,
965 G.user.session, G.user.id(), a );
967 return preq.result();