[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/layouts/vlayout/modules/Settings/SMSNotifier/resources/ -> List.js (source)

   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  Settings_Vtiger_List_Js("Settings_SMSNotifier_List_Js",{
  11      
  12      /**
  13       * Function to trigger edit and add new configuration for SMS server
  14       */
  15      triggerEdit : function(event, url) {
  16          event.stopPropagation();
  17          var instance = Vtiger_List_Js.getInstance();
  18          instance.EditRecord(url);
  19      },
  20      
  21      /**
  22       * Function to trigger delete SMS provider Configuration
  23       */
  24      triggerDelete : function(event,url){
  25          event.stopPropagation();
  26          var instance = Vtiger_List_Js.getInstance();
  27          instance.DeleteRecord(url);
  28      }
  29      
  30  },{
  31      /**
  32       * Function to show the SMS Provider configuration details for edit and add new
  33       */
  34      EditRecord : function(url) {
  35          var thisInstance = this;
  36          AppConnector.request(url).then(
  37              function(data) {
  38                  
  39                  var callBackFunction = function(data) {
  40                      var form = jQuery('#smsConfig');
  41                      
  42                      thisInstance.registerProviderTypeChangeEvent(form);
  43                      
  44                      var params = app.getvalidationEngineOptions(true);
  45                      params.onValidationComplete = function(form, valid){
  46                          if(valid) {
  47                              thisInstance.saveConfiguration(form).then(
  48                                  function(data) {
  49                                      if(data['success']) {
  50                                          var params = {};
  51                                          params['text'] = app.vtranslate('JS_CONFIGURATION_SAVED');
  52                                          Settings_Vtiger_Index_Js.showMessage(params);
  53                                          thisInstance.getListViewRecords();
  54                                      }
  55                                  },
  56                                  function(error, err) {
  57  
  58                                  }
  59                              );
  60                          }
  61                          //To prevent form submit
  62                          return false;
  63                      }
  64                      form.validationEngine(params);
  65                      
  66                  }
  67                  
  68                  app.showModalWindow(data,function(data) {
  69                      if(typeof callBackFunction == 'function') {
  70                          callBackFunction(data);
  71                      }
  72                  });
  73              },
  74              function(error,err){
  75              }
  76          );
  77      },
  78      
  79      /**
  80       * Function to register change event for SMS server Provider Type
  81       */
  82      registerProviderTypeChangeEvent : function(form) {
  83          var thisInstance = this;
  84          var contents = form.find('.configContent');
  85          form.find('.providerType').change(function(e) {
  86              var currentTarget = jQuery(e.currentTarget);
  87              var selectedProviderName = currentTarget.val(); 
  88              jQuery('.providerFields',form).addClass('hide'); 
  89              jQuery('#'+selectedProviderName+'_container').removeClass('hide'); 
  90  
  91          })
  92      },
  93      
  94      /**
  95       * Function to save the SMS Server Configuration Details from edit and Add new configuration 
  96       */
  97      saveConfiguration : function(form) {
  98          var thisInstance = this;
  99          var aDeferred = jQuery.Deferred();
 100          var progressIndicatorElement = jQuery.progressIndicator({
 101              'position' : 'html',
 102              'blockInfo' : {
 103                  'enabled' : true
 104              }
 105          });
 106          
 107          var params = form.serializeFormData();
 108          params['module'] = app.getModuleName();
 109          params['parent'] = app.getParentModuleName();
 110          params['action'] = 'SaveAjax';
 111          
 112          AppConnector.request(params).then(
 113              function(data) {
 114                  progressIndicatorElement.progressIndicator({'mode' : 'hide'});
 115                  aDeferred.resolve(data);
 116              },
 117              function(error) {
 118                  progressIndicatorElement.progressIndicator({'mode' : 'hide'});
 119                  aDeferred.reject(error);
 120              }
 121          );
 122          return aDeferred.promise();
 123      },
 124      
 125      /**
 126       * Function to delete Configuration for SMS Provider
 127       */
 128      DeleteRecord : function(url) {
 129          var thisInstance = this;
 130          var message = app.vtranslate('LBL_DELETE_CONFIRMATION');
 131          Vtiger_Helper_Js.showConfirmationBox({'message' : message}).then(
 132              function(e) {
 133                  AppConnector.request(url).then(
 134                      function() {
 135                          var params = {
 136                              text: app.vtranslate('JS_RECORD_DELETED_SUCCESSFULLY')
 137                          };
 138                          Settings_Vtiger_Index_Js.showMessage(params);
 139                          thisInstance.getListViewRecords();
 140                      },
 141                      function(error,err){
 142                      }
 143                  );
 144              },
 145              function(error, err){
 146              }
 147          );
 148      },
 149      
 150      /**
 151       * Function to register all the events
 152       */
 153      registerEvents : function() {
 154          //this.triggerDisplayTypeEvent();
 155          this.registerPageNavigationEvents();
 156      }
 157  })


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1