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);
482 if(G.user.prefs['opac.hits_per_page'])
483 COUNT = parseInt(G.user.prefs['opac.hits_per_page']);
485 if(G.user.prefs[PREF_DEF_FONT])
486 setFontSize(G.user.prefs[PREF_DEF_FONT]);
488 var at = getAuthtime();
489 //if(isXUL()) at = xulG['authtime'];
491 if(at && !isXUL()) new AuthTimer(at).run();
496 /* sets the 'prefs' field of the user object to their preferences
497 and returns the preferences */
498 function grabUserPrefs(user, force) {
499 if(user == null) user = G.user;
500 if(!force && user.prefs) return user.prefs;
501 var req = new Request(FETCH_USER_PREFS, user.session, user.id());
503 user.prefs = req.result();
507 function grabFleshedUser() {
509 if(!G.user || !G.user.session) {
511 if(!G.user || !G.user.session) return null;
514 if(G.user.fleshed) return G.user;
516 var req = new Request(FETCH_FLESHED_USER, G.user.session);
519 G.user = req.result();
521 if(!G.user || G.user.length == 0) {
522 G.user = null; return false;
523 cookieManager.write(COOKIE_SES,"");
526 G.user.session = ses;
527 G.user.fleshed = true;
529 cookieManager.write(COOKIE_SES, ses, '+1y'); /* update the cookie */
533 function checkUserSkin(new_skin) {
535 return; /* XXX do some debugging with this... */
537 var user_skin = getSkin();
538 var cur_skin = grabSkinFromURL();
540 if(new_skin) user_skin = new_skin;
545 if(grabUserPrefs()) {
546 user_skin = G.user.prefs["opac.skin"];
547 cookieManager.write( COOKIE_SKIN, user_skin, '+1y' );
552 if(!user_skin) return;
554 if( cur_skin != user_skin ) {
555 var url = buildOPACLink();
556 goTo(url.replace(cur_skin, user_skin));
560 function updateUserSetting(setting, value, user) {
561 if(user == null) user = G.user;
564 var req = new Request( UPDATE_USER_PREFS, user.session, a );
569 function commitUserPrefs() {
570 var req = new Request(
571 UPDATE_USER_PREFS, G.user.session, null, G.user.prefs );
576 function grabSkinFromURL() {
577 var path = findBasePath();
578 path = path.replace("/xml/", "");
580 for( var i = path.length - 1; i >= 0; i-- ) {
581 var ch = path.charAt(i);
587 for( i = skin.length - 1; i >= 0; i--)
588 skin2 += skin.charAt(i);
594 /* returns a fleshed G.user on success, false on failure */
595 function doLogin(suppressEvents) {
599 var uname = G.ui.login.username.value;
600 var passwd = G.ui.login.password.value;
602 var init_request = new Request( LOGIN_INIT, uname );
603 init_request.send(true);
604 var seed = init_request.result();
606 if( ! seed || seed == '0') {
607 alert( "Error Communicating with Authentication Server" );
612 password : hex_md5(seed + hex_md5(passwd)),
614 org : getOrigLocation()
617 if( uname.match(REGEX_BARCODE) ) args.barcode = uname; /* make this better */
618 else args.username = uname;
620 var auth_request = new Request( LOGIN_COMPLETE, args );
622 auth_request.request.alertEvent = false;
623 auth_request.send(true);
624 var auth_result = auth_request.result();
627 alertId('patron_login_failed');
631 if( checkILSEvent(auth_result) ) {
633 if( auth_result.textcode == 'PATRON_INACTIVE' ) {
634 alertId('patron_inactive_alert');
638 if( auth_result.textcode == 'PATRON_CARD_INACTIVE' ) {
639 alertId('patron_card_inactive_alert');
643 if( auth_result.textcode == 'LOGIN_FAILED' ||
644 auth_result.textcode == 'PERM_FAILURE' ) {
645 alertId('patron_login_failed');
651 AUTHTIME = parseInt(auth_result.payload.authtime);
652 var u = grabUser(auth_result.payload.authtoken, true);
653 if(u && ! suppressEvents)
654 runEvt( "common", "locationChanged", u.ws_ou(), findOrgDepth(u.ws_ou()) );
661 function doLogout(noredirect) {
663 /* cancel everything else */
666 /* be nice and delete the session from the server */
667 if(G.user && G.user.session) {
668 var req = new Request(LOGIN_DELETE, G.user.session);
670 try { req.result(); } catch(E){}
675 /* remove any cached data */
676 //cookieManager.remove(COOKIE_IDS);
677 //cookieManager.remove(COOKIE_SRIDS);
678 cookieManager.remove(COOKIE_RIDS);
679 cookieManager.remove(COOKIE_SES);
680 cookieManager.remove(COOKIE_SKIN);
682 checkUserSkin("default");
687 args[PARAM_TERM] = "";
688 args[PARAM_LOCATION] = getOrigLocation();
689 args[PARAM_DEPTH] = findOrgDepth(getOrigLocation());
694 try{ if(isFrontPage) nored = true; } catch(e){nored = false;}
695 if(!nored) goTo(buildOPACLink(args));
699 function hideMe(obj) { addCSSClass(obj, config.css.hide_me); }
700 function unHideMe(obj) { removeCSSClass(obj, config.css.hide_me); }
703 /* ----------------------------------------------------------------------- */
704 /* build the org tree */
705 /* ----------------------------------------------------------------------- */
706 function drawOrgTree() {
707 //setTimeout( 'buildOrgSelector(G.ui.common.org_tree, orgTreeSelector);', 10 );
708 setTimeout( 'buildOrgSelector(G.ui.common.org_tree, orgTreeSelector);', 1 );
712 function buildOrgSelector(node) {
713 var tree = new SlimTree(node,'orgTreeSelector');
714 orgTreeSelector = tree;
715 for( var i in orgArraySearcher ) {
716 var node = orgArraySearcher[i];
717 if( node == null ) continue;
718 if(node.parent_ou() == null)
719 tree.addNode(node.id(), -1, node.name(),
720 "javascript:orgSelect(" + node.id() + ");", node.name());
722 tree.addNode(node.id(), findOrgUnit(node.parent_ou()).id(), node.name(),
723 "javascript:orgSelect(" + node.id() + ");", node.name());
726 hideMe($('org_loading_div'));
727 unHideMe($('org_selector_tip'));
731 function orgSelect(id) {
733 runEvt("common", "locationChanged", id, findOrgDepth(id) );
735 removeChildren(G.ui.common.now_searching);
736 G.ui.common.now_searching.appendChild(text(findOrgUnit(id).name()));
739 function setFontSize(size) {
741 cookieManager.write(COOKIE_FONT, size, '+1y');
745 var resourceFormats = [
748 "sound recording", "software, multimedia",
753 "three dimensional object" ];
756 function modsFormatToMARC(format) {
762 case "sound recording":
764 case "sound recording-nonmusical":
766 case "sound recording-musical":
768 case "software, multimedia":
774 case "mixed material":
776 case "notated music":
778 case "three dimensional object":
785 function MARCFormatToMods(format) {
791 return "moving image";
793 return "sound recording-nonmusical";
795 return "sound recording-musical";
797 return "software, multimedia";
799 return "still images";
802 return "cartographic";
805 return "mixed material";
808 return "notated music";
810 return "three dimensional object";
815 function MARCTypeToFriendly(format) {
816 var words = $('format_words');
819 case 't' : return $n(words, 'at').innerHTML;
821 var node = $n(words,format);
822 if( node ) return node.innerHTML;
827 function setResourcePic( img, resource ) {
828 img.setAttribute( "src", "../../../../images/tor/" + resource + ".jpg");
829 img.title = resource;
834 function msg( text ) {
835 try { alert( text ); } catch(e) {}
838 function findRecord(id,type) {
840 for( var i = 0; i != recordsCache.length; i++ ) {
841 var rec = recordsCache[i];
842 if( rec && rec.doc_id() == id ) return rec;
845 var meth = FETCH_RMODS
846 if(type == 'M') meth = FETCH_MRMODS;
847 var req = new Request(meth, id);
848 req.request.alertEvent = false;
850 var res = req.result();
851 if( checkILSEvent(res) ) return null;
854 function Timer(name, node){
859 Timer.prototype.start =
860 function(){_timerRun(this.name);}
861 Timer.prototype.stop =
862 function(){this.done = true;}
863 function _timerRun(tname) {
867 if(_t.count > 100) return;
869 if( (_t.count % 5) == 0 )
871 _t.node.appendChild(text(str));
872 setTimeout("_timerRun('"+tname+"');", 200);
876 function checkILSEvent(obj) {
877 if( obj && obj.ilsevent != null && obj.ilsevent != 0 )
878 return parseInt(obj.ilsevent);
883 function alertILSEvent(evt, msg) {
886 alert(msg +'\n' + evt.textcode + '\n' + evt.desc );
888 alert(evt.textcode + '\n' + evt.desc );
893 function AuthTimer(time) {
894 this.time = (time - LOGOUT_WARNING_TIME) * 1000;
896 try {clearTimeout(__authTimer.id)} catch(e){}
900 AuthTimer.prototype.run = function() {
901 this.id = setTimeout('_authTimerAlert()', this.time);
904 function _authTimerAlert() {
905 alert( $('auth_session_expiring').innerHTML );
906 if(!grabUser(null, true)) doLogout();
910 function grabUserByBarcode( authtoken, barcode ) {
911 var req = new Request( FETCH_USER_BYBARCODE, authtoken, barcode );
918 goTo(buildOPACLink({page:HOME}));
922 function buildOrgSel(selector, org, offset) {
923 insertSelectorVal( selector, -1,
924 org.name(), org.id(), null, findOrgDepth(org) - offset );
925 for( var c in org.children() )
926 buildOrgSel( selector, org.children()[c], offset);
930 function parseForm(form) {
933 var it = form.replace(/-\w+$/,"");
938 if(form.match(/-/)) itf = form.replace(/^\w+-/,"");
942 for( var i = 0; i < it.length; i++ )
943 item_type.push( it.charAt(i) );
948 for( var i = 0; i < itf.length; i++ )
949 item_form.push( itf.charAt(i) );
952 return {item_type: item_type, item_form:item_form};
956 function isTrue(x) { return ( x && x != "0" && !(x+'').match(/^f$/i) ); }
958 function fetchPermOrgs() {
959 var a = []; /* why does arguments come accross as an object and not an array? */
960 for( var i = 0; i < arguments.length; i++ )
963 var preq = new Request(FETCH_HIGHEST_PERM_ORG,
964 G.user.session, G.user.id(), a );
966 return preq.result();