Subversion Repositories ALCASAR

Rev

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

Rev 2788 Rev 2976
Line 19... Line 19...
19
            expires = "; expires=" + date.toGMTString();
19
            expires = "; expires=" + date.toGMTString();
20
        }
20
        }
21
    } else {
21
    } else {
22
        expires = "";
22
        expires = "";
23
    }
23
    }
24
    document.cookie = name + "=" + value + expires + "; path=/";
24
    document.cookie = name + "=" + value + expires + "; path=/; samesite=strict";
25
}
25
}
26
 
26
 
27
/**
27
/**
28
 * read a value out of a cookie and return the value<br><br>
28
 * read a value out of a cookie and return the value<br><br>
29
 * inspired by <a href="http://www.quirksmode.org/js/cookies.html">http://www.quirksmode.org/js/cookies.html</a>
29
 * inspired by <a href="http://www.quirksmode.org/js/cookies.html">http://www.quirksmode.org/js/cookies.html</a>
Line 286... Line 286...
286
         dataType: "json",
286
         dataType: "json",
287
         url: "xml.php?plugin=" + pluginname + "&json",
287
         url: "xml.php?plugin=" + pluginname + "&json",
288
         pluginname: pluginname,
288
         pluginname: pluginname,
289
         success: function (data) {
289
         success: function (data) {
290
            try {
290
            try {
-
 
291
                for (var propertyName in data.Plugins) {
-
 
292
                    if ((data.Plugins[propertyName]["@attributes"] !== undefined) && 
-
 
293
                       ((hostname = data.Plugins[propertyName]["@attributes"]["Hostname"]) !== undefined)) {
-
 
294
                        $('span[class=hostname_' + pluginname + ']').html(hostname);
-
 
295
                    }
-
 
296
                    break;
-
 
297
                }
291
                // dynamic call
298
                // dynamic call
292
                window['renderPlugin_' + this.pluginname](data);
299
                window['renderPlugin_' + this.pluginname](data);
293
                changeLanguage(this.pluginname);
300
                changeLanguage(this.pluginname);
294
                plugin_liste.pushIfNotExist(this.pluginname);
301
                plugin_liste.pushIfNotExist(this.pluginname);
295
            }
302
            }
Line 311... Line 318...
311
        $(document).ajaxStop(function () {
318
        $(document).ajaxStop(function () {
312
            $("#loader").css("visibility", "hidden");
319
            $("#loader").css("visibility", "hidden");
313
        });
320
        });
314
    }
321
    }
315
 
322
 
316
    if (((ua=useragent.match(/Safari\/(\d+)\.[\d\.]+$/)) !== null) && (ua[1]<=534)) {
323
    if ((ua=useragent.match(/Version\/(\d+)\.[\d\.]+ (Mobile\/\S+ )?Safari\//)) !== null) {
-
 
324
        if (ua[1]<=5) {
317
        $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-safari5.css');
325
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-safari5.css');
-
 
326
        } else if (ua[1]<=8) {
-
 
327
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-safari8.css');
-
 
328
        }
318
    } else if ((ua=useragent.match(/Firefox\/(\d+)\.[\d\.]+$/))  !== null) {
329
    } else if ((ua=useragent.match(/Firefox\/(\d+)\.[\d\.]+/))  !== null) {
319
        if (ua[1]<=15) {
330
        if (ua[1]<=15) {
320
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-firefox15.css');
331
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-firefox15.css');
321
        } else if (ua[1]<=20) {
332
        } else if (ua[1]<=20) {
322
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-firefox20.css');
333
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-firefox20.css');
323
        } else if (ua[1]<=27) {
334
        } else if (ua[1]<=27) {
324
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-firefox27.css');
335
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-firefox27.css');
325
        } else if (ua[1]==28) {
336
        } else if (ua[1]==28) {
326
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-firefox28.css');
337
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-firefox28.css');
327
        }
338
        }
-
 
339
    } else if ((ua=useragent.match(/Midori\/(\d+)\.?(\d+)?/))  !== null) {
-
 
340
        if ((ua[1]==0) && (ua.length==3) && (ua[2]<=4)) {
-
 
341
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-midori04.css');
-
 
342
        } else if ((ua[1]==0) && (ua.length==3) && (ua[2]==5)) {
-
 
343
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-midori05.css');
-
 
344
        }
-
 
345
    } else if ((ua=useragent.match(/Chrome\/(\d+)\.[\d\.]+/))  !== null) {
-
 
346
        if (ua[1]<=25) {
-
 
347
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-chrome25.css');
-
 
348
        } else if (ua[1]<=28) {
-
 
349
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-chrome28.css');
-
 
350
        }
328
    }
351
    }
329
 
352
 
330
    $(window).resize();
353
    $(window).resize();
331
 
354
 
332
    sorttable.init();
355
    sorttable.init();
Line 450... Line 473...
450
    var ipv4 = ip_string.match(/(.*:)([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$)/);
473
    var ipv4 = ip_string.match(/(.*:)([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$)/);
451
    if (ipv4) {
474
    if (ipv4) {
452
        ip_string = ipv4[1];
475
        ip_string = ipv4[1];
453
        ipv4 = ipv4[2].match(/[0-9]+/g);
476
        ipv4 = ipv4[2].match(/[0-9]+/g);
454
        for (var i = 0;i < 4;i ++) {
477
        for (var i = 0;i < 4;i ++) {
455
            var byte = parseInt(ipv4[i],10);
478
            var byte = parseInt(ipv4[i], 10);
456
            if (byte<256) {
479
            if (byte<256) {
457
                ipv4[i] = ("0" + byte.toString(16)).substr(-2);
480
                ipv4[i] = ("0" + byte.toString(16)).substr(-2);
458
            } else {
481
            } else {
459
                wrongvalue = true;
482
                wrongvalue = true;
460
                break;
483
                break;
Line 551... Line 574...
551
            text: function () {
574
            text: function () {
552
                var lastboot;
575
                var lastboot;
553
                var timestamp = 0;
576
                var timestamp = 0;
554
                var datetimeFormat;
577
                var datetimeFormat;
555
                if ((data.Generation !== undefined) && (data.Generation["@attributes"] !== undefined) && (data.Generation["@attributes"].timestamp !== undefined) ) {
578
                if ((data.Generation !== undefined) && (data.Generation["@attributes"] !== undefined) && (data.Generation["@attributes"].timestamp !== undefined) ) {
556
                    timestamp = parseInt(data.Generation["@attributes"].timestamp)*1000; //server time
579
                    timestamp = parseInt(data.Generation["@attributes"].timestamp, 10) * 1000; //server time
557
                    if (isNaN(timestamp)) timestamp = Number(new Date()); //client time
580
                    if (isNaN(timestamp)) timestamp = Number(new Date()); //client time
558
                } else {
581
                } else {
559
                    timestamp = Number(new Date()); //client time
582
                    timestamp = Number(new Date()); //client time
560
                }
583
                }
561
                lastboot = new Date(timestamp - (parseInt(this.Uptime)*1000));
584
                lastboot = new Date(timestamp - (parseInt(this.Uptime, 10) * 1000));
562
                if (((datetimeFormat = data.Options["@attributes"].datetimeFormat) !== undefined) && (datetimeFormat.toLowerCase() === "locale")) {
585
                if (((datetimeFormat = data.Options["@attributes"].datetimeFormat) !== undefined) && (datetimeFormat.toLowerCase() === "locale")) {
563
                    return lastboot.toLocaleString();
586
                    return lastboot.toLocaleString();
564
                } else {
587
                } else {
565
                    if (typeof(lastboot.toUTCString) === "function") {
588
                    if (typeof(lastboot.toUTCString) === "function") {
566
                        return lastboot.toUTCString();
589
                        return lastboot.toUTCString();
Line 594... Line 617...
594
        },
617
        },
595
        Processes: {
618
        Processes: {
596
            html: function () {
619
            html: function () {
597
                var processes = "", p111 = 0, p112 = 0, p113 = 0, p114 = 0, p115 = 0, p116 = 0;
620
                var processes = "", p111 = 0, p112 = 0, p113 = 0, p114 = 0, p115 = 0, p116 = 0;
598
                var not_first = false;
621
                var not_first = false;
599
                processes = parseInt(this.Processes);
622
                processes = parseInt(this.Processes, 10);
600
                if (this.ProcessesRunning !== undefined) {
623
                if (this.ProcessesRunning !== undefined) {
601
                    p111 = parseInt(this.ProcessesRunning);
624
                    p111 = parseInt(this.ProcessesRunning, 10);
602
                }
625
                }
603
                if (this.ProcessesSleeping !== undefined) {
626
                if (this.ProcessesSleeping !== undefined) {
604
                    p112 = parseInt(this.ProcessesSleeping);
627
                    p112 = parseInt(this.ProcessesSleeping, 10);
605
                }
628
                }
606
                if (this.ProcessesStopped !== undefined) {
629
                if (this.ProcessesStopped !== undefined) {
607
                    p113 = parseInt(this.ProcessesStopped);
630
                    p113 = parseInt(this.ProcessesStopped, 10);
608
                }
631
                }
609
                if (this.ProcessesZombie !== undefined) {
632
                if (this.ProcessesZombie !== undefined) {
610
                    p114 = parseInt(this.ProcessesZombie);
633
                    p114 = parseInt(this.ProcessesZombie, 10);
611
                }
634
                }
612
                if (this.ProcessesWaiting !== undefined) {
635
                if (this.ProcessesWaiting !== undefined) {
613
                    p115 = parseInt(this.ProcessesWaiting);
636
                    p115 = parseInt(this.ProcessesWaiting, 10);
614
                }
637
                }
615
                if (this.ProcessesOther !== undefined) {
638
                if (this.ProcessesOther !== undefined) {
616
                    p116 = parseInt(this.ProcessesOther);
639
                    p116 = parseInt(this.ProcessesOther, 10);
617
                }
640
                }
618
                if (p111 || p112 || p113 || p114 || p115 || p116) {
641
                if (p111 || p112 || p113 || p114 || p115 || p116) {
619
                    processes += " (";
642
                    processes += " (";
620
                    for (var proc_type in {111:0,112:1,113:2,114:3,115:4,116:5}) {
643
                    for (var proc_type in {111:0,112:1,113:2,114:3,115:4,116:5}) {
621
                        if (eval("p" + proc_type)) {
644
                        if (eval("p" + proc_type)) {
Line 695... Line 718...
695
                return formatTemp(this.Cputemp, data.Options["@attributes"].tempFormat);
718
                return formatTemp(this.Cputemp, data.Options["@attributes"].tempFormat);
696
            }
719
            }
697
        },
720
        },
698
        Bogomips: {
721
        Bogomips: {
699
            text: function () {
722
            text: function () {
700
                return parseInt(this.Bogomips);
723
                return parseInt(this.Bogomips, 10);
701
            }
724
            }
702
        },
725
        },
703
        Load: {
726
        Load: {
704
            html: function () {
727
            html: function () {
705
                return '<div class="progress">' +
728
                return '<div class="progress">' +
Line 715... Line 738...
715
                return this.Name;
738
                return this.Name;
716
            }
739
            }
717
        },
740
        },
718
        hwCount: {
741
        hwCount: {
719
            text: function() {
742
            text: function() {
720
                if ((this.Count !== undefined) && !isNaN(this.Count) && (parseInt(this.Count)>1)) {
743
                if ((this.Count !== undefined) && !isNaN(this.Count) && (parseInt(this.Count, 10)>1)) {
721
                    return parseInt(this.Count);
744
                    return parseInt(this.Count, 10);
722
                } else {
745
                } else {
723
                    return "";
746
                    return "";
724
                }
747
                }
725
            }
748
            }
726
        }
749
        }
727
    };
750
    };
728
 
751
 
-
 
752
    var mem_directives = {
-
 
753
        Speed: {
-
 
754
            html: function() {
-
 
755
                return formatMTps(this.Speed);
-
 
756
            }
-
 
757
        },
-
 
758
        Voltage: {
-
 
759
            html: function() {
-
 
760
                return round(this.Voltage, 2) + ' V';
-
 
761
            }
-
 
762
        },
-
 
763
        Capacity: {
-
 
764
            html: function () {
-
 
765
                return formatBytes(this.Capacity, data.Options["@attributes"].byteFormat);
-
 
766
            }
-
 
767
        }
-
 
768
    };
-
 
769
 
729
    var dev_directives = {
770
    var dev_directives = {
-
 
771
        Speed: {
-
 
772
            html: function() {
-
 
773
                return formatBPS(1000000*this.Speed);
-
 
774
            }
-
 
775
        },
730
        Capacity: {
776
        Capacity: {
731
            html: function () {
777
            html: function () {
732
                return formatBytes(this.Capacity, data.Options["@attributes"].byteFormat);
778
                return formatBytes(this.Capacity, data.Options["@attributes"].byteFormat);
733
            }
779
            }
734
        }
780
        }
Line 777... Line 823...
777
    }
823
    }
778
    catch (err) {
824
    catch (err) {
779
        $("#hardware-CPU").hide();
825
        $("#hardware-CPU").hide();
780
    }
826
    }
781
 
827
 
782
    var devparamlist = {Capacity:43,Manufacturer:122,Product:123,Serial:124};
828
    var devparamlist = {Capacity:43,Manufacturer:122,Product:123,Speed:129,Voltage:52,Serial:124};
783
    for (hw_type in {PCI:0,IDE:1,SCSI:2,NVMe:3,USB:4,TB:5,I2C:6}) {
829
    for (hw_type in {MEM:0,PCI:1,IDE:2,SCSI:3,NVMe:4,USB:5,TB:6,I2C:7}) {
784
        try {
830
        try {
-
 
831
            if (hw_type == 'MEM') {
-
 
832
                datas = items(data.Hardware[hw_type].Chip);
-
 
833
            } else {
785
            datas = items(data.Hardware[hw_type].Device);
834
                datas = items(data.Hardware[hw_type].Device);
-
 
835
            }
786
            for (i = 0; i < datas.length; i++) {
836
            for (i = 0; i < datas.length; i++) {
787
                if (i === 0) {
837
                if (i === 0) {
788
                    html+="<tr id=\"hardware-" + hw_type + "\" class=\"treegrid-" + hw_type + "\">";
838
                    html+="<tr id=\"hardware-" + hw_type + "\" class=\"treegrid-" + hw_type + "\">";
789
                    html+="<th>" + hw_type + "</th>";
839
                    html+="<th>" + hw_type + "</th>";
-
 
840
                    if (hw_type == 'MEM') {
-
 
841
                        html+="<td><span class=\"treegrid-span\">" + genlang('128') + ":</span></td>"; //Number of memories
-
 
842
                    } else {
790
                    html+="<td><span class=\"treegrid-span\">" + genlang('120') + ":</span></td>"; //Number of devices
843
                        html+="<td><span class=\"treegrid-span\">" + genlang('120') + ":</span></td>"; //Number of devices
-
 
844
                    }                    
791
                    html+="<td class=\"rightCell\"><span id=\"" + hw_type + "Count\"></span></td>";
845
                    html+="<td class=\"rightCell\"><span id=\"" + hw_type + "Count\"></span></td>";
792
                    html+="</tr>";
846
                    html+="</tr>";
793
                }
847
                }
794
                html+="<tr id=\"hardware-" + hw_type + "-" + i +"\" class=\"treegrid-" + hw_type + "-" + i +" treegrid-parent-" + hw_type + "\">";
848
                html+="<tr id=\"hardware-" + hw_type + "-" + i +"\" class=\"treegrid-" + hw_type + "-" + i +" treegrid-parent-" + hw_type + "\">";
795
                html+="<th></th>";
849
                html+="<th></th>";
Line 835... Line 889...
835
    catch (err) {
889
    catch (err) {
836
        $("#hardware-CPU").hide();
890
        $("#hardware-CPU").hide();
837
    }
891
    }
838
 
892
 
839
    var licz;
893
    var licz;
840
    for (hw_type in {PCI:0,IDE:1,SCSI:2,NVMe:3,USB:4,TB:5,I2C:6}) {
894
    for (hw_type in {MEM:0,PCI:1,IDE:2,SCSI:3,NVMe:4,USB:5,TB:6,I2C:7}) {
841
        try {
895
        try {
842
            licz = 0;
896
            licz = 0;
-
 
897
            if (hw_type == 'MEM') {
-
 
898
                datas = items(data.Hardware[hw_type].Chip);
-
 
899
            } else {
843
            datas = items(data.Hardware[hw_type].Device);
900
                datas = items(data.Hardware[hw_type].Device);
-
 
901
            }
844
            for (i = 0; i < datas.length; i++) {
902
            for (i = 0; i < datas.length; i++) {
845
                $('#hardware-'+hw_type+'-'+ i).render(datas[i]["@attributes"], hw_directives);
903
                $('#hardware-'+hw_type+'-'+ i).render(datas[i]["@attributes"], hw_directives);
846
                if ((datas[i]["@attributes"].Count !== undefined) && !isNaN(datas[i]["@attributes"].Count) && (parseInt(datas[i]["@attributes"].Count)>1)) {
904
                if ((datas[i]["@attributes"].Count !== undefined) && !isNaN(datas[i]["@attributes"].Count) && (parseInt(datas[i]["@attributes"].Count, 10)>1)) {
847
                    licz += parseInt(datas[i]["@attributes"].Count);
905
                    licz += parseInt(datas[i]["@attributes"].Count, 10);
848
                } else {
906
                } else {
849
                    licz++;
907
                    licz++;
850
                }
908
                }
-
 
909
                if (hw_type == 'MEM') {
851
                for (proc_param in devparamlist) {
910
                    for (proc_param in devparamlist) {
-
 
911
                        if ((datas[i]["@attributes"][proc_param] !== undefined)) {
-
 
912
                            $('#hardware-'+hw_type+'-'+ i +'-'+proc_param).render(datas[i]["@attributes"], mem_directives);
-
 
913
                        }
-
 
914
                    }
-
 
915
                } else {
-
 
916
                    for (proc_param in devparamlist) {
852
                    if ((datas[i]["@attributes"][proc_param] !== undefined)) {
917
                        if ((datas[i]["@attributes"][proc_param] !== undefined)) {
853
                        $('#hardware-'+hw_type+'-'+ i +'-'+proc_param).render(datas[i]["@attributes"], dev_directives);
918
                            $('#hardware-'+hw_type+'-'+ i +'-'+proc_param).render(datas[i]["@attributes"], dev_directives);
-
 
919
                        }
854
                    }
920
                    }
855
                }
921
                }
856
            }
922
            }
857
            if (i > 0) {
923
            if (i > 0) {
858
                $("#" + hw_type + "Count").html(licz);
924
                $("#" + hw_type + "Count").html(licz);
Line 914... Line 980...
914
                if ((this.Details === undefined) || (this.Details["@attributes"] === undefined)) {
980
                if ((this.Details === undefined) || (this.Details["@attributes"] === undefined)) {
915
                    return '<div class="progress">' +
981
                    return '<div class="progress">' +
916
                        '<div class="progress-bar progress-bar-info" style="width:' + this["@attributes"].Percent + '%;"></div>' +
982
                        '<div class="progress-bar progress-bar-info" style="width:' + this["@attributes"].Percent + '%;"></div>' +
917
                        '</div><div class="percent">' + this["@attributes"].Percent + '%</div>';
983
                        '</div><div class="percent">' + this["@attributes"].Percent + '%</div>';
918
                } else {
984
                } else {
919
                    var rest = parseInt(this["@attributes"].Percent);
985
                    var rest = parseInt(this["@attributes"].Percent, 10);
920
                    var html = '<div class="progress">';
986
                    var html = '<div class="progress">';
921
                    if ((this.Details["@attributes"].AppPercent !== undefined) && (this.Details["@attributes"].AppPercent > 0)) {
987
                    if ((this.Details["@attributes"].AppPercent !== undefined) && (this.Details["@attributes"].AppPercent > 0)) {
922
                        html += '<div class="progress-bar progress-bar-info" style="width:' + this.Details["@attributes"].AppPercent + '%;"></div>';
988
                        html += '<div class="progress-bar progress-bar-info" style="width:' + this.Details["@attributes"].AppPercent + '%;"></div>';
923
                        rest -= parseInt(this.Details["@attributes"].AppPercent);
989
                        rest -= parseInt(this.Details["@attributes"].AppPercent, 10);
924
                    }
990
                    }
925
                    if ((this.Details["@attributes"].CachedPercent !== undefined) && (this.Details["@attributes"].CachedPercent > 0)) {
991
                    if ((this.Details["@attributes"].CachedPercent !== undefined) && (this.Details["@attributes"].CachedPercent > 0)) {
926
                        html += '<div class="progress-bar progress-bar-warning" style="width:' + this.Details["@attributes"].CachedPercent + '%;"></div>';
992
                        html += '<div class="progress-bar progress-bar-warning" style="width:' + this.Details["@attributes"].CachedPercent + '%;"></div>';
927
                        rest -= parseInt(this.Details["@attributes"].CachedPercent);
993
                        rest -= parseInt(this.Details["@attributes"].CachedPercent, 10);
928
                    }
994
                    }
929
                    if ((this.Details["@attributes"].BuffersPercent !== undefined) && (this.Details["@attributes"].BuffersPercent > 0)) {
995
                    if ((this.Details["@attributes"].BuffersPercent !== undefined) && (this.Details["@attributes"].BuffersPercent > 0)) {
930
                        html += '<div class="progress-bar progress-bar-danger" style="width:' + this.Details["@attributes"].BuffersPercent + '%;"></div>';
996
                        html += '<div class="progress-bar progress-bar-danger" style="width:' + this.Details["@attributes"].BuffersPercent + '%;"></div>';
931
                        rest -= parseInt(this.Details["@attributes"].BuffersPercent);
997
                        rest -= parseInt(this.Details["@attributes"].BuffersPercent, 10);
932
                    }
998
                    }
933
                    if (rest > 0) {
999
                    if (rest > 0) {
934
                        html += '<div class="progress-bar progress-bar-success" style="width:' + rest + '%;"></div>';
1000
                        html += '<div class="progress-bar progress-bar-success" style="width:' + rest + '%;"></div>';
935
                    }
1001
                    }
936
                    html += '</div>';
1002
                    html += '</div>';
Line 1011... Line 1077...
1011
    }
1077
    }
1012
 
1078
 
1013
    var directives = {
1079
    var directives = {
1014
        Total: {
1080
        Total: {
1015
            html: function () {
1081
            html: function () {
1016
                if ((this.Ignore !== undefined) && (this.Ignore > 0)) {
-
 
1017
                    return formatBytes(this.Total, data.Options["@attributes"].byteFormat, true);
1082
                return formatBytes(this.Total, data.Options["@attributes"].byteFormat, (this.Ignore !== undefined) && (this.Ignore > 0) && showtotals);
1018
                } else {
-
 
1019
                    return formatBytes(this.Total, data.Options["@attributes"].byteFormat);
-
 
1020
                }
-
 
1021
            }
1083
            }
1022
        },
1084
        },
1023
        Free: {
1085
        Free: {
1024
            html: function () {
1086
            html: function () {
1025
                if ((this.Ignore !== undefined) && (this.Ignore > 0)) {
-
 
1026
                    return formatBytes(this.Free, data.Options["@attributes"].byteFormat, true);
1087
                return formatBytes(this.Free, data.Options["@attributes"].byteFormat, (this.Ignore !== undefined) && (this.Ignore > 0) && showtotals);
1027
                } else {
-
 
1028
                    return formatBytes(this.Free, data.Options["@attributes"].byteFormat);
-
 
1029
                }
-
 
1030
            }
1088
            }
1031
        },
1089
        },
1032
        Used: {
1090
        Used: {
1033
            html: function () {
1091
            html: function () {
1034
                if ((this.Ignore !== undefined) && (this.Ignore >= 2)) {
-
 
1035
                    return formatBytes(this.Used, data.Options["@attributes"].byteFormat, true);
1092
                return formatBytes(this.Used, data.Options["@attributes"].byteFormat, (this.Ignore !== undefined) && (this.Ignore >= 3) && showtotals);
1036
                } else {
-
 
1037
                    return formatBytes(this.Used, data.Options["@attributes"].byteFormat);
-
 
1038
                }
-
 
1039
            }
1093
            }
1040
        },
1094
        },
1041
        MountPoint: {
1095
        MountPoint: {
1042
            text: function () {
1096
            text: function () {
1043
                return ((this.MountPoint !== undefined) ? this.MountPoint : this.MountPointID);
1097
                return ((this.MountPoint !== undefined) ? this.MountPoint : this.MountPointID);
Line 1048... Line 1102...
1048
                return this.Name.replace(/;/g, ";<wbr>") + ((this.MountOptions !== undefined) ? '<br><i>(' + this.MountOptions + ')</i>' : '');
1102
                return this.Name.replace(/;/g, ";<wbr>") + ((this.MountOptions !== undefined) ? '<br><i>(' + this.MountOptions + ')</i>' : '');
1049
            }
1103
            }
1050
        },
1104
        },
1051
        Percent: {
1105
        Percent: {
1052
            html: function () {
1106
            html: function () {
-
 
1107
                var used1 = (this.Total != 0) ? Math.ceil((this.Used / this.Total) * 100) : 0;
-
 
1108
                var used2 = Math.ceil(this.Percent);
-
 
1109
                var used21= used2 - used1;
-
 
1110
                if (used21 > 0) {
1053
                return '<div class="progress">' + '<div class="' +
1111
                    return '
' + '
-
 
1112
 
-
 
1113
 
-
 
1114
 
-
 
1115
 
-
 
1116
 
-
 
1117
 
-
 
1118
 
1054
                    ( ( ((this.Ignore == undefined) || (this.Ignore < 3)) && ((data.Options["@attributes"].threshold !== undefined) &&
1119
 
1055
                        (parseInt(this.Percent) >= parseInt(data.Options["@attributes"].threshold))) ) ? 'progress-bar progress-bar-danger' : 'progress-bar progress-bar-info' ) +
1120
 
1056
                    '" style="width:' + this.Percent + '% ;"></div>' +
1121
 
1057
                    '</div>' + '<div class="percent">' + this.Percent + '% ' + ((this.Inodes !== undefined) ? '<i>(' + this.Inodes + '%)</i>' : '') + '</div>';
1122
 
-
 
1123
 
1058
            }
1124
 
1059
        }
1125
 
1060
    };
1126
 
1061
 
1127
 
1062
    try {
1128
 
1063
        var fs_data = [];
1129
 
1064
        var datas = items(data.FileSystem.Mount);
1130
 
1065
        var total = {Total:0,Free:0,Used:0};
1131
 
-
 
1132
 
1066
        for (var i = 0; i < datas.length; i++) {
1133
 
1067
            fs_data.push(datas[i]["@attributes"]);
1134
 
-
 
1135
 
1068
            if ((datas[i]["@attributes"].Ignore !== undefined) && (datas[i]["@attributes"].Ignore > 0)) {
1136
 
1069
                if (datas[i]["@attributes"].Ignore == 1) {
1137
 
-
 
1138
 
-
 
1139
 
1070
                    total.Total += parseInt(datas[i]["@attributes"].Used);
1140
 
-
 
1141
 
-
 
1142
 
-
 
1143
 
-
 
1144
 
-
 
1145
 
1071
                    total.Used += parseInt(datas[i]["@attributes"].Used);
1146
 
1072
                }
1147
 
1073
            } else {
-
 
1074
                total.Total += parseInt(datas[i]["@attributes"].Total);
1148
 
1075
                total.Free += parseInt(datas[i]["@attributes"].Free);
-
 
1076
                total.Used += parseInt(datas[i]["@attributes"].Used);
-
 
1077
            }
1149
 
1078
            total.Percent = (total.Total !== 0) ? round((total.Used / total.Total) * 100, 2) : 0;
-
 
1079
        }
1150
 
1080
        if (i > 0) {
1151
 
1081
            $('#filesystem-data').render(fs_data, directives);
1152
 
-
 
1153
 
1082
            $('#filesystem-foot').render(total, directives);
1154
 
-
 
1155
 
-
 
1156
 
1083
            $('#filesystem_MountPoint').removeClass("sorttable_sorted"); //reset sort order
1157
 
1084
//            sorttable.innerSortFunction.apply(document.getElementById('filesystem_MountPoint'), []);
1158
 
1085
            sorttable.innerSortFunction.apply($('#filesystem_MountPoint')[0], []);
1159
 
1086
            $("#block_filesystem").show();
1160
 
1087
        } else {
1161
 
Line 1290... Line 1364...
1290
 
1364
 
1291
 
1365
 
1292
 
1366
 
1293
 
1367
 
1294
 
1368
 
-
 
1369
 
-
 
1370
 
-
 
1371
 
-
 
1372
 
-
 
1373
 
1295
 
1374
 
-
 
1375
 
1296
 
1376
 
1297
 
1377
 
1298
 
1378
 
1299
 
1379
 
1300
 
1380
 
-
 
1381
 
-
 
1382
 
-
 
1383
 
1301
 
1384
 
-
 
1385
 
-
 
1386
 
1302
 
1387
 
1303
 
1388
 
1304
 
1389
 
1305
 
1390
 
1306
 
1391
 
Line 1423... Line 1508...
1423
 
1508
 
1424
 
1509
 
1425
 
1510
 
1426
 
1511
 
1427
 
1512
 
-
 
1513
 
-
 
1514
 
-
 
1515
 
-
 
1516
 
-
 
1517
 
-
 
1518
 
-
 
1519
 
-
 
1520
 
-
 
1521
 
-
 
1522
 
-
 
1523
 
-
 
1524
 
1428
 
1525
 
1429
 
1526
 
1430
 
1527
 
1431
 
1528
 
1432
 
1529
 
Line 1639... Line 1736...
1639
 
1736
 
1640
 
1737
 
1641
 
1738
 
1642
 
1739
 
1643
 
1740
 
-
 
1741
 
-
 
1742
 
-
 
1743
 
-
 
1744
 
-
 
1745
 
-
 
1746
 
-
 
1747
 
-
 
1748
 
-
 
1749
 
-
 
1750
 
-
 
1751
 
-
 
1752
 
-
 
1753
 
-
 
1754
 
-
 
1755
 
-
 
1756
 
-
 
1757
 
1644
 
1758
 
1645
 
1759
 
1646
 
1760
 
1647
 
1761
 
1648
 
1762