[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
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 11 jQuery.Class('Vtiger_BasicSearch_Js',{},{ 12 //stores the module that need to be searched 13 searchModule : false, 14 15 //stores the module that need to be searched which is selected by the user 16 currentSearchModule : false, 17 18 /** 19 * Function to get the search module 20 */ 21 getSearchModule : function() { 22 if(this.searchModule === false) { 23 //default gives current module 24 var module = app.getModuleName(); 25 if(typeof this.getCurrentSearchModule() != 'undefined') { 26 module = this.getCurrentSearchModule(); 27 } 28 29 this.setSearchModule(module); 30 } 31 return this.searchModule; 32 }, 33 34 /** 35 * Function to set the search module 36 */ 37 setSearchModule : function(moduleName) { 38 this.searchModule = moduleName; 39 return this; 40 }, 41 42 /** 43 * Function to get the user selected search module 44 */ 45 getCurrentSearchModule : function() { 46 if(this.currentSearchModule === false) { 47 this.currentSearchModule = jQuery('#basicSearchModulesList').val(); 48 } 49 return this.currentSearchModule; 50 }, 51 52 /** 53 * Function which will perform the search 54 */ 55 _search : function(params) { 56 var aDeferred = jQuery.Deferred(); 57 58 if(typeof params == 'undefined') { 59 params = {}; 60 } 61 62 params.view = 'BasicAjax'; 63 params.mode = 'showSearchResults'; 64 65 if(typeof params.module == 'undefined') { 66 params.module = app.getModuleName(); 67 //if you are in Settings then module should be Vtiger for normal text search 68 if(app.getParentModuleName().length > 0) { 69 params.module = 'Vtiger'; 70 } 71 } 72 73 AppConnector.request(params).then( 74 function(data){ 75 aDeferred.resolve(data); 76 }, 77 78 function(error,err){ 79 aDeferred.reject(error); 80 } 81 ); 82 return aDeferred.promise(); 83 }, 84 85 /** 86 * Helper function whicn invokes search 87 */ 88 search : function(value) { 89 var searchModule = this.getCurrentSearchModule(); 90 var params = {}; 91 params.value = value; 92 if(typeof searchModule != 'undefined') { 93 params.searchModule = searchModule; 94 } 95 96 return this._search(params); 97 }, 98 99 /** 100 * Function which shows the search results 101 */ 102 showSearchResults : function(data){ 103 var aDeferred = jQuery.Deferred(); 104 var postLoad = function(data) { 105 var blockMsg = jQuery(data).closest('.blockMsg'); 106 app.showScrollBar(jQuery(data).find('.contents')); 107 blockMsg.position({ 108 my: "left bottom", 109 at: "left bottom", 110 of: "#globalSearchValue", 111 offset: "1 -29" 112 }); 113 aDeferred.resolve(data); 114 } 115 var params = {}; 116 params.data = data ; 117 params.cb = postLoad; 118 params.css = {'width':'23%','text-align':'left'}; 119 //not showing overlay 120 params.overlayCss = {'opacity':'0.2'}; 121 app.showModalWindow(params); 122 return aDeferred.promise(); 123 } 124 125 }); 126
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |