[ 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 10 Vtiger_Edit_Js("EmailTemplates_Edit_Js",{},{ 11 12 /** 13 * Function to register event for ckeditor for description field 14 */ 15 registerEventForCkEditor : function(){ 16 var templateContentElement = jQuery("#templatecontent"); 17 if(templateContentElement.length > 0) { 18 var ckEditorInstance = new Vtiger_CkEditor_Js(); 19 ckEditorInstance.loadCkEditor(templateContentElement); 20 } 21 this.registerFillTemplateContentEvent(); 22 }, 23 24 /** 25 * Function which will register module change event 26 */ 27 registerChangeEventForModule : function(){ 28 var thisInstance = this; 29 var advaceFilterInstance = Vtiger_AdvanceFilter_Js.getInstance(); 30 var filterContainer = advaceFilterInstance.getFilterContainer(); 31 filterContainer.on('change','select[name="modulename"]',function(e){ 32 thisInstance.loadFields(); 33 }); 34 }, 35 36 /** 37 * Function to load condition list for the selected field 38 * @params : fieldSelect - select element which will represents field list 39 * @return : select element which will represent the condition element 40 */ 41 loadFields : function() { 42 var moduleName = jQuery('select[name="modulename"]').val(); 43 var allFields = jQuery('[name="moduleFields"]').data('value'); 44 var fieldSelectElement = jQuery('select[name="templateFields"]'); 45 var options = ''; 46 for(var key in allFields) { 47 //IE Browser consider the prototype properties also, it should consider has own properties only. 48 if(allFields.hasOwnProperty(key) && key == moduleName) { 49 var moduleSpecificFields = allFields[key]; 50 var len = moduleSpecificFields.length; 51 for (var i = 0; i < len; i++) { 52 var fieldName = moduleSpecificFields[i][0].split(':'); 53 options += '<option value="'+moduleSpecificFields[i][1]+'"'; 54 if(fieldName[0] == moduleName) { 55 options += '>'+fieldName[1]+'</option>'; 56 } else { 57 options += '>'+moduleSpecificFields[i][0]+'</option>'; 58 } 59 } 60 } 61 } 62 63 if(options == '') 64 options = '<option value="">NONE</option>'; 65 66 fieldSelectElement.empty().html(options).trigger("liszt:updated"); 67 return fieldSelectElement; 68 69 }, 70 71 registerFillTemplateContentEvent : function() { 72 jQuery('#templateFields').change(function(e){ 73 var textarea = CKEDITOR.instances.templatecontent; 74 var value = jQuery(e.currentTarget).val(); 75 textarea.insertHtml(value); 76 }); 77 }, 78 79 /** 80 * Registered the events for this page 81 */ 82 registerEvents : function() { 83 this.registerEventForCkEditor(); 84 this.registerChangeEventForModule(); 85 //jQuery('#EditView').validationEngine(); 86 this._super(); 87 } 88 }); 89
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 |