@@ -64,7 +64,28 @@ function xhtmlHeadersStart($file, $title) {
64
64
<link rel="shortcut icon" href="graphics/favicon.ico"/>
65
65
' ;
66
66
}
67
- echo output_link_if_exists (array ('css/base/material-icons.css ' ));
67
+
68
+ echo output_link_if_exists (array ('fonts/material-icons.woff2 ' ), false , $ param = ['global ' , 'preload ' , ' as="font" type="font/woff2" crossorigin ' ]);
69
+ //echo output_link_if_exists(array('fonts/material-icons.woff'), false, $param = ['global', 'preload', ' as="font" type="font/woff" crossorigin']);
70
+ echo output_link_if_exists (array ('css/base/material-icons.css ' ), false );
71
+ echo output_script_if_exists (array (
72
+ 'js/fontfaceobserver.standalone.js ' ,
73
+ ));
74
+
75
+ ?>
76
+ <script nonce="<?php echo $ cspNonce ; ?> ">
77
+ const fontMaterialIcons = new FontFaceObserver("Material Icons", {weight: 400});
78
+ fontMaterialIcons.load(null, 30000).then(function() {
79
+ console.log("Material Icons is loaded");
80
+ var _style_ = document.createElement('style');
81
+ _style_.innerHTML = `.material-icons {display: inline-block !important;}`;
82
+ document.querySelector('head').prepend(_style_);
83
+ }, function() {
84
+ console.log("Material Icons is NOT loaded");
85
+ });
86
+ </script>
87
+ <?php
88
+
68
89
echo output_cache_busted_stylesheet_links (array (
69
90
'css/reset.css ' ,
70
91
'css/font-awesome.min.css ' ,
@@ -161,15 +182,25 @@ function getNavBarHTML() {
161
182
return ob_get_clean ();
162
183
}
163
184
164
- function output_link_if_exists ($ files , $ cache_bust =true ) {
185
+ function output_link_if_exists ($ files , $ cache_bust =true , $ param = false ) {
165
186
global $ skin ;
166
187
$ html = array ();
188
+ if ($ param ) {
189
+ $ global_file = $ param [0 ]; // The file is global or from a skin
190
+ $ rel = '" ' .$ param [1 ].'" ' ;
191
+ $ suffix = $ param [2 ];
192
+ } else {
193
+ $ global_file = false ;
194
+ $ rel = '"stylesheet" ' ;
195
+ $ suffix = ' type="text/css" ' ;
196
+ }
167
197
foreach ( $ files as $ file ) {
168
- if ( getSkinFile ($ file ) ) {
198
+ $ file_ = ($ global_file && file_exists ($ file )) ? $ file : getSkinFile ($ file );
199
+ if ($ file_ ) {
169
200
if ( $ cache_bust ) {
170
- $ html [] = '<link rel="stylesheet" href=" ' .cache_bust (' skins/ ' . $ skin . ' / ' .$ file ). ' " type="text/css" /> ' ;
201
+ $ html [] = '<link rel= ' . $ rel . ' href=" ' .cache_bust ($ file_ ). ' " ' .$ suffix . ' /> ' ;
171
202
} else {
172
- $ html [] = '<link rel="stylesheet" href="skins/ ' .$ skin . ' / ' .$ file . ' " type="text/css" /> ' ;
203
+ $ html [] = '<link rel= ' . $ rel . ' href=" ' .$ file_ . ' " ' .$ suffix . ' /> ' ;
173
204
}
174
205
}
175
206
}
@@ -449,7 +480,7 @@ function getDbConHTML() {
449
480
$ result .= '<i class="material-icons md-18 mr-1" style="display: inline-block;">storage</i> ' .PHP_EOL ;
450
481
$ result .= translate ('DB ' ). ': ' .$ connections . '/ ' .$ max_connections .PHP_EOL ;
451
482
$ result .= '</li> ' .PHP_EOL ;
452
-
483
+
453
484
return $ result ;
454
485
}
455
486
@@ -503,7 +534,7 @@ function getStorageHTML() {
503
534
$ result .= '</div> ' .PHP_EOL ;
504
535
$ result .= '</li> ' .PHP_EOL ;
505
536
}
506
-
537
+
507
538
return $ result ;
508
539
}
509
540
@@ -538,7 +569,7 @@ function getRamHTML() {
538
569
} # end if SwapTotal
539
570
$ result .= '</li> ' .PHP_EOL ;
540
571
}
541
-
572
+
542
573
return $ result ;
543
574
}
544
575
@@ -643,7 +674,7 @@ function getZMVersionHTML() {
643
674
$ result .= '<li id="getZMVersionHTML" class="nav-item dropdown ' .$ class . '" data-placement="bottom" title=" ' .$ tt_text . '"> ' .PHP_EOL ;
644
675
$ result .= $ content ;
645
676
$ result .= '</li> ' .PHP_EOL ;
646
-
677
+
647
678
return $ result ;
648
679
}
649
680
@@ -669,11 +700,11 @@ function getNavBrandHTML() {
669
700
function getConsoleHTML () {
670
701
global $ user ;
671
702
$ result = '' ;
672
-
703
+
673
704
if (count ($ user ->viewableMonitorIds ()) or !ZM \Monitor::find_one ()) {
674
705
$ result .= '<li id="getConsoleHTML" class="nav-item"><a class="nav-link" href="?view=console"> ' .translate ('Console ' ).'</a></li> ' .PHP_EOL ;
675
706
}
676
-
707
+
677
708
return $ result ;
678
709
}
679
710
@@ -684,7 +715,7 @@ function getOptionsHTML() {
684
715
if ( canView ('System ' ) ) {
685
716
$ result .= '<li id="getOptionsHTML" class="nav-item"><a class="nav-link" href="?view=options"> ' .translate ('Options ' ).'</a></li> ' .PHP_EOL ;
686
717
}
687
-
718
+
688
719
return $ result ;
689
720
}
690
721
@@ -706,7 +737,7 @@ function getLogHTML() {
706
737
// Returns the html representing the log icon
707
738
function getLogIconHTML () {
708
739
$ result = '' ;
709
-
740
+
710
741
if ( canView ('System ' ) ) {
711
742
if ( ZM \logToDatabase () > ZM \Logger::NOLOG ) {
712
743
$ logstate = logState ();
@@ -716,18 +747,18 @@ function getLogIconHTML() {
716
747
'</li> ' .PHP_EOL ;
717
748
}
718
749
}
719
-
750
+
720
751
return $ result ;
721
752
}
722
753
723
754
// Returns the html representing the X10 Devices menu item
724
755
function getDevicesHTML () {
725
756
$ result = '' ;
726
-
757
+
727
758
if ( ZM_OPT_X10 && canView ('Devices ' ) ) {
728
759
$ result .= '<li id="getDevicesHTML" class="nav-item"><a class="nav-link" href="?view=devices">Devices</a></li> ' .PHP_EOL ;
729
760
}
730
-
761
+
731
762
return $ result ;
732
763
}
733
764
@@ -761,20 +792,20 @@ function getCycleHTML($view) {
761
792
$ class = $ view == 'cycle ' ? ' selected ' : '' ;
762
793
$ result .= '<li id="getCycleHTML" class="nav-item"><a class="nav-link ' .$ class .'" href="?view=watch&cycle=true"> ' .translate ('Cycle ' ). '</a></li> ' .PHP_EOL ;
763
794
}
764
-
795
+
765
796
return $ result ;
766
797
}
767
798
768
799
// Returns the html representing the Montage menu item
769
800
function getMontageHTML ($ view ) {
770
801
global $ user ;
771
802
$ result = '' ;
772
-
803
+
773
804
if (canView ('Stream ' ) and count ($ user ->viewableMonitorIds ())) {
774
805
$ class = $ view == 'montage ' ? ' selected ' : '' ;
775
806
$ result .= '<li id="getMontageHTML" class="nav-item"><a class="nav-link ' .$ class .'" href="?view=montage"> ' .translate ('Montage ' ). '</a></li> ' .PHP_EOL ;
776
807
}
777
-
808
+
778
809
return $ result ;
779
810
}
780
811
@@ -801,42 +832,42 @@ function getMontageReviewHTML($view) {
801
832
$ class = $ view == 'montagereview ' ? ' selected ' : '' ;
802
833
$ result .= '<li id="getMontageReviewHTML" class="nav-item"><a class="nav-link ' .$ class .'" href="?view=montagereview ' .$ live . '"> ' .translate ('MontageReview ' ).'</a></li> ' .PHP_EOL ;
803
834
}
804
-
835
+
805
836
return $ result ;
806
837
}
807
838
808
839
// Returns the html representing the Montage menu item
809
840
function getSnapshotsHTML ($ view ) {
810
841
$ result = '' ;
811
-
842
+
812
843
if (defined ('ZM_FEATURES_SNAPSHOTS ' ) and ZM_FEATURES_SNAPSHOTS and canView ('Snapshots ' )) {
813
844
$ class = $ view == 'snapshots ' ? ' selected ' : '' ;
814
845
$ result .= '<li id="getSnapshotsHTML" class="nav-item"><a class="nav-link ' .$ class .'" href="?view=snapshots"> ' .translate ('Snapshots ' ). '</a></li> ' .PHP_EOL ;
815
846
}
816
-
847
+
817
848
return $ result ;
818
849
}
819
850
820
851
function getReportsHTML ($ view ) {
821
852
$ result = '' ;
822
-
853
+
823
854
if (canView ('Events ' )) {
824
855
$ class = ($ view == 'reports ' or $ view == 'report ' ) ? ' selected ' : '' ;
825
856
$ result .= '<li id="getReportsHTML" class="nav-item"><a class="nav-link ' .$ class .'" href="?view=reports"> ' .translate ('Reports ' ).'</a></li> ' .PHP_EOL ;
826
857
}
827
-
858
+
828
859
return $ result ;
829
860
}
830
861
831
862
// Returns the html representing the Audit Events Report menu item
832
863
function getRprtEvntAuditHTML ($ view ) {
833
864
$ result = '' ;
834
-
865
+
835
866
if ( canView ('Events ' ) ) {
836
867
$ class = $ view == 'report_event_audit ' ? ' selected ' : '' ;
837
868
$ result .= '<li id="getRprtEvntAuditHTML" class="nav-item"><a class="nav-link ' .$ class .'" href="?view=report_event_audit"> ' .translate ('ReportEventAudit ' ).'</a></li> ' .PHP_EOL ;
838
869
}
839
-
870
+
840
871
return $ result ;
841
872
}
842
873
@@ -942,7 +973,7 @@ function getStatsTableHTML($eid, $fid, $row='') {
942
973
$ result .= '</thead> ' .PHP_EOL ;
943
974
944
975
$ result .= '<tbody> ' .PHP_EOL ;
945
-
976
+
946
977
if ( count ($ stats ) ) {
947
978
foreach ( $ stats as $ stat ) {
948
979
$ result .= '<tr> ' .PHP_EOL ;
@@ -972,7 +1003,7 @@ function getStatsTableHTML($eid, $fid, $row='') {
972
1003
973
1004
$ result .= '</tbody> ' .PHP_EOL ;
974
1005
$ result .= '</table> ' .PHP_EOL ;
975
-
1006
+
976
1007
return $ result ;
977
1008
}
978
1009
@@ -993,6 +1024,7 @@ function xhtmlFooter() {
993
1024
global $ view ;
994
1025
global $ skin ;
995
1026
global $ basename ;
1027
+
996
1028
$ skinJsPhpFile = getSkinFile ('js/skin.js.php ' );
997
1029
$ viewJsFile = getSkinFile ('views/js/ ' .$ basename .'.js ' );
998
1030
$ viewJsPhpFile = getSkinFile ('views/js/ ' .$ basename .'.js.php ' );
@@ -1012,7 +1044,6 @@ function xhtmlFooter() {
1012
1044
}
1013
1045
1014
1046
echo output_script_if_exists (array (
1015
- 'js/fontfaceobserver.standalone.js ' ,
1016
1047
'js/tableExport.min.js ' ,
1017
1048
'js/bootstrap-table-1.23.5/bootstrap-table.min.js ' ,
1018
1049
'js/bootstrap-table-1.23.5/extensions/locale/bootstrap-table-locale-all.min.js ' ,
0 commit comments