[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/layouts/vlayout/modules/Documents/resources/ -> Detail.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  Vtiger_Detail_Js("Documents_Detail_Js", {
  11      
  12      //It stores the CheckFileIntegrity response data
  13      checkFileIntegrityResponseCache : {},
  14      
  15      /*
  16       * function to trigger CheckFileIntegrity action
  17       * @param: CheckFileIntegrity url.
  18       */
  19      checkFileIntegrity : function(checkFileIntegrityUrl) {
  20          Documents_Detail_Js.getFileIntegrityResponse(checkFileIntegrityUrl).then(
  21              function(data){
  22                  Documents_Detail_Js.displayCheckFileIntegrityResponse(data);
  23              }
  24          );
  25      },
  26      
  27      /*
  28       * function to get the CheckFileIntegrity response data
  29       */
  30      getFileIntegrityResponse : function(params){
  31          var aDeferred = jQuery.Deferred();
  32          
  33          //Check in the cache 
  34          if(!(jQuery.isEmptyObject(Documents_Detail_Js.checkFileIntegrityResponseCache))) {
  35              aDeferred.resolve(Documents_Detail_Js.checkFileIntegrityResponseCache);
  36          }
  37          else{
  38              AppConnector.request(params).then(
  39                  function(data) {
  40                      //store it in the cache, so that we dont do multiple request
  41                      Documents_Detail_Js.checkFileIntegrityResponseCache = data;
  42                      aDeferred.resolve(Documents_Detail_Js.checkFileIntegrityResponseCache);
  43                  }
  44              );
  45          }
  46          return aDeferred.promise();
  47      },
  48      
  49      /*
  50       * function to display the CheckFileIntegrity message
  51       */
  52      displayCheckFileIntegrityResponse : function(data) {
  53          var result = data['result'];
  54          var success = result['success'];
  55          var message = result['message'];
  56          var params = {};
  57          if(success) {
  58              params = {
  59                  text: message,
  60                  type: 'success'
  61              }
  62          } else {
  63              params = {
  64                  text: message,
  65                  type: 'error'
  66              }
  67          }
  68          Documents_Detail_Js.showNotify(params);
  69      },
  70      
  71      //This will show the messages of CheckFileIntegrity using pnotify
  72      showNotify : function(customParams) {
  73          var params = {
  74              title: app.vtranslate('JS_CHECK_FILE_INTEGRITY'),
  75              text: customParams.text,
  76              type: customParams.type,
  77              width: '30%',
  78              delay: '2000'
  79          };
  80          Vtiger_Helper_Js.showPnotify(params);
  81      },
  82  
  83      triggerSendEmail : function(recordIds) {
  84          var params = {
  85              "module" : "Documents",
  86              "view" : "ComposeEmail",
  87              "documentIds" : recordIds
  88          };
  89          var emailEditInstance = new Emails_MassEdit_Js();
  90          emailEditInstance.showComposeEmailForm(params);
  91      }
  92      
  93  },{});


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