[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/pkg/vtiger/modules/Google/templates/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  jQuery.Class("Contact",{
  10      _init:function(){
  11          if(jQuery('#sync_button')){
  12              jQuery('#sync_button').on('click',function(){
  13                  jQuery('#sync_button b').text(app.vtranslate('LBL_SYNCRONIZING'));
  14                  jQuery('#sync_button').attr("disabled", "disabled")
  15                  jQuery('#synctime').remove();
  16                  var imagePath = app.vimage_path('Sync.gif')
  17                  jQuery('#sync_details').html('<img src='+imagePath+' style="margin-left:40px"/>');
  18                  var url = jQuery('#sync_button').data('url');
  19                  if(jQuery('#firsttime').val() == 'yes'){
  20                       var win=window.open(url,'','height=600,width=600,channelmode=1');
  21                       //http://stackoverflow.com/questions/1777864/how-to-run-function-of-parent-window-when-child-window-closes 
  22                       window.sync = function() {
  23                          jQuery('#sync_details').html('<img src='+imagePath+' style="margin-left:40px"/>'); 
  24                          AppConnector.request(url).then(
  25                             function(data) {
  26                                 jQuery('#sync_button b').text(app.vtranslate('LBL_SYNC_BUTTON'));
  27                                 jQuery('#sync_button').removeAttr("disabled");
  28                                 jQuery('#sync_details').html(data);
  29                                 if(jQuery('#norefresh').length == 0){
  30                                  listInstance  =  Vtiger_List_Js.getInstance();
  31                                  listInstance.getListViewRecords();
  32                                 }
  33                                 jQuery('#firsttime').val('no');
  34                                 jQuery('#removeSyncBlock').show();
  35                             }
  36                             );
  37                       }
  38                       
  39                       
  40                       win.onunload = function(){
  41                           jQuery('#sync_button b').text(app.vtranslate('LBL_SYNC_BUTTON'));
  42                           jQuery('#sync_button').removeAttr("disabled");
  43                           jQuery('#sync_details').html(app.vtranslate('LBL_NOT_SYNCRONIZED'));
  44                       }
  45                           
  46                       
  47                  } else {
  48                      AppConnector.request(url).then(
  49                          function(data) {
  50                              var response;
  51                              try {
  52                                  response = JSON.parse(data);
  53                              } catch (e) {
  54                                  
  55                              }
  56                              if(response && response.error.code == '401') {
  57                                  jQuery('#firsttime').val('yes');
  58                                  jQuery('#removeSyncBlock').hide();
  59                                  jQuery('#sync_button').click();
  60                                  
  61                              } else {
  62                              jQuery('#sync_button b').text(app.vtranslate('LBL_SYNC_BUTTON'));
  63                              jQuery('#sync_button').removeAttr("disabled");
  64                              jQuery('#sync_details').html(data);
  65                              if(jQuery('#norefresh').length == 0){
  66                                  listInstance  =  Vtiger_List_Js.getInstance();
  67                                  listInstance.getListViewRecords()
  68                              }
  69                          }
  70                      });
  71                  }
  72                  
  73              });
  74              jQuery('#remove_sync').on('click',function(){
  75                  var url = jQuery('#remove_sync').data('url');
  76                  AppConnector.request(url).then(
  77                          function(data) {
  78                              jQuery('#firsttime').val('yes');
  79                              jQuery('#removeSyncBlock').hide();
  80                              var params = {
  81                                  title : app.vtranslate('JS_MESSAGE'),
  82                                  text: app.vtranslate('SYNC_REMOVED_SUCCESSFULLY'),
  83                                  animation: 'show',
  84                                  type: 'info'
  85                              };
  86                              Vtiger_Helper_Js.showPnotify(params);
  87                          }
  88                          );
  89                  
  90              });
  91          }
  92          var data=jQuery('#mappingTable').html();
  93          jQuery('#popid').popover({
  94              'html':true,
  95              'content': data,
  96              'title':app.vtranslate('FIELD_MAPPING')
  97          });
  98          
  99          jQuery('#removePop').popover({
 100              'html':true,
 101              'content': app.vtranslate('REMOVE_SYNCHRONIZATION_MESSAGE'),
 102              'title': app.vtranslate('REMOVE_SYNCHRONIZATION')
 103          });
 104          
 105      },
 106      
 107      _showMessage : function(){
 108         
 109      },
 110      _exit:function(){
 111          
 112      }
 113  },{});
 114  
 115  jQuery('document').ready(function(){
 116      jQuery('#mappingTable').hide();
 117    Contact._init();
 118  })
 119  


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