Merge branch 'master' of github.com:ZoneMinder/zoneminder

pull/4023/head
Isaac Connor 2024-05-21 14:54:08 -04:00
commit 642d50fb8a
7 changed files with 32 additions and 30 deletions

View File

@ -972,6 +972,8 @@ public static function getStatuses() {
* Same width height. If both are set we should calculate the smaller resulting scale
*/
function getStreamHTML($options) {
global $basename;
if (isset($options['scale']) and $options['scale'] != '' and $options['scale'] != 'fixed') {
if ($options['scale'] != 'auto' && $options['scale'] != '0') {
$options['width'] = reScale($this->ViewWidth(), $options['scale']).'px';
@ -1021,10 +1023,11 @@ public static function getStatuses() {
if ($this->StreamReplayBuffer())
$options['buffer'] = $this->StreamReplayBuffer();
//Warning("width: " . $options['width'] . ' height: ' . $options['height']. ' scale: ' . $options['scale'] );
$blockRatioControl = ($basename == "montage") ? '<div id="ratioControl'.$this->Id().'" class="ratioControl hidden"><select name="ratio'.$this->Id().'" id="ratio'.$this->Id().'" class="select-ratio chosen" data-on-change="changeRatio">
</select></div>' : '';
$html = '
<div id="m'. $this->Id() . '" class="grid-monitor grid-stack-item" gs-id="'. $this->Id() . '" gs-w="12" gs-auto-position="true">
<div id="ratioControl'.$this->Id().'" class="ratioControl hidden"><select name="ratio'.$this->Id().'" id="ratio'.$this->Id().'" class="select-ratio chosen" data-on-change="changeRatio">
</select></div>
' . $blockRatioControl . '
<div class="grid-stack-item-content">
<div id="monitor'. $this->Id() . '" data-id="'.$this->Id().'" class="monitor" title="'.$this->Id(). ' '.$this->Name().'">
<div

View File

@ -1154,6 +1154,10 @@ function applyChosen() {
$j('.chosen.chosen-auto-width').chosen({allow_single_deselect: true, disable_search_threshold: limit_search_threshold, search_contains: true, width: "auto"});
}
function stringToNumber(str) {
return parseInt(str.replace(/\D/g, ''));
}
const font = new FontFaceObserver('Material Icons', {weight: 400});
font.load().then(function() {
$j('.material-icons').css('display', 'inline-block');

View File

@ -1956,10 +1956,5 @@ function panZoomOut(el) {
manageCursor(id);
}
function stringToNumber(str) {
//This function will probably need to be moved to the main JS file, because now used on Watch & Montage pages
return parseInt(str.replace(/\D/g, ''));
}
// Kick everything off
$j( window ).on("load", initPage);

View File

@ -48,10 +48,6 @@ var defaultPresetRatio = 'auto';
var averageMonitorsRatio;
function stringToNumber(str) {
return parseInt(str.replace(/\D/g, ''));
}
function isPresetLayout(name) {
return ((ZM_PRESET_LAYOUT_NAMES.indexOf(name) != -1) ? true : false);
}
@ -155,7 +151,8 @@ function selectLayout(new_layout_id) {
const monitor_wrapper = monitor_frame.closest('[gs-id="' + monitor.id + '"]');
if (nameLayout == "Freeform") {
monitor_wrapper.attr('gs-w', 12).removeAttr('gs-x').removeAttr('gs-y').removeAttr('gs-h');
monitor_wrapper.attr('gs-w', layoutColumns / stringToNumber(freeform_layout_id)).removeAttr('gs-x').removeAttr('gs-y').removeAttr('gs-h');
//monitor_wrapper.attr('gs-w', 12).removeAttr('gs-x').removeAttr('gs-y').removeAttr('gs-h');
} else {
monitor_wrapper.attr('gs-w', widthFrame).removeAttr('gs-x').removeAttr('gs-y').removeAttr('gs-h');
}
@ -449,7 +446,7 @@ function delete_layout(button) {
}
if (!document.getElementById('deleteConfirm')) {
// Load the delete confirmation modal into the DOM
// $j.getJSON(thisUrl + '?request=modal&modal=delconfirm')
// $j.getJSON(thisUrl + '?request=modal&modal=delconfirm')
$j.getJSON(thisUrl + '?request=modal&modal=delconfirm', {
key: 'ConfirmDeleteLayout',
})
@ -552,6 +549,7 @@ function handleClick(evt) {
const point = {clientX: event.clientX, clientY: event.clientY};
panZoom[id].zoomToPoint(scale, point, {focal: {x: event.clientX, y: event.clientY}});
}
setTriggerChangedMonitors(id);
//updateScale = true;
}
}
@ -709,9 +707,9 @@ function initPage() {
$j("#flipMontageHeader").slideToggle("fast");
$j("#hdrbutton").toggleClass('glyphicon-menu-down').toggleClass('glyphicon-menu-up');
}
// if (getCookie('zmMontageLayout')) { //This is implemented in montage.php And the cookies may contain the number of a non-existent Layouts!!!
// $j('#zmMontageLayout').val(getCookie('zmMontageLayout'));
// }
//if (getCookie('zmMontageLayout')) { //This is implemented in montage.php And the cookies may contain the number of a non-existent Layouts!!!
// $j('#zmMontageLayout').val(getCookie('zmMontageLayout'));
//}
$j(".grid-monitor").hover(
//Displaying "Scale" and other buttons at the top of the monitor image

View File

@ -47,6 +47,6 @@ layouts[<?php echo $layout->Id() ?>] = {
"Positions":<?php echo json_decode($layout->Positions())?$layout->Positions():'{}' ?>};
<?php
} // end foreach layout
global $FreeFormLayoutId;
echo 'freeform_layout_id='.$FreeFormLayoutId.';'
global $AutoLayoutName;
echo 'freeform_layout_id="'.$AutoLayoutName.'";'
?>

View File

@ -1512,10 +1512,5 @@ function monitorsSetScale(id=null) {
}
}
function stringToNumber(str) {
//This function will probably need to be moved to the main JS file, because now used on Watch & Montage pages
return parseInt(str.replace(/\D/g, ''));
}
// Kick everything off
$j( window ).on("load", initPage);

View File

@ -80,7 +80,7 @@ if (isset($_REQUEST['monitorStatusPositonSelected'])) {
$layouts = ZM\MontageLayout::find(NULL, array('order'=>"lower('Name')"));
$layoutsById = array();
$FreeFormLayoutId = 0;
$AutoLayoutName = '';
/* Create an array "Name"=>"Id" to make it easier to find IDs by name*/
$arrNameId = array();
@ -101,10 +101,13 @@ uasort($layouts, function($a, $b) {
/* Add custom Layouts & assign objects instead of names for preset Layouts */
foreach ( $layouts as $l ) {
$nameLayout = $l->Name();
if ( $l->Name() == 'Freeform' ) {
$FreeFormLayoutId = $l->Id();
$AutoLayoutName = $l->Id(); //Temporarily assign ID instead of Name to simplify the comparison code
$nameLayout = "Auto";
}
$layoutsById[$l->Id()] = $l;
//$layoutsById[$l->Id()] = $l;
$layoutsById[$l->Id()] = $nameLayout;
}
zm_session_start();
@ -199,16 +202,20 @@ foreach ($displayMonitors as &$row) {
}
} # end foreach Monitor
if (!$layout_id || !is_numeric($layout_id) || !isset($layoutsById[$layout_id])) {
if (!$layout_id || !is_numeric($layout_id) || !isset($layoutsById[$layout_id]) || $layout_id == $AutoLayoutName) {
$default_layout = '';
if (count($monitors) > 6) {
if (count($monitors) >= 6) {
$default_layout = '6 Wide';
} else if (count($monitors) > 4) {
} else if (count($monitors) >= 4) {
$default_layout = '4 Wide';
} else {
$default_layout = '2 Wide';
}
if ($layout_id != $AutoLayoutName) {
$layout_id = $arrNameId[$default_layout];
} else {
$AutoLayoutName = $default_layout;
}
}
if ( $layout_id and is_numeric($layout_id) and isset($layoutsById[$layout_id]) ) {