Subversion Repositories ALCASAR

Rev

Details | Last modification | View Log

Rev Author Line No. Line
2781 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
/*global $, jQuery, buildBlock, datetime, plugin_translate, genlang, createBar */
22
 
23
"use strict";
24
 
25
var UpdateNotifier_show = false, UpdateNotifier_table;
26
/**
27
 * insert content into table
28
 * @param {jQuery} xml plugin-XML
29
 */
30
function updatenotifier_populate(xml) {
31
    var html = "";
32
 
33
    $("Plugins Plugin_UpdateNotifier UpdateNotifier", xml).each(function(idp) {
34
        var packages = "", security = "";
35
        packages = $("packages", this).text();
36
        security = $("security", this).text();
37
 
38
        //UpdateNotifier_table.fnAddData([packages]);
39
        //UpdateNotifier_table.fnAddData([security]);
40
 
41
        html  = "    <tr>\n";
42
        html += "      <td>" + packages + " " + genlang(3, "UpdateNotifier") + "</td>\n";
43
        html += "    </tr>\n";
44
        html += "    <tr>\n";
45
        html += "      <td>" + security + " " + genlang(4, "UpdateNotifier") + "</td>\n";
46
        html += "    </tr>\n";
47
 
48
        $("#Plugin_UpdateNotifier tbody").empty().append(html);
49
 
50
        if ((packages <= 0) && (security <= 0)) {
51
            $("#UpdateNotifierTable-info").html(genlang(5, "UpdateNotifier"));
52
        } else {
53
            $("#UpdateNotifierTable-info").html(genlang(2, "UpdateNotifier"));
54
        }
55
 
56
        UpdateNotifier_show = true;
57
    });
58
}
59
 
60
/**
61
 * fill the plugin block with table structure
62
 */
63
function updatenotifier_buildTable() {
64
    var html = "";
65
 
66
    html += "<div style=\"overflow-x:auto;\">\n";
67
    html += "  <table id=\"Plugin_UpdateNotifierTable\" style=\"border-collapse:collapse;\">\n";
68
    html += "    <thead>\n";
69
    html += "      <tr>\n";
70
    html += "        <th id=\"UpdateNotifierTable-info\">" + genlang(2, "UpdateNotifier") + "</th>\n";
71
    html += "      </tr>\n";
72
    html += "    </thead>\n";
73
    html += "    <tbody>\n";
74
    html += "    </tbody>\n";
75
    html += "  </table>\n";
76
    html += "</div>\n";
77
 
78
    $("#Plugin_UpdateNotifier").append(html);
79
 
80
}
81
 
82
/**
83
 * load the xml via ajax
84
 */
85
function updatenotifier_request() {
86
    $("#Reload_UpdateNotifierTable").attr("title", "reload");
87
    $.ajax({
88
        url: "xml.php?plugin=UpdateNotifier",
89
        dataType: "xml",
90
        error: function () {
91
            $.jGrowl("Error loading XML document for Plugin UpdateNotifier!");
92
        },
93
        success: function updatenotifier_buildblock(xml) {
94
            populateErrors(xml);
95
            updatenotifier_populate(xml);
96
            if (UpdateNotifier_show) {
97
                plugin_translate("UpdateNotifier");
98
                $("#Plugin_UpdateNotifier").show();
99
            }
100
        }
101
    });
102
}
103
 
104
$(document).ready(function() {
105
    $("#footer").before(buildBlock("UpdateNotifier", 1, true));
106
    $("#Plugin_UpdateNotifier").css("width", "451px");
107
 
108
    updatenotifier_buildTable();
109
    updatenotifier_request();
110
 
111
    $("#Reload_UpdateNotifierTable").click(function updatenotifier_reload(id) {
112
        updatenotifier_request();
113
        $(this).attr("title", datetime());
114
    });
115
});