/*+*********************************************************************************** * The contents of this file are subject to the vtiger CRM Public License Version 1.0 * ("License"); You may not use this file except in compliance with the License * The Original Code is: vtiger CRM Open Source * The Initial Developer of the Original Code is vtiger. * Portions created by vtiger are Copyright (C) vtiger. * All Rights Reserved. *************************************************************************************/ jQuery.Class("Settings_Vtiger_Index_Js",{ showMessage : function(customParams){ var params = {}; params.animation = "show"; params.type = 'info'; params.title = app.vtranslate('JS_MESSAGE'); if(typeof customParams != 'undefined') { var params = jQuery.extend(params,customParams); } Vtiger_Helper_Js.showPnotify(params); } },{ registerDeleteShortCutEvent : function(shortCutBlock) { var thisInstance = this; if(typeof shortCutBlock == 'undefined') { var shortCutBlock = jQuery('div#settingsShortCutsContainer') } shortCutBlock.on('click','.unpin',function(e) { var actionEle = jQuery(e.currentTarget); var closestBlock = actionEle.closest('.moduleBlock'); var fieldId = actionEle.data('id'); var shortcutBlockActionUrl = closestBlock.data('actionurl'); var actionUrl = shortcutBlockActionUrl+'&pin=false'; var progressIndicatorElement = jQuery.progressIndicator({ 'blockInfo' : { 'enabled' : true } }); AppConnector.request(actionUrl).then(function(data) { if(data.result.SUCCESS == 'OK') { closestBlock.remove(); thisInstance.registerSettingShortCutAlignmentEvent(); var menuItemId = '#'+fieldId+'_menuItem'; var shortCutActionEle = jQuery(menuItemId); var imagePath = shortCutActionEle.data('pinimageurl'); shortCutActionEle.attr('src',imagePath).data('action','pin'); progressIndicatorElement.progressIndicator({ 'mode' : 'hide' }); var params = { title : app.vtranslate('JS_MESSAGE'), text: app.vtranslate('JS_SUCCESSFULLY_UNPINNED'), animation: 'show', type: 'info' }; thisInstance.registerReAlign(); Vtiger_Helper_Js.showPnotify(params); } }); e.stopPropagation(); }); }, registerPinUnpinShortCutEvent : function() { var thisInstance = this; var widgets = jQuery('div.widgetContainer'); widgets.on('click','.pinUnpinShortCut',function(e){ var shortCutActionEle = jQuery(e.currentTarget); var url = shortCutActionEle.closest('.menuItem').data('actionurl'); var shortCutElementActionStatus = shortCutActionEle.data('action'); if(shortCutElementActionStatus == 'pin'){ var actionUrl = url+'&pin=true'; } else { actionUrl = url+'&pin=false'; } var progressIndicatorElement = jQuery.progressIndicator({ 'blockInfo' : { 'enabled' : true } }); AppConnector.request(actionUrl).then(function(data) { if(data.result.SUCCESS == 'OK') { if(shortCutElementActionStatus == 'pin'){ var imagePath = shortCutActionEle.data('unpinimageurl'); var unpinTitle = shortCutActionEle.data('unpintitle'); shortCutActionEle.attr('src',imagePath).data('action','unpin').attr('title',unpinTitle); var params = { 'fieldid' : shortCutActionEle.data('id'), 'mode' : 'getSettingsShortCutBlock', 'module' : 'Vtiger', 'parent' : 'Settings', 'view' : 'IndexAjax' } AppConnector.request(params).then(function(data){ // var shortCutsMainContainer = jQuery('#settingsShortCutsContainer'); var shortCutsMainContainer = jQuery('#settingsShortCutsContainer'); var existingDivBlock=jQuery('#settingsShortCutsContainer div.row-fluid:last'); var count=jQuery('#settingsShortCutsContainer div.row-fluid:last').children("span").length; if(count==3){ var newBlock =jQuery('#settingsShortCutsContainer').append('