⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 email.js

📁 SugarCRM5.1 开源PHP客户关系管理系统
💻 JS
📖 第 1 页 / 共 3 页
字号:
/** * EditView javascript for Email * * 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". */var uploads_arr=new Array();var uploads_count_map=new Object();var uploads_count = -1;var current_uploads_id = -1;var append = false; // Ed has method InsertHTML which inserts at cursor point - plain does not//following varaibles store references to input fields grouped with the clicked email selection button (select).var current_contact = '';var current_contact_id = '';var current_contact_email = '';var current_contact_name = '';var uploadIndex = 0;var select_image = SUGAR.language.get('app_strings', 'LBL_ONLY_IMAGE_ATTACHMENT');var lbl_remove = SUGAR.language.get('app_strings', 'LBL_REMOVE');function toggleRawEmail() {	var raw = document.getElementById('rawEmail');	var button = document.getElementById('rawButton');	if(raw.style.display == '') {		raw.style.display = 'none';		button.value = showRaw;	} else {		raw.style.display = '';		button.value = hideRaw;	}}///////////////////////////////////////////////////////////////////////////////////	DOCUMENT HANDLING HELPERSfunction deletePriorAttachment(id) {	var rem = document.getElementById('removeAttachment');	if(rem.value != '') {		rem.value += "::";	}	rem.value += id;	document.getElementById('noteDiv'+id).style.display = 'none';}function setDocument(target, documentId, documentName, docRevId) {	if(window.opener.SUGAR.email2) {		var idx = window.opener.SUGAR.email2.composeLayout.currentInstanceId;		window.opener.SUGAR.email2.composeLayout.setDocument(idx, target, documentId, documentName, docRevId);	} else {		var docId = window.opener.document.getElementById('documentId' + target);		var docName = window.opener.document.getElementById('documentName' + target);		var docRevisionId = window.opener.document.getElementById('document' + target);	    docId.value = documentId;		docName.value = documentName;		docRevisionId.value = docRevId;	}	window.close();}function setDocumentToCampaignTemplate(target, documentId, documentName,docRevId, documentType) {//	var docId = eval("window.opener.document.forms.EditView.documentId" + target);	var docId = window.opener.document.getElementById('documentId' + target);	//var docName = eval("window.opener.document.EditView.documentName" + target);	var docName = window.opener.document.getElementById('documentName' + target);	var docType = window.opener.document.getElementById('documentType' + target);	var docId = window.opener.document.getElementById('documentId');	var docName = window.opener.document.getElementById('documentName');	var docRevisionId = window.opener.document.getElementById('docRevId');	var docType = window.opener.document.getElementById('documentType');    docId.value = documentId;    //docId.onchange('docUpload(); form_reset_doc();');	docName.value = documentName;	docRevisionId.value = docRevId;	docType.value = documentType;	docName.onchange('docUpload(); form_reset_doc();');	//alert(docName.onchange);	window.close();}function selectDocument(target) {	URL="index.php?module=Emails&action=PopupDocuments&to_pdf=true&target=" + target;	windowName = 'selectDocument';	windowFeatures = 'width=800' + ',height=600' + ',resizable=1,scrollbars=1';	win = window.open(URL, windowName, windowFeatures);	if(window.focus) {		// put the focus on the popup if the browser supports the focus() method		win.focus();	}}function addDocument() {	for(var i=0;i<10;i++) {		var elem = document.getElementById('document'+i);		if(elem.style.display == 'none') {		  	elem.style.display='block';			break;		}	}}function deleteDocument(index) {	var elem = document.getElementById('document'+index);	document.getElementById('documentId'+index).value = "";	document.getElementById('documentName'+index).value = "";	elem.style.display='none';}// attachment functions belowfunction deleteFile(index) {	//get div element	var elem = document.getElementById('file'+index);	//get upload widget	var ea_input = document.getElementById('email_attachment'+index);	//get the parent node	var Parent = ea_input.parentNode;	//create replacement node	var ea = document.createElement('input');    ea.setAttribute('id', 'email_attachment' + index);    ea.setAttribute('name', 'email_attachment' + index);    ea.setAttribute('tabindex', '120');    ea.setAttribute('size', '40');    ea.setAttribute('type', 'file');	//replace the old node with the new one    Parent.replaceChild(ea, ea_input);	//hide the div element	elem.style.display='none';}function addFile() {	for(var i=0;i<10;i++) {		var elem = document.getElementById('file'+i);		if(elem.style.display == 'none') {		  	elem.style.display='block';			break;		}	}}////	END DOCUMENT HANDLING HELPERS//////////////////////////////////////////////////////////////////////////////////// New file upload codefunction multiFiles( list_target){	// Where to write the list    this.list_target = list_target;	//this.list_target = document.getElementById(list_target);	// How many elements?	this.count = 0;	// How many elements?	this.id = 0;	// Is there a maximum?	//alert("test");	/**	 * Add a new file input element	 */	this.addElement = function( element ){		// Make sure it's a file input element		if( element.tagName == 'INPUT' && element.type == 'file' ){  		    var currCount =this.id++;			// Element name -- what number am I?			//element.name = 'file_' + this.id++;		   	 element.name = 'email_attachment' + currCount;		   	 element.id   = 'email_attachment' + currCount;			// Add reference to this object			element.multi_selector = this;			// What to do when a file is selected	       element.onchange = function(){	        //AJAX call begins	        var callback = {		     upload:function(r) {		     //console.log("response object: %o", r);             var rets = JSON.parse(r.responseText);		     }	        }	      var url ='index.php?module=EmailTemplates&action=AttachFiles';		 YAHOO.util.Connect.setForm(document.getElementById("upload_form"), true,true);         YAHOO.util.Connect.asyncRequest('POST', url, callback,null);      //AJAX call ends               //var theForm = document.getElementById('upload_form');                 var theForm = document.getElementById('EditView');				// New file input				var new_element = document.createElement( 'input' );				new_element.type = 'file';		   	   // new_element.name = 'email_attachment' +up++;				// Add new element				this.parentNode.insertBefore( new_element, this );				// Apply 'update' to element				this.multi_selector.addElement( new_element );				// Update list				this.multi_selector.addListRow( this );				// Hide this: we can't use display:none because Safari doesn't like it                 //this.style.display='none';                //display none works fine for FF and IE                this.style.display = 'none';                //later for Safari add following				//this.style.position = 'absolute';				//this.style.left = '-5000px';		};			// File element counter			this.count++;			// Most recent element			this.current_element = element;		} else {			// This can only be applied to file input elements!			alert( 'Error: not a file input element' );		};	};	/**	 * Add a new row to the list of files	 */	this.addListRow = function( element ){		// Row div		var new_row = document.createElement( 'div' );		// Delete button		var new_row_button_remove = document.createElement( 'input' );        new_row_button_remove.type = 'button';        new_row_button_remove.value = lbl_remove;		var new_row_file_name = document.createElement( 'input' );		new_row_file_name.type = 'text';		new_row_file_name.size = '40';		new_row_file_name.disabled=true;		var new_row_chk_box = document.createElement( 'input' );		new_row_chk_box.setAttribute('id','checkBoxFile[]');		new_row_chk_box.setAttribute('name','checkBoxFile[]');		new_row_chk_box.type = 'checkbox';		new_row_chk_box.checked =false;		new_row_chk_box.disabled =true;	   var new_row_attach_file = document.createElement( 'input' );	   new_row_attach_file.type = 'image';       new_row_attach_file.value ='/themes/Sugar/images/company_logo.png';       new_row_attach_file.disabled ='true';    var imgElement = document.createElement("img");	imgElement.setAttribute("src", "themes/default/images/Accounts.gif");	imgElement.setAttribute("align","absmiddle");	imgElement.setAttribute("alt","File");	imgElement.setAttribute("border","0");	imgElement.setAttribute("height","16");	imgElement.setAttribute("width","16");	var new_row_button_embed = document.createElement("img");	new_row_button_embed.setAttribute("src", "themes/default/images/attachment.gif");	new_row_button_embed.setAttribute("align","absmiddle");	new_row_button_embed.setAttribute("alt","Embed");	new_row_button_embed.setAttribute("border","0");	new_row_button_embed.setAttribute("height","16");	new_row_button_embed.setAttribute("width","16");       /*		var new_row_button_embed = document.createElement( 'input' );        new_row_button_embed.type = 'button';		new_row_button_embed.value = 'Embed';       */		// References		new_row.element = element;        element.size='40';		// Delete function		new_row_button_remove.onclick= function(){			// Remove element from form			this.parentNode.element.parentNode.removeChild( this.parentNode.element );			var filename = this.parentNode.element.value;			var filename =  filename.replace(/\\/g,'/');			var text = filename.split("/");			nbr_elements = text.length;	    	if(text[nbr_elements-1].indexOf('gif')>=0 || text[nbr_elements-1].indexOf('bmp') >= 0 || text[nbr_elements-1].indexOf('png') >= 0	    	   || text[nbr_elements-1].indexOf('jpg') >= 0 || text[nbr_elements-1].indexOf('GIF')>=0 || text[nbr_elements-1].indexOf('BMP') >= 0	    	   || text[nbr_elements-1].indexOf('PNG') >= 0 || text[nbr_elements-1].indexOf('JPG') >= 0)	    	   {	    		//var imglocation = unescape(document.location.pathname.substr(1));	    		//imglocation = imglocation.substring(0,imglocation.lastIndexOf('/')+1);                var tiny = tinyMCE.getInstanceById('body_text');				var currValTiny = tiny.getHTML();	            while(currValTiny.indexOf(unescape(text[nbr_elements-1])) != -1){				   //check where the space is and keep replacing with $#32				   currValTiny = currValTiny.replace(unescape(text[nbr_elements-1]),'QW%%^%%WQ');                   currValTiny = currValTiny.replace(/<img[^<]*QW%%\^%%WQ[^>]*>?/,'&#32');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -