[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 /*+*********************************************************************************** 2 * The contents of this file are subject to the vtiger CRM Public License Version 1.0 3 * ("License"); You may not use this file except in compliance with the License 4 * The Original Code is: vtiger CRM Open Source 5 * The Initial Developer of the Original Code is vtiger. 6 * Portions created by vtiger are Copyright (C) vtiger. 7 * All Rights Reserved. 8 *************************************************************************************/ 9 var Vtiger_Emails_Js = { 10 11 /* 12 * function to load CKEditor 13 */ 14 loadCkEditor : function(){ 15 // var aDeferred = jQuery.Deferred(); 16 // data = data.children(); 17 // jQuery( '#editor1',data ).ckeditor(function(){ 18 // aDeferred.resolve(data); 19 // },{}); 20 // return aDeferred.promise(); 21 22 var instance = CKEDITOR.instances['description']; 23 if(instance) 24 { 25 CKEDITOR.remove(instance); 26 } 27 28 //configured ckeditor toolbar for vtiger 29 var Vtiger_ckeditor_toolbar = 30 [ 31 ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], 32 ['NumberedList','BulletedList','-','Outdent','Indent'], 33 ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], 34 ['Link','Unlink','Anchor'], 35 ['Source','-','NewPage','Preview','Templates'], 36 '/', 37 ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker'], 38 ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], 39 ['Image','Table','HorizontalRule','SpecialChar','PageBreak','TextColor','BGColor'], //,'Smiley','UniversalKey'], 40 '/', 41 ['Styles','Format','Font','FontSize'] 42 ]; 43 CKEDITOR.replace( 'description', 44 { 45 fullPage : true, 46 extraPlugins : 'docprops', 47 toolbar : Vtiger_ckeditor_toolbar 48 }); 49 50 jQuery('.blockPage').addClass('sendEmailBlock'); 51 }, 52 53 /** 54 * function to send the email 55 * return none 56 */ 57 SendEmailStep2 : function(form){ 58 var massSendEmailUrl = form.serializeFormData(); 59 app.hideModalWindow(); 60 AppConnector.request(massSendEmailUrl).then( 61 function(data) { 62 63 }, 64 function(error,err){ 65 66 } 67 ); 68 }, 69 70 /** 71 * function to display the email form 72 * return UI 73 */ 74 getComposeEmailForm : function(form){ 75 var massSendEmailUrl = form.serializeFormData(); 76 AppConnector.request(massSendEmailUrl).then( 77 function(data) { 78 app.hideModalWindow(); 79 app.showModalWindow(data,{'text-align' : 'left'}); 80 Vtiger_Emails_Js.loadCkEditor(); 81 Vtiger_Emails_Js.registerEvents(); 82 }, 83 function(error,err){ 84 85 } 86 ); 87 }, 88 89 /** 90 * function to call the registerevents of send Email step1 91 */ 92 registerComposeEmailStep1Events : function(){ 93 jQuery('.SendEmailFormStep1').on('submit',"#SendEmailFormStep1",function(e){ 94 var form = jQuery(e.currentTarget); 95 var chosenElement = jQuery('#composeEmailFields_chzn'); 96 var result = Vtiger_MultiSelect_Validator_Js.invokeValidation(chosenElement); 97 if(result == true){ 98 Vtiger_Emails_Js.getComposeEmailForm(form); 99 } else { 100 chosenElement.validationEngine('showPrompt', result , 'error','topRight',true); 101 return false; 102 } 103 e.preventDefault(); 104 }); 105 }, 106 107 registerEvents : function(){ 108 var composeEmailContainer = jQuery('.SendEmailFormStep2'); 109 110 composeEmailContainer.on('submit','#SendEmailFormStep2',function(e){ 111 var form = jQuery(e.currentTarget); 112 Vtiger_Emails_Js.SendEmailStep2(form); 113 e.preventDefault(); 114 }); 115 composeEmailContainer.on('click','#saveDraft',function(){ 116 jQuery('#flag').val("SAVED"); 117 }); 118 composeEmailContainer.on('click','#sendEmail',function(e){ 119 jQuery('#flag').val("SENT"); 120 }); 121 composeEmailContainer.on('click','#ccLink',function(e){ 122 jQuery('#ccContainer').show(); 123 jQuery(e.currentTarget).hide(); 124 }); 125 composeEmailContainer.on('click','#bccLink', function(e){ 126 jQuery('#bccContainer').show(); 127 jQuery(e.currentTarget).hide(); 128 }); 129 130 composeEmailContainer.on('click','#selectEmailTemplate',function(e){ 131 var url = jQuery(e.currentTarget).data('url'); 132 var popupInstance = Vtiger_Popup_Js.getInstance(); 133 popupInstance.show(url,function(data){ 134 var responseData = JSON.parse(data); 135 for(var id in responseData){ 136 var selectedName = responseData[id].name; 137 } 138 var editor = CKEDITOR.instances.description; 139 var edata = editor.getData(); 140 var replaced_text = edata.replace(edata, selectedName); 141 editor.setData(replaced_text); 142 }); 143 }); 144 jQuery('#SendEmailFormStep2').validationEngine(app.validationEngineOptions); 145 } 146 } 147
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |