Fix selecting layout after save by using value in session. When applying layout, if height is auto, set the img height to auto.
This commit is contained in:
parent
17fbafd7de
commit
1ab294e291
|
@ -210,7 +210,6 @@ function Monitor(monitorData) {
|
|||
* @param {*} element - the event data passed by onchange callback
|
||||
*/
|
||||
function selectLayout(element) {
|
||||
console.log(element);
|
||||
layout = $j(element).val();
|
||||
|
||||
if ( layout_id = parseInt(layout) ) {
|
||||
|
@ -221,8 +220,8 @@ function selectLayout(element) {
|
|||
// Need to clear the current positioning, and apply the new
|
||||
|
||||
monitor_frame = $j('#monitorFrame'+monitor.id);
|
||||
if ( ! monitor_frame ) {
|
||||
console.log("Error finding frame for " + monitor.id);
|
||||
if ( !monitor_frame ) {
|
||||
console.log('Error finding frame for ' + monitor.id);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -262,6 +261,10 @@ function selectLayout(element) {
|
|||
if ( streamImg.nodeName == 'IMG' ) {
|
||||
var src = streamImg.src;
|
||||
src = src.replace(/width=[\.\d]+/i, 'width=0' );
|
||||
if ( $j('#height').val() == 'auto' ) {
|
||||
src = src.replace(/height=[\.\d]+/i, 'height=0' );
|
||||
streamImg.style.height = 'auto';
|
||||
}
|
||||
if ( src != streamImg.src ) {
|
||||
streamImg.src = '';
|
||||
streamImg.src = src;
|
||||
|
|
|
@ -69,17 +69,19 @@ foreach ( $layouts as $l ) {
|
|||
}
|
||||
}
|
||||
foreach ( $layouts as $l ) {
|
||||
if ( $l->Name() != "Freeform" )
|
||||
if ( $l->Name() != 'Freeform' )
|
||||
$layoutsById[$l->Id()] = $l;
|
||||
}
|
||||
|
||||
session_start();
|
||||
zm_session_start();
|
||||
|
||||
$layout_id = '';
|
||||
if ( isset($_COOKIE['zmMontageLayout']) ) {
|
||||
$layout_id = $_SESSION['zmMontageLayout'] = $_COOKIE['zmMontageLayout'];
|
||||
#} elseif ( isset($_SESSION['zmMontageLayout']) ) {
|
||||
#$layout_id = $_SESSION['zmMontageLayout'];
|
||||
ZM\Logger::Debug("Using layout $layout_id");
|
||||
} elseif ( isset($_SESSION['zmMontageLayout']) ) {
|
||||
$layout_id = $_SESSION['zmMontageLayout'];
|
||||
ZM\Logger::Debug("Using layout $layout_id from session");
|
||||
}
|
||||
|
||||
$options = array();
|
||||
|
@ -88,6 +90,8 @@ $Positions = '';
|
|||
if ( $layout_id and is_numeric($layout_id) and isset($layoutsById[$layout_id]) ) {
|
||||
$Layout = $layoutsById[$layout_id];
|
||||
$Positions = json_decode($Layout->Positions(), true);
|
||||
} else {
|
||||
ZM\Logger::Debug("Layout not found");
|
||||
}
|
||||
if ( $Layout and ( $Layout->Name() != 'Freeform' ) ) {
|
||||
// Use layout instead of other options
|
||||
|
|
Loading…
Reference in New Issue