📄 prototypeoverloads.js
字号:
/********************************************************************************* * SugarCRM is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License version 3 as published by the * Free Software Foundation with the addition of the following permission added * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program; if not, see http://www.gnu.org/licenses or write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301 USA. * * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU General Public License version 3. * * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by * SugarCRM" logo. If the display of the logo is not reasonably feasible for * technical reasons, the Appropriate Legal Notices must display the words * "Powered by SugarCRM". ********************************************************************************/YAHOO.util.Connect.uploadFile = function(id, callback, uri, postData){ // Each iframe has an id prefix of "yuiIO" followed // by the unique transaction id. var frameId = 'yuiIO' + id; var io = document.getElementById(frameId); /* * SUGAR - adding try/catch to this block as IE7 has some issue with this the first time it is called. */ // Initialize the HTML form properties in case they are // not defined in the HTML form. try { this._formNode.action = null; this._formNode.action = uri; } catch(e) { } this._formNode.method = 'POST'; this._formNode.target = frameId; if(this._formNode.encoding){ // IE does not respect property enctype for HTML forms. // Instead use property encoding. this._formNode.encoding = 'multipart/form-data'; } else{ this._formNode.enctype = 'multipart/form-data'; } if(postData){ var oElements = this.appendPostData(postData); } this._formNode.submit(); if(oElements && oElements.length > 0){ try { for(var i=0; i < oElements.length; i++){ this._formNode.removeChild(oElements[i]); } } catch(e){} } // Reset HTML form status properties. this.resetFormState(); // Create the upload callback handler that fires when the iframe // receives the load event. Subsequently, the event handler is detached // and the iframe removed from the document. var uploadCallback = function() { var obj = {}; obj.tId = id; obj.argument = callback.argument; try { obj.responseText = io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null; obj.responseXML = io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document; } catch(e){} if(callback.upload){ if(!callback.scope){ callback.upload(obj); } else{ callback.upload.apply(callback.scope, [obj]); } } if(YAHOO.util.Event){ YAHOO.util.Event.removeListener(io, "load", uploadCallback); } else if(window.detachEvent){ io.detachEvent('onload', uploadCallback); } else{ io.removeEventListener('load', uploadCallback, false); } setTimeout(function(){ document.body.removeChild(io); }, 100); }; // Bind the onload handler to the iframe to detect the file upload response. if(YAHOO.util.Event){ YAHOO.util.Event.addListener(io, "load", uploadCallback); } else if(window.attachEvent){ io.attachEvent('onload', uploadCallback); } else{ io.addEventListener('load', uploadCallback, false); }}/** * Need by autocomplete library? */YAHOO.register = function(name,mainClass,data) { var mods = YAHOO.env.modules; if(!mods[name]) { mods[name] = {versions:[],builds:[]}; } var m = mods[name], v = data.version, b = data.build, ls = YAHOO.env.listeners; m.name = name; m.version = v; m.build = b; m.versions.push(v); m.builds.push(b); m.mainClass = mainClass; for(var i = 0; i<ls.length; i = i+1) { ls[i](m); } if(mainClass) { mainClass.VERSION = v; mainClass.BUILD = b; } else { YAHOO.log("mainClass is undefined for module "+name,"warn"); }};YAHOO.lang = { isArray : function(obj) { if(obj && obj.constructor && obj.constructor.toString().indexOf('Array')>-1) { return true; } else { return YAHOO.lang.isObject(obj) && obj.constructor == Array; } }, isBoolean : function(obj) { return typeof obj == 'boolean'; }, isFunction : function(obj) { return typeof obj == 'function'; }, isNull : function(obj) { return obj == null; }, isNumber : function(obj) { return typeof obj == 'number' && isFinite(obj); }, isObject : function(obj) { return obj && (typeof obj == 'object'||YAHOO.lang.isFunction(obj)); }, isString : function(obj) { return typeof obj == 'string'; }, isUndefined : function(obj) { return typeof obj == 'undefined'; }, hasOwnProperty : function(obj,prop) { if(Object.prototype.hasOwnProperty) { return obj.hasOwnProperty(prop); } return !YAHOO.lang.isUndefined(obj[prop]) && obj.constructor.prototype[prop] !== obj[prop]; }, extend : function(subc,superc,overrides) { if(!superc||!subc) { throw new Error("YAHOO.lang.extend failed, please check that "+"all dependencies are included."); } }};/** * Adding some error checking since we're immediately transitioning to a modal dialogue in QuickCreate * and much of this class is unavailable YAHOO.widget.Menu.prototype._getOffsetWidth = function() { if(this.element) { var oClone = this.element.cloneNode(true); if(typeof(Dom) != 'undefined') { Dom.setStyle(oClone, "width", ""); document.body.appendChild(oClone); var sWidth = oClone.offsetWidth; document.body.removeChild(oClone); return sWidth; } }};*/Ext.Template.prototype.applyTemplate = function(values){ var myRE = /\{(\w+\.*\w*)\}/g; if(this.compiled){ return this.compiled(values); } var useF = this.disableFormats !== true; var fm = Ext.util.Format, tpl = this; var fn = function(m, name, format, args){ if(name.match(/\./g)) { var temp = name.split("."); values[name] = eval(temp[0] + "." + temp[1]); return values[name]; } else if(format && useF && typeof(format) == "string") { if(format.substr(0, 5) == "this."){ return tpl.call(format.substr(5), values[name], values); }else{ if(args){ var re = /^\s*['"](.*)["']\s*$/; args = args.split(','); for(var i = 0, len = args.length; i < len; i++){ args[i] = args[i].replace(re, "$1"); } args = [values[name]].concat(args); }else{ args = [values[name]]; } return fm[format].apply(fm, args); } }else{ return values[name] !== undefined ? values[name] : ""; } }; return this.html.replace(myRE, fn); };/* * Fixes an IE7 issue where this.dom.parentNode is null*/Ext.Element.prototype.remove = function() { if(this.dom.parentNode) { this.dom.parentNode.removeChild(this.dom); delete Ext.Element.cache[this.dom.id]; }}; //Adds translated strings to message boxesExt.onReady(function(){Ext.MessageBox.buttonText = { ok: app_strings.LBL_EMAIL_OK, cancel: app_strings.LBL_EMAIL_CANCEL, yes: app_strings.LBL_EMAIL_YES, no: app_strings.LBL_EMAIL_NO}});ContactsDragZone = function(view, config){ this.view = view; this.view.dragz = this; this.contacts = [ ]; ContactsDragZone.superclass.constructor.call(this, view.el, config);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -