File size: 4,198 Bytes
bd98362
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/**
 * @Project NUKEVIET 4.x
 * @Author VINADES.,JSC (contact@vinades.vn)
 * @Copyright (C) 2014 VINADES.,JSC. All rights reserved
 * @License GNU/GPL version 2 or any later version
 * @Createdate 1 - 31 - 2010 5 : 12
 */

function nv_change_active(cid) {
    var new_status = $('#change_active_' + cid).is(':checked') ? 1 : 0;
    if (confirm(nv_is_change_act_confirm[0])) {
        var nv_timer = nv_settimeout_disable('change_active_' + cid, 3000);
        $.post(script_name + '?' + nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=change_active&nocache=' + new Date().getTime(), 'change_active=1&cid=' + cid + '&new_status=' + new_status, function(res) {

        });
    } else {
        $('#change_active_' + cid).prop('checked', new_status ? false : true);
    }
}

$(document).ready(function() {
    if ($.fn.datepicker) {
        $("#from_date, #to_date").datepicker({
            dateFormat: "dd/mm/yy",
            changeMonth: true,
            changeYear: true,
            showOtherMonths: true,
            showOn: 'focus'
        });
    }
    $('#to-btn').click(function() {
        $("#to_date").datepicker('show');
    });
    $('#from-btn').click(function() {
        $("#from_date").datepicker('show');
    });
    $("#checkall").click(function() {
        $("input[name=commentid]:checkbox").each(function() {
            $(this).prop("checked", true);
        });
    });
    $("#uncheckall").click(function() {
        $("input[name=commentid]:checkbox").each(function() {
            $(this).prop("checked", false);
        });
    });
    $("a.enable").click(function() {
        var list = [];
        $("input[name=commentid]:checked").each(function() {
            list.push($(this).val());
        });
        if (list.length < 1) {
            alert(LANG.nocheck);
            return false;
        }
        $.ajax({
            type: "POST",
            url: script_name + "?" + nv_lang_variable + "=" + nv_lang_data + "&" + nv_name_variable + "=" + nv_module_name + "&" + nv_fc_variable + "=active",
            data: "list=" + list + "&active=1",
            success: function(data) {
                alert(data);
                window.location = window.location.href;
            }
        });
        return false;
    });
    $("a.disable").click(function() {
        var list = [];
        $("input[name=commentid]:checked").each(function() {
            list.push($(this).val());
        });
        if (list.length < 1) {
            alert(LANG.nocheck);
            return false;
        }
        $.ajax({
            type: "POST",
            url: script_name + "?" + nv_lang_variable + "=" + nv_lang_data + "&" + nv_name_variable + "=" + nv_module_name + "&" + nv_fc_variable + "=active",
            data: "list=" + list + "&active=0",
            success: function(data) {
                alert(data);
                window.location = window.location.href;
            }
        });
        return false;
    });
    $("a.delete").click(function() {
        var list = [];
        $("input[name=commentid]:checked").each(function() {
            list.push($(this).val());
        });
        if (list.length < 1) {
            alert(LANG.nocheck);
            return false;
        }
        if (confirm(LANG.delete_confirm)) {
            $.ajax({
                type: "POST",
                url: script_name + "?" + nv_lang_variable + "=" + nv_lang_data + "&" + nv_name_variable + "=" + nv_module_name + "&" + nv_fc_variable + "=del",
                data: "list=" + list,
                success: function(data) {
                    alert(data);
                    window.location = window.location.href;
                }
            });
        }
        return false;
    });
    $("a.deleteone").click(function() {
        if (confirm(LANG.delete_confirm)) {
            var url = $(this).attr("href");
            $.ajax({
                type: "POST",
                url: url,
                data: "",
                success: function(data) {
                    alert(data);
                    window.location = window.location.href;
                }
            });
        }
        return false;
    });
});