Skip to content

Commit

Permalink
Update montage.js.php
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorA100 authored Sep 18, 2024
1 parent 36b97a3 commit e2fd93c
Showing 1 changed file with 36 additions and 5 deletions.
41 changes: 36 additions & 5 deletions web/skins/classic/views/js/montage.js.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,29 @@
const statusRefreshTimeout = <?php echo 1000*ZM_WEB_REFRESH_STATUS ?>;

const canStreamNative = <?php echo canStreamNative()?'true':'false' ?>;
const streamTimeout = <?php echo 1000*ZM_WEB_REFRESH_STATUS ?>;

var monitorData = new Array();

<?php
global $presetLayoutsNames;
global $Montage;
global $speeds;
global $speedIndex;

$layouts = $Montage::$layoutsById;
$presetLayoutsNames = $Montage::$presetLayoutsNames;

echo 'const ZM_PRESET_LAYOUT_NAMES = '.json_encode($presetLayoutsNames).';'.PHP_EOL;
#slider scale, which is only for replay and relative to real time
echo 'var currentSpeed='.$speeds[$speedIndex].';'.PHP_EOL;
echo 'var speedIndex=' . $speedIndex.';'.PHP_EOL;

global $monitors;
$monitors = $Montage::$monitors;
foreach ( $monitors as $monitor ) {
?>
monitorData[monitorData.length] = {
'id': <?php echo $monitor->Id() ?>,
'name': '<?php echo $monitor->Name() ?>',
'server_id': '<?php echo $monitor->ServerId() ?>',
'connKey': '<?php echo $monitor->connKey() ?>',
'width': <?php echo $monitor->ViewWidth() ?>,
Expand All @@ -34,6 +45,7 @@
'url_to_snapshot': '<?php echo $monitor->UrlToZMS(ZM_MIN_STREAMING_PORT ? ($monitor->Id() + ZM_MIN_STREAMING_PORT) : '').'&mode=single' ?>',
'onclick': function(){window.location.assign( '?view=watch&mid=<?php echo $monitor->Id() ?>' );},
'type': '<?php echo $monitor->Type() ?>',
'capturing': '<?php echo $monitor->Capturing() ?>',
'refresh': '<?php echo $monitor->Refresh() ?>',
'janus_pin': '<?php echo $monitor->Janus_Pin() ?>'
};
Expand All @@ -43,7 +55,7 @@
layouts = new Array();
layouts[0] = {}; // reserved, should hold which fields to clear when transitioning
<?php
global $layouts;

foreach ( $layouts as $layout ) {
?>
layouts[<?php echo $layout->Id() ?>] = {
Expand All @@ -52,6 +64,25 @@
"Positions":<?php echo json_decode($layout->Positions())?$layout->Positions():'{}' ?>};
<?php
} // end foreach layout
global $AutoLayoutName;
echo 'const autoLayoutName="'.$AutoLayoutName.'";'
echo 'const autoLayoutName="'.$Montage::$AutoLayoutName.'";'.PHP_EOL;
echo 'const request_montage='.json_encode($_REQUEST).';'.PHP_EOL;

$showZones = false;
if (isset($_REQUEST['showZones'])) {
if ($_REQUEST['showZones'] == 1) {
$showZones = true;
}
}
echo 'const showZones="'.$showZones.'";'.PHP_EOL;

echo 'var speeds=[';
for ( $i=0; $i < count($speeds); $i++ )
echo (($i>0)?', ':'') . $speeds[$i];
echo "];\n".PHP_EOL;

?>
var translate = {
"events": "<?php echo translate('events') ?>",
"TooManyEventsForTimeline": "<?php echo translate('TooManyEventsForTimeline') ?>",
"Start Time": "<?php echo translate('Start Time') ?>",
};

0 comments on commit e2fd93c

Please sign in to comment.