[ 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 jQuery.Class("Settings_Vtiger_TermsAndConditions_Js",{},{ 11 12 //Contains Terms and Conditions container 13 container : false, 14 15 //return the container of Terms and Conditions 16 getContainer : function() { 17 if(this.container == false){ 18 this.container = jQuery('#TermsAndConditionsContainer'); 19 } 20 return this.container; 21 }, 22 23 /* 24 * Function to save the Terms & Conditions content 25 */ 26 saveTermsAndConditions : function(textAreaElement) { 27 var aDeferred = jQuery.Deferred(); 28 29 var tandcContent = textAreaElement.val(); 30 var params = { 31 'module' : app.getModuleName(), 32 'parent' : app.getParentModuleName(), 33 'action' : 'TermsAndConditionsSaveAjax', 34 'tandc' : tandcContent 35 } 36 37 AppConnector.request(params).then( 38 function(data) { 39 aDeferred.resolve(); 40 }, 41 function(error,err){ 42 aDeferred.reject(); 43 } 44 ); 45 return aDeferred.promise(); 46 }, 47 48 /* 49 * Function to register keyUp event for text area to show save button 50 */ 51 registerKeyUpEvent : function() { 52 var container = this.getContainer(); 53 container.find('.contents').one('keyup', '.TCContent', function(e) { 54 jQuery('.saveTC', container).removeClass('hide'); 55 }); 56 }, 57 58 registerEvents: function() { 59 var thisInstance = this; 60 var container = thisInstance.getContainer(); 61 var textAreaElement = jQuery('.TCContent', container); 62 var saveButton = jQuery('.saveTC', container); 63 64 //register text area fields to autosize 65 app.registerEventForTextAreaFields(textAreaElement); 66 thisInstance.registerKeyUpEvent(); 67 68 //Register click event for save button 69 saveButton.click(function(e) { 70 saveButton.addClass('hide'); 71 var progressIndicatorElement = jQuery.progressIndicator({ 72 'position' : 'html', 73 'blockInfo' : { 74 'enabled' : true 75 } 76 }); 77 78 //save the new T&C content 79 thisInstance.saveTermsAndConditions(textAreaElement).then( 80 function(data) { 81 progressIndicatorElement.progressIndicator({'mode' : 'hide'}); 82 thisInstance.registerKeyUpEvent(); 83 var params = { 84 text: app.vtranslate('JS_TERMS_AND_CONDITIONS_SAVED') 85 }; 86 Settings_Vtiger_Index_Js.showMessage(params); 87 }, 88 function(error){ 89 //TODO: Handle Error 90 } 91 ); 92 }) 93 } 94 95 }); 96 97 jQuery(document).ready(function(e){ 98 var tacInstance = new Settings_Vtiger_TermsAndConditions_Js(); 99 tacInstance.registerEvents(); 100 })
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 |