Subversion Repositories ALCASAR

Rev

Go to most recent revision | Details | Last modification | View Log

Rev Author Line No. Line
2786 rexy 1
/***************************************************************************
2
 *   Copyright (C) 2008 by phpSysInfo - A PHP System Information Script    *
3
 *   http://phpsysinfo.sourceforge.net/                                    *
4
 *                                                                         *
5
 *   This program is free software; you can redistribute it and/or modify  *
6
 *   it under the terms of the GNU General Public License as published by  *
7
 *   the Free Software Foundation; either version 2 of the License, or     *
8
 *   (at your option) any later version.                                   *
9
 *                                                                         *
10
 *   This program is distributed in the hope that it will be useful,       *
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13
 *   GNU General Public License for more details.                          *
14
 *                                                                         *
15
 *   You should have received a copy of the GNU General Public License     *
16
 *   along with this program; if not, write to the                         *
17
 *   Free Software Foundation, Inc.,                                       *
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19
 ***************************************************************************/
20
 
21
//$Id: iptables.js 661 2016-05-03 11:26:39 erpomata $
22
 
23
 
24
/*global $, jQuery, buildBlock, datetime, plugin_translate, genlang, createBar */
25
 
26
"use strict";
27
 
28
var iptables_show = false;
29
 
30
/**
31
 * insert content into table
32
 * @param {jQuery} xml plugin-XML
33
 */
34
 
35
function iptables_populate(xml) {
36
 
37
    var html = "";
38
 
39
    $("Plugins Plugin_iptables iptables Item", xml).each(function iptables_getitem(idp) {
40
        html += "      <tr>\n";
41
        html += "        <td style=\"font-weight:normal\">" +  $(this).attr("Rule") + "</td>\n";
42
        html += "      </tr>\n";
43
        iptables_show = true;
44
    });
45
 
46
    $("#Plugin_iptablesTable-tbody").empty().append(html);
47
    $('#Plugin_iptablesTable tr:nth-child(even)').addClass('even');
48
 
49
}
50
 
51
function iptables_buildTable() {
52
    var html = "";
53
 
54
    html += "<div style=\"overflow-x:auto;\">\n";
55
    html += "  <table id=\"Plugin_iptablesTable\" class=\"stripeMe\" style=\"border-collapse:collapse;\">\n";
56
    html += "    <thead>\n";
57
    html += "      <tr>\n";
58
    html += "        <th>" + genlang(101, "iptables") + "</th>\n";
59
    html += "      </tr>\n";
60
    html += "    </thead>\n";
61
    html += "    <tbody id=\"Plugin_iptablesTable-tbody\">\n";
62
    html += "    </tbody>\n";
63
    html += "  </table>\n";
64
    html += "</div>\n";
65
 
66
    $("#Plugin_iptables").append(html);
67
}
68
 
69
/**
70
 * load the xml via ajax
71
 */
72
 
73
function iptables_request() {
74
    $("#Reload_iptablesTable").attr("title", "reload");
75
    $.ajax({
76
        url: "xml.php?plugin=iptables",
77
        dataType: "xml",
78
        error: function iptables_error() {
79
            $.jGrowl("Error loading XML document for Plugin iptables!");
80
        },
81
        success: function iptables_buildblock(xml) {
82
            populateErrors(xml);
83
            iptables_populate(xml);
84
            if (iptables_show) {
85
                plugin_translate("iptables");
86
                $("#Plugin_iptables").show();
87
            }
88
        }
89
    });
90
}
91
 
92
$(document).ready(function iptables_buildpage() {
93
    $("#footer").before(buildBlock("iptables", 1, true));
94
    $("#Plugin_iptables").css("width", "915px");
95
 
96
    iptables_buildTable();
97
 
98
    iptables_request();
99
 
100
    $("#Reload_iptablesTable").click(function iptables_reload(id) {
101
        iptables_request();
102
        $(this).attr("title", datetime());
103
    });
104
});