/************************************* * SPDX-FileCopyrightText: 2009-2020 Vtenext S.r.l. * SPDX-License-Identifier: AGPL-3.0-only ************************************/ /* crmv@192033 */ window.VTE = window.VTE || {}; VTE.ListViewCounts = VTE.ListViewCounts || { busy: false, selector: '.listViewCounts', show: function() { var me = this; jQuery(me.selector).show(); }, hide: function() { var me = this; jQuery(me.selector).hide(); }, showBusy: function() { var me = this; me.busy = true; jQuery("#status").show(); }, hideBusy: function() { var me = this; me.busy = false; jQuery("#status").hide(); }, getValue: function() { var me = this; var counts = 0; jQuery(me.selector).each(function() { var input = jQuery(this).find('select[name="counts"]'); if (input.length > 0) { counts = input.val(); return false; } }); return counts; }, onShowMoreEntries: function(selectView, module, folderid) { var me = this; me.showMoreEntries(selectView, module, folderid, function(res, postbody) { result = res.split('&#&#&#'); jQuery("#ListViewContents").html(result[2]); if (result[1] != '') { alert(result[1]); } if (module != 'Users' && module != 'Import' && module != 'Notes') { update_navigation_values(postbody); jQuery('#basicsearchcolumns').html(''); } }); }, onShowMoreEntries_popup: function(selectView, module) { var me = this; me.showMoreEntries_popup(selectView, module, function(res, urlstring) { jQuery("#ListViewContents").html(res); update_navigation_values(urlstring); setListHeight(); }); }, showMoreEntries: function(selectView, module, folderid, success, failure) { var me = this; if (me.busy) return false; me.showBusy(); if (ajaxcall_list) { ajaxcall_list.abort(); } if (ajaxcall_count) { ajaxcall_count.abort(); } var viewCounts = selectView.options[selectView.options.selectedIndex].value; var viewid = getviewId(); var urlstring = ''; if (isdefined('search_url')) { urlstring = jQuery('#search_url').val(); } if (isdefined('selected_ids')) { urlstring += "&selected_ids=" + document.getElementById('selected_ids').value; } if (isdefined('all_ids')) { urlstring += "&all_ids=" + document.getElementById('all_ids').value; } var modulename = ''; if (isdefined('modulename')) { modulename = document.getElementById('modulename').value; } var postbody = "module=" + module + "&modulename=" + modulename + "&action=" + module + "Ajax&file=ListView&start=1&ajax=true&changecount=true" + urlstring + "&counts=" + viewCounts; if (folderid != undefined && folderid != '') postbody += '&folderid=' + folderid; jQuery.ajax({ url: 'index.php', method: 'POST', data: postbody, success: function(res) { me.hideBusy(); if (typeof success == 'function') success(res, postbody); }, error: function() { me.hideBusy(); console.log('Ajax error'); if (typeof failure == 'function') failure(); } }); }, showMoreEntries_popup: function(selectView, module, success, failure) { var me = this; if (me.busy) return false; me.showBusy(); if (ajaxcall_list) { ajaxcall_list.abort(); } if (ajaxcall_count) { ajaxcall_count.abort(); } var viewCounts = selectView.options[selectView.options.selectedIndex].value; var viewid = getviewId(); var popuptype = jQuery('#popup_type').val(); var act_tab = jQuery('#maintab').val(); var urlstring = ''; urlstring += '&popuptype=' + popuptype; urlstring += '&maintab=' + act_tab; urlstring += '&query=true&file=Popup&module=' + module + '&action=' + module + 'Ajax&ajax=true&changecount=true&counts=' + viewCounts; urlstring += gethiddenelements(); urlstring += "&start=1"; jQuery.ajax({ url: 'index.php', method: 'POST', data: urlstring, success: function(res) { me.hideBusy(); if (typeof success == 'function') success(res, urlstring); }, error: function() { me.hideBusy(); console.log('Ajax error'); if (typeof failure == 'function') failure(); } }); }, }; /** * @deprecated * This function has been moved to VTE.ListViewCounts class. */ function showMoreEntries(selectView, module, folderid) { return VTE.callDeprecated('showMoreEntries', VTE.ListViewCounts.onShowMoreEntries, arguments, VTE.ListViewCounts); } /** * @deprecated * This function has been moved to VTE.ListViewEntries class. */ function showMoreEntries_popup(selectView, module) { return VTE.callDeprecated('showMoreEntries_popup', VTE.ListViewCounts.onShowMoreEntries_popup, arguments, VTE.ListViewCounts); } /* crmv@82831 */ //crmv@add ajax control var ajaxcall_list = null; var ajaxcall_count = null; var basic_search_submitted = false; var advance_search_submitted = false; var grid_search_submitted = false; //crmv@3084m /* crmv@30967 */ var typeofdata = new Array(); typeofdata['E'] = ['c','e','n','s','ew','k']; //crmv@48693 typeofdata['V'] = ['c','e','n','s','ew','k']; //crmv@48693 typeofdata['N'] = ['e','n','l','g','m','h']; typeofdata['NN'] = ['e','n','l','g','m','h']; typeofdata['T'] = ['e','n','l','g','m','h']; typeofdata['I'] = ['e','n','l','g','m','h']; typeofdata['C'] = ['e','n']; typeofdata['DT'] = ['e','n','l','g','m','h']; typeofdata['D'] = ['e','n','l','g','m','h']; var fLabels = new Array(); if (typeof(alert_arr) !== 'undefined') { fLabels['e'] = alert_arr.EQUALS; fLabels['n'] = alert_arr.NOT_EQUALS_TO; fLabels['s'] = alert_arr.STARTS_WITH; fLabels['ew'] = alert_arr.ENDS_WITH; fLabels['c'] = alert_arr.CONTAINS; fLabels['k'] = alert_arr.DOES_NOT_CONTAINS; fLabels['l'] = alert_arr.LESS_THAN; fLabels['g'] = alert_arr.GREATER_THAN; fLabels['m'] = alert_arr.LESS_OR_EQUALS; fLabels['h'] = alert_arr.GREATER_OR_EQUALS; } /* crmv@30967e */ //crmv@add ajax control end // MassEdit Feature function massedit_togglediv(curTabId,total){ for(var i=0;i