Subversion Repositories ALCASAR

Rev

Rev 2976 | Rev 3100 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2976 Rev 3037
Line 104... Line 104...
104
 
104
 
105
/**
105
/**
106
 * generate a span tag
106
 * generate a span tag
107
 * @param {Number} id translation id in the xml file
107
 * @param {Number} id translation id in the xml file
108
 * @param {String} [plugin] name of the plugin for which the tag should be generated
108
 * @param {String} [plugin] name of the plugin for which the tag should be generated
-
 
109
 * @param {String} [defaultvalue] default value
109
 * @return {String} string which contains generated span tag for translation string
110
 * @return {String} string which contains generated span tag for translation string
110
 */
111
 */
111
function genlang(id, plugin) {
112
function genlang(id, plugin, defaultvalue) {
112
    var html = "", idString = "", plugname = "",
113
    var html = "", idString = "", plugname = "",
113
        langarrId = current_language + "_";
114
        langarrId = current_language + "_";
114
 
115
 
115
    if (plugin === undefined) {
116
    if (plugin === undefined) {
116
        plugname = "";
117
        plugname = "";
Line 135... Line 136...
135
 
136
 
136
    html += "<span class=\"lang_" + idString + "\">";
137
    html += "<span class=\"lang_" + idString + "\">";
137
 
138
 
138
    if ((langxml[langarrId] !== undefined) && (langarr[langarrId] !== undefined)) {
139
    if ((langxml[langarrId] !== undefined) && (langarr[langarrId] !== undefined)) {
139
        html += langarr[langarrId][idString];
140
        html += langarr[langarrId][idString];
-
 
141
    } else if (defaultvalue !== undefined) {
-
 
142
        html += defaultvalue;
140
    }
143
    }
141
 
144
 
142
    html += "</span>";
145
    html += "</span>";
143
 
146
 
144
    return html;
147
    return html;
Line 618... Line 621...
618
        Processes: {
621
        Processes: {
619
            html: function () {
622
            html: function () {
620
                var processes = "", p111 = 0, p112 = 0, p113 = 0, p114 = 0, p115 = 0, p116 = 0;
623
                var processes = "", p111 = 0, p112 = 0, p113 = 0, p114 = 0, p115 = 0, p116 = 0;
621
                var not_first = false;
624
                var not_first = false;
622
                processes = parseInt(this.Processes, 10);
625
                processes = parseInt(this.Processes, 10);
-
 
626
                if (processes > 0) {
623
                if (this.ProcessesRunning !== undefined) {
627
                    if (this.ProcessesRunning !== undefined) {
624
                    p111 = parseInt(this.ProcessesRunning, 10);
628
                        p111 = parseInt(this.ProcessesRunning, 10);
625
                }
629
                    }
626
                if (this.ProcessesSleeping !== undefined) {
630
                    if (this.ProcessesSleeping !== undefined) {
627
                    p112 = parseInt(this.ProcessesSleeping, 10);
631
                        p112 = parseInt(this.ProcessesSleeping, 10);
628
                }
632
                    }
629
                if (this.ProcessesStopped !== undefined) {
633
                    if (this.ProcessesStopped !== undefined) {
630
                    p113 = parseInt(this.ProcessesStopped, 10);
634
                        p113 = parseInt(this.ProcessesStopped, 10);
631
                }
635
                    }
632
                if (this.ProcessesZombie !== undefined) {
636
                    if (this.ProcessesZombie !== undefined) {
633
                    p114 = parseInt(this.ProcessesZombie, 10);
637
                        p114 = parseInt(this.ProcessesZombie, 10);
634
                }
638
                    }
635
                if (this.ProcessesWaiting !== undefined) {
639
                    if (this.ProcessesWaiting !== undefined) {
636
                    p115 = parseInt(this.ProcessesWaiting, 10);
640
                        p115 = parseInt(this.ProcessesWaiting, 10);
637
                }
641
                    }
638
                if (this.ProcessesOther !== undefined) {
642
                    if (this.ProcessesOther !== undefined) {
639
                    p116 = parseInt(this.ProcessesOther, 10);
643
                        p116 = parseInt(this.ProcessesOther, 10);
640
                }
644
                    }
641
                if (p111 || p112 || p113 || p114 || p115 || p116) {
645
                    if (p111 || p112 || p113 || p114 || p115 || p116) {
642
                    processes += " (";
646
                        processes += " (";
643
                    for (var proc_type in {111:0,112:1,113:2,114:3,115:4,116:5}) {
647
                        for (var proc_type in {111:0,112:1,113:2,114:3,115:4,116:5}) {
644
                        if (eval("p" + proc_type)) {
648
                            if (eval("p" + proc_type)) {
645
                            if (not_first) {
649
                                if (not_first) {
646
                                processes += ", ";
650
                                    processes += ", ";
-
 
651
                                }
-
 
652
                                processes += eval("p" + proc_type) + String.fromCharCode(160) + genlang(proc_type);
-
 
653
                                not_first = true;
647
                            }
654
                            }
648
                            processes += eval("p" + proc_type) + String.fromCharCode(160) + genlang(proc_type);
-
 
649
                            not_first = true;
-
 
650
                        }
655
                        }
-
 
656
                        processes += ")";
651
                    }
657
                    }
652
                    processes += ")";
-
 
653
                }
658
                }
654
                return processes;
659
                return processes;
655
            }
660
            }
656
        }
661
        }
657
    };
662
    };
Line 716... Line 721...
716
        Cputemp: {
721
        Cputemp: {
717
            html: function () {
722
            html: function () {
718
                return formatTemp(this.Cputemp, data.Options["@attributes"].tempFormat);
723
                return formatTemp(this.Cputemp, data.Options["@attributes"].tempFormat);
719
            }
724
            }
720
        },
725
        },
-
 
726
        Voltage: {
-
 
727
            html: function() {
-
 
728
                return round(this.Voltage, 2) + ' V';
-
 
729
            }
-
 
730
        },
721
        Bogomips: {
731
        Bogomips: {
722
            text: function () {
732
            text: function () {
723
                return parseInt(this.Bogomips, 10);
733
                return parseInt(this.Bogomips, 10);
724
            }
734
            }
725
        },
735
        },
Line 780... Line 790...
780
        }
790
        }
781
    };
791
    };
782
 
792
 
783
    var html="";
793
    var html="";
784
 
794
 
-
 
795
    if (data.Hardware["@attributes"] !== undefined) { 
785
    if ((data.Hardware["@attributes"] !== undefined) && (data.Hardware["@attributes"].Name !== undefined)) {
796
        if (data.Hardware["@attributes"].Name !== undefined) {
786
        html+="<tr id=\"hardware-Machine\">";
797
            html+="<tr id=\"hardware-Machine\">";
787
        html+="<th style=\"width:8%;\">"+genlang(107)+"</th>"; //Machine
798
            html+="<th style=\"width:8%;\">"+genlang(107)+"</th>"; //Machine
788
        html+="<td colspan=\"2\"><span data-bind=\"Name\"></span></td>";
799
            html+="<td colspan=\"2\"><span data-bind=\"Name\"></span></td>";
-
 
800
            html+="</tr>";
-
 
801
        }
-
 
802
        if (data.Hardware["@attributes"].Virtualizer !== undefined) {
-
 
803
            html+="<tr id=\"hardware-Virtualizer\">";
-
 
804
            html+="<th style=\"width:8%;\">"+genlang(134)+"</th>"; //Virtualizer
-
 
805
            html+="<td colspan=\"2\"><span data-bind=\"Virtualizer\"></span></td>";
789
        html+="</tr>";
806
            html+="</tr>";
-
 
807
        }
790
    }
808
    }
791
 
809
 
792
    var paramlist = {CpuSpeed:13,CpuSpeedMax:100,CpuSpeedMin:101,Cache:15,Virt:94,BusSpeed:14,Bogomips:16,Cputemp:51,Manufacturer:122,Load:9};
810
    var paramlist = {CpuSpeed:13,CpuSpeedMax:100,CpuSpeedMin:101,Cache:15,Virt:94,BusSpeed:14,Voltage:52,Bogomips:16,Cputemp:51,Manufacturer:122,Load:9};
793
    try {
811
    try {
794
        datas = items(data.Hardware.CPU.CpuCore);
812
        datas = items(data.Hardware.CPU.CpuCore);
795
        for (i = 0; i < datas.length; i++) {
813
        for (i = 0; i < datas.length; i++) {
796
             if (i === 0) {
814
             if (i === 0) {
797
                html+="<tr id=\"hardware-CPU\" class=\"treegrid-CPU\">";
815
                html+="<tr id=\"hardware-CPU\" class=\"treegrid-CPU\">";
Line 866... Line 884...
866
        }
884
        }
867
    }
885
    }
868
    $("#hardware-data").empty().append(html);
886
    $("#hardware-data").empty().append(html);
869
 
887
 
870
 
888
 
-
 
889
    if (data.Hardware["@attributes"] !== undefined) {
871
    if ((data.Hardware["@attributes"] !== undefined) && (data.Hardware["@attributes"].Name !== undefined)) {
890
        if (data.Hardware["@attributes"].Name !== undefined) {
872
        $('#hardware-Machine').render(data.Hardware["@attributes"]);
891
            $('#hardware-Machine').render(data.Hardware["@attributes"]);
-
 
892
        }
-
 
893
        if (data.Hardware["@attributes"].Virtualizer !== undefined) {
-
 
894
            $('#hardware-Virtualizer').render(data.Hardware["@attributes"]);
-
 
895
        }
873
    }
896
    }
874
 
897
 
875
    try {
898
    try {
876
        datas = items(data.Hardware.CPU.CpuCore);
899
        datas = items(data.Hardware.CPU.CpuCore);
877
        for (i = 0; i < datas.length; i++) {
900
        for (i = 0; i < datas.length; i++) {
Line 1596... Line 1619...
1596
 
1619
 
1597
 
1620
 
1598
 
1621
 
1599
 
1622
 
1600
 
1623
 
1601
 
1624
 
1602
 
1625
 
1603
 
1626
 
1604
 
1627
 
1605
 
1628
 
1606
 
1629