/** * @author Santosh Shrestha * @copyright RUMSAN associates */ RS={}; RS.ProcessFile='/sept08/processForm.aspx' RS.SID='frkphy55fffptb45rxivug55' // Extend Ext Classes Ext.apply(Ext.form.Label.prototype,{ setHtml: function(text) { this.el.dom.innerHTML = text;//Ext.util.Format.htmlEncode(text); }, getHtml: function() { return this.el.dom.innerHTML; } }); // End Extend RS.RemoteMethods = function() {}; RS.RemoteMethods.prototype = { exec: function(params, OnSuccess, scope) { this._invoke(params, OnSuccess, scope); }, _invoke: function(params, OnSuccess, scope) { var conn = new Ext.data.Connection(); Ext.Ajax.request({ url: RS.ProcessFile, method: 'POST', params: params, //Ext.util.JSON.encode(params), scope: scope, callback: function(options, success, response) { var result =Ext.util.JSON.decode(response.responseText); if (success) { if(OnSuccess) OnSuccess.call(scope, result); } else { var msg = (result && result.Message) ? result.Message : 'Some error happend. Please try again'; Ext.MessageBox.alert('Error', msg); } } }); } } RS.remoteCall = new RS.RemoteMethods(); RS.remoteCmd = function(cmd,args,onSuccess,scope){ RS.remoteCall.exec({cmd:cmd,args:Ext.encode(args)},onSuccess,scope) } function Left(str, n){ if (n <= 0) return ""; else if (n > String(str).length) return str; else return String(str).substring(0,n); }; function Right(str, n){ if (n <= 0) return ""; else if (n > String(str).length) return str; else { var iLen = String(str).length; return String(str).substring(iLen, iLen - n); } }; RS.InsertCSSRule = function(selector,declaration){ if (document.styleSheets[0].insertRule) { //if not IE var lastrule = document.styleSheets[0].cssRules.length; document.styleSheets[0].insertRule(selector + declaration, lastrule); } else if (document.styleSheets[0].addRule) { //if IE var lastrule = document.styleSheets[0].rules.length; document.styleSheets[0].addRule(selector, declaration, lastrule); } } RS.CreateIconCls = function(selector,iconPath,defaultPath){ defaultPath ? RS.InsertCSSRule ('.' + selector,'{background-image: url('+ RS.IconPath + iconPath +') !important;}') : RS.InsertCSSRule ('.' + selector,'{background-image: url('+ iconPath +') !important;}'); } function addDebugBar(renderTo){ if (RS.Debug) { using('RS.DebugBar'); var debugBar = new RS.DebugBar(this, { renderTo:renderTo }); } } function unicodeEscape (pstrString) { if (pstrString == "") { return ""; } var iPos = 0; var strOut = ""; var strChar; var strString = escape(pstrString); while (iPos < strString.length) { strChar = strString.substr(iPos, 1); if (strChar == "%") { strNextChar = strString.substr(iPos + 1, 1); if (strNextChar == "u") { strOut += strString.substr(iPos, 6); iPos += 6; } else { strOut += "%u00" + strString.substr(iPos + 1, 2); iPos += 3; } } else { strOut += strChar; iPos++; } } return strOut; }