[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/layouts/vlayout/modules/Emails/resources/ -> EmailPreview.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  jQuery.Class("Vtiger_EmailPreview_Js",{},{
  11      
  12      /**
  13       * Function to get email actions params
  14       */
  15      getEmailActionsParams : function(mode){
  16          var parentRecord = new Array();
  17          var parentRecordId = jQuery('[name="parentRecord"]').val();
  18          parentRecord.push(parentRecordId);
  19          var recordId = jQuery('[name="recordId"]').val();
  20          var params = {};
  21          params['module'] = "Emails";
  22          params['view'] = "ComposeEmail";
  23          params['selected_ids'] = parentRecord;
  24          params['record'] = recordId;
  25          params['mode'] = mode;
  26          params['parentId'] = parentRecordId;
  27          params['relatedLoad'] = true;
  28          
  29          return params;
  30      },
  31      
  32      /**
  33       * Function to register events for action buttons of email preview
  34       */
  35      registerEventsForActionButtons : function(){
  36          var thisInstance = this;
  37          jQuery('[name="previewForward"],[name="previewEdit"], [name="previewPrint"]').on('click',function(e){
  38              var module = "Emails";
  39              Vtiger_Helper_Js.checkServerConfig(module).then(function(data){
  40                  if(data == true){
  41                      var mode = jQuery(e.currentTarget).data('mode');
  42                      var params = thisInstance.getEmailActionsParams(mode);
  43                      var urlString = (typeof params == 'string')? params : jQuery.param(params);
  44                      var url = 'index.php?'+urlString;
  45                      self.location.href = url;
  46                  } else {
  47                      Vtiger_Helper_Js.showPnotify(app.vtranslate('JS_EMAIL_SERVER_CONFIGURATION'));
  48                  }
  49              })
  50          })
  51      },
  52      
  53      registerEvents : function(){
  54          this.registerEventsForActionButtons();
  55      }
  56  })
  57  
  58  //On Page Load
  59  jQuery(document).ready(function() {
  60      var emailPreviewInstance  =  new Vtiger_EmailPreview_Js();
  61      emailPreviewInstance.registerEvents();
  62      var documentHeight = (jQuery(document).height())+'px';
  63      jQuery('.SendEmailFormStep2').css('height',documentHeight);
  64  });


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