From f266ed4c0593612a6d69dcdd23a94f8bbab3bf14 Mon Sep 17 00:00:00 2001 From: erickson Date: Fri, 6 Mar 2009 03:48:51 +0000 Subject: [PATCH] backporting IE fixes git-svn-id: svn://svn.open-ils.org/OpenSRF/branches/rel_1_0@1674 9efc2488-bf62-4759-914b-345cdb29e865 --- src/javascript/DojoSRF.js | 4 ++-- src/javascript/opensrf.js | 6 +++--- src/javascript/opensrf_xhr.js | 11 ++++++++++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/javascript/DojoSRF.js b/src/javascript/DojoSRF.js index aa06c6b..6529505 100644 --- a/src/javascript/DojoSRF.js +++ b/src/javascript/DojoSRF.js @@ -20,12 +20,12 @@ if(!dojo._hasResource['DojoSRF']){ localeRE = /^(\w\w)(-\w\w)?$/; localeMatch = localeRE.exec(dojo.locale); - if (!localeMatch[1]) { + if (!localeMatch || !localeMatch[1]) { OpenSRF.locale = dojo.isIE ? navigator.userLanguage : navigator.language; } else { OpenSRF.locale = localeMatch[1].toLowerCase(); } - if (localeMatch[2]) { + if (localeMatch && localeMatch[2]) { OpenSRF.locale = OpenSRF.locale + localeMatch[2].toUpperCase(); } } diff --git a/src/javascript/opensrf.js b/src/javascript/opensrf.js index ecdfe09..b543de8 100644 --- a/src/javascript/opensrf.js +++ b/src/javascript/opensrf.js @@ -54,7 +54,7 @@ OpenSRF.set_subclass = function(cls, pcls) { var str = cls+'.prototype = new '+pcls+'();'; str += cls+'.prototype.constructor = '+cls+';'; str += cls+'.baseClass = '+pcls+'.prototype.constructor;'; - str += cls+'.prototype.super = '+pcls+'.prototype;'; + str += cls+'.prototype["super"] = '+pcls+'.prototype;'; eval(str); } @@ -123,7 +123,7 @@ OpenSRF.ClientSession.prototype.connect = function(args) { message = new osrfMessage({ 'threadTrace' : this.reqid, - 'type' : OSRF_MESSAGE_TYPE_CONNECT, + 'type' : OSRF_MESSAGE_TYPE_CONNECT }); this.send(message, {'timeout' : this.timeout}); @@ -137,7 +137,7 @@ OpenSRF.ClientSession.prototype.disconnect = function(args) { this.send( new osrfMessage({ 'threadTrace' : this.reqid, - 'type' : OSRF_MESSAGE_TYPE_DISCONNECT, + 'type' : OSRF_MESSAGE_TYPE_DISCONNECT }) ); this.remote_id = null; diff --git a/src/javascript/opensrf_xhr.js b/src/javascript/opensrf_xhr.js index 76d8473..8cace89 100644 --- a/src/javascript/opensrf_xhr.js +++ b/src/javascript/opensrf_xhr.js @@ -27,7 +27,16 @@ var OSRF_POST_CONTENT_TYPE = 'application/x-www-form-urlencoded'; OpenSRF.XHRequest = function(osrf_msg, args) { this.message = osrf_msg; this.args = args; - this.xreq = new XMLHttpRequest(); /* XXX browser check */ + try { + this.xreq = new XMLHttpRequest(); + } catch(e) { + try { + this.xreq = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e2) { + this.xreq = new ActiveXObject("Microsoft.XMLHTTP"); + } + } + } OpenSRF.XHRequest.prototype.send = function() { -- 2.11.0