Browse Source

Embed Video Encoder settings: working Save, logo upload, module removal

- New updateServerModuleSettings.php: saves the Embed Video Encoder
  settings window (frame size, port, quality, time stamp / label / logo)
  with range checks. Other module types get a clear "not supported".
- Settings window: Save button shown when the content provides
  saveSettings(); the Time Stamp, Label and Logo tabs and the show
  checkboxes are enabled again.
- Positions are pixel number fields (negative = from right / bottom edge,
  as la_mojo uses them); font scale / thickness are number fields; line
  type offers OpenCV values (normal 8, thin 4, antialiased 16, old 0/1
  shown as 8/4). Hints explain positions and that the time stamp is only
  drawn when the label is off.
- New uploadAsset.php: logo upload converts any GD-readable picture to an
  RGBA PNG data/assets/images/<md5>.png and stores logo_md5; the preview
  shows the current logo and the first upload proposes a size.
- doModuleOperation.php removal: real module type ids (2 Kafka, 6 SSDP,
  8 Embed Video, 9 Modem, 12 BVMS, 13 Attention) and tables that do not
  exist in the database are skipped instead of failing.
- Frame preview no longer fails when the Logo tab is not rendered yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0139veDo3XyavMuVhdnHcN16
pull/3/head
Claude 4 hours ago
parent
commit
1be406d693
Failed to extract signature
  1. 2
      lib/1.json
  2. 2
      lib/2.json
  3. 2
      lib/3.json
  4. 2
      lib/4.json
  5. 2
      lib/5.json
  6. 2
      lib/6.json
  7. 2
      lib/7.json
  8. 61
      lib/controller/doModuleOperation.php
  9. 104
      lib/controller/getModuleSettings.php
  10. 90
      lib/controller/updateServerModuleSettings.php
  11. 62
      lib/controller/uploadAsset.php
  12. 86
      lib/javascript/jsapi_dynamic/rgoose_modules.js

2
lib/1.json
File diff suppressed because it is too large
View File

2
lib/2.json
File diff suppressed because it is too large
View File

2
lib/3.json
File diff suppressed because it is too large
View File

2
lib/4.json
File diff suppressed because it is too large
View File

2
lib/5.json
File diff suppressed because it is too large
View File

2
lib/6.json
File diff suppressed because it is too large
View File

2
lib/7.json
File diff suppressed because it is too large
View File

61
lib/controller/doModuleOperation.php

@ -24,48 +24,27 @@
if( count( $TT ) ){
$JJ = $TT[0];
switch( $CMD ){
case 1:
switch( $JJ['type'] ){
case 1:{//ZL
$QS = "DELETE FROM `media_servers` WHERE `id`={$JJ['aux_id']}";
$DATABASE->Query( $QS );
$QS = "DELETE FROM `media_server_streams` WHERE `media_server_id`={$JJ['aux_id']}";
$DATABASE->Query( $QS );
break;
};
case 3:{//Kafka
$QS = "DELETE FROM `modules_kafka` WHERE `id`={$JJ['aux_id']}";
$DATABASE->Query( $QS );
$QS = "DELETE FROM `module_kafka_settings` WHERE `module_id`={$JJ['aux_id']}";
$DATABASE->Query( $QS );
break;
};
case 6:{//SSDP
$QS = "DELETE FROM `module_ssdp` WHERE `id`={$JJ['aux_id']}";
$DATABASE->Query( $QS );
break;
};
case 9:{// Embed VIO
$QS = "DELETE FROM `module_eve` WHERE `id`={$JJ['aux_id']}";
$DATABASE->Query( $QS );
break;
};
case 10:{// Modem Manager
$QS = "DELETE FROM `module_modem` WHERE `id`={$JJ['aux_id']}";
$DATABASE->Query( $QS );
$QS = "DELETE FROM `module_modem_phonebook`";
$DATABASE->Query( $QS );
break;
};
case 13:{
$QS = "DELETE FROM `module_bvms` WHERE `id`={$JJ['aux_id']}";
$DATABASE->Query( $QS );
break;
};
case 13:{
$QS = "DELETE FROM `module_attention` WHERE `id`={$JJ['aux_id']}";
$DATABASE->Query( $QS );
case 1:
// remove the module's own settings row(s); module_types ids:
// 2 Kafka, 6 SSDP, 8 Embed Video, 9 Modem Manager, 12 Bosch VMS, 13 Attention Cloud
$AUX = intval( $JJ['aux_id'] );
$DEL = array();
switch( intval( $JJ['type'] ) ){
case 2: $DEL[] = "DELETE FROM `module_kafka` WHERE `id`={$AUX}"; break;
case 6: $DEL[] = "DELETE FROM `module_ssdp` WHERE `id`={$AUX}"; break;
case 8: $DEL[] = "DELETE FROM `module_eve` WHERE `id`={$AUX}"; break;
case 9:
$DEL[] = "DELETE FROM `module_modem` WHERE `id`={$AUX}";
$DEL[] = "DELETE FROM `module_modem_phonebook`";
break;
case 12: $DEL[] = "DELETE FROM `module_bvms` WHERE `id`={$AUX}"; break;
case 13: $DEL[] = "DELETE FROM `module_attention` WHERE `id`={$AUX}"; break;
};
foreach( $DEL as $DQ ){
// skip tables missing in this database (Query() would die())
if( preg_match( '/FROM `([a-z_]+)`/', $DQ, $TM ) ){
$TX = $DATABASE->Query( "SELECT name FROM sqlite_master WHERE type='table' AND name='{$TM[1]}'", false );
if( count( $TX ) ) $DATABASE->Query( $DQ, false );
};
};
$QS = "DELETE FROM `modules` WHERE `id`={$MID}";

104
lib/controller/getModuleSettings.php

@ -474,6 +474,11 @@ EFUFU;
$LV_ICE = json_encode( isset( $CI['live_ice_servers'] ) ? strval( $CI['live_ice_servers'] ) : '' );
$LV_ENC_DIS = ( $LV_MODE == 2 ) ? 'false' : 'true';
$LV_SEG_DIS = ( $LV_REC ) ? 'false' : 'true';
// OpenCV line types; old values 0 / 1 mean 8 / 4 connected
$EVE_LT = function( $V ){ $V = intval( $V ); if( $V == 0 ) return 8; if( $V == 1 ) return 4; return in_array( $V, array( 4, 8, 16 ) ) ? $V : 8; };
$TS_LT = $EVE_LT( $CI['ts_line_type'] );
$LBL_LT = $EVE_LT( $CI['label_line_type'] );
$LOGO_URL = ( isset( $CI['logo_md5'] ) && preg_match( '/^[0-9a-f]{32}$/', $CI['logo_md5'] ) && is_file( __DIR__.'/data/assets/images/'.$CI['logo_md5'].'.png' ) ) ? '/lib/controller/data/assets/images/'.$CI['logo_md5'].'.png' : '/lib/controller/data/assets/images/7shields.png';
$TPL =<<<EFUFU
{
xtype: 'tabpanel',
@ -544,9 +549,6 @@ EFUFU;
title:'{$Labels->GetLabel("_ERROR_MSG_")}',
msg: data['msg'],
buttons: Ext.Msg.OK,
fn: function(){
SettingsLidar3D.hide();
},
icon: Ext.MessageBox.ERROR
});
};
@ -641,21 +643,18 @@ EFUFU;
xtype: 'checkbox',
fieldLabel: '{$Labels->GetLabel('_EVE_SHOW_TS_')}',
id: 'eve_show_ts',
disabled: true,
checked: {$CI['show_ts']},
handler: updateFramePreview
},{
xtype: 'checkbox',
fieldLabel: '{$Labels->GetLabel('_EVE_SHOW_LBL_')}',
id: 'eve_show_lbl',
disabled: true,
checked: {$CI['show_label']},
handler: updateFramePreview
},{
xtype: 'checkbox',
fieldLabel: '{$Labels->GetLabel('_EVE_SHOW_LOGO_')}',
id: 'eve_show_logo',
disabled: true,
checked: {$CI['show_logo']},
handler: updateFramePreview
}]
@ -795,22 +794,23 @@ EFUFU;
title: 'Time Stamp',
labelWidth: 180,
labelAlign: 'right',
disabled: true,
items:[{
xtype: 'slider',
xtype: 'numberfield',
fieldLabel: '{$Labels->GetLabel('_EVE_TS_POSX_')}',
id: 'TS_POSX',
width: 120,
minValue: 0,
maxValue: 100,
allowDecimals: false,
minValue: -1920,
maxValue: 1920,
value: {$CI['ts_x']}
},{
xtype: 'slider',
xtype: 'numberfield',
fieldLabel: '{$Labels->GetLabel('_EVE_TS_POSY_')}',
id: 'TS_POSY',
width: 120,
minValue: 0,
maxValue: 100,
allowDecimals: false,
minValue: -1920,
maxValue: 1920,
value: {$CI['ts_y']}
},{
xtype: 'checkbox',
@ -844,20 +844,22 @@ EFUFU;
displayField: 'szText',
value: {$CI['ts_font_face']}
},{
xtype: 'slider',
xtype: 'numberfield',
fieldLabel: '{$Labels->GetLabel('_EVE_TS_FSCALE_')}',
id: 'TS_FSCALE',
width: 120,
minValue: 0.0,
decimalPrecision: 1,
minValue: 0.1,
maxValue: 4.0,
value: {$CI['ts_font_scale']}
},{
xtype: 'slider',
xtype: 'numberfield',
fieldLabel: '{$Labels->GetLabel('_EVE_TS_FTHICK_')}',
id: 'TS_FTHICK',
width: 120,
allowDecimals: false,
minValue: 1,
maxValue: 8.0,
maxValue: 8,
value: {$CI['ts_font_thickness']}
},{
xtype: 'combo',
@ -872,36 +874,42 @@ EFUFU;
xtype: 'arraystore',
fields: [ 'szId', 'szText' ],
data: [
[0, 'THIN'],
[1, 'ANTIALIAZED'],
[2, 'THICK']
[8, 'NORMAL'],
[4, 'THIN'],
[16, 'ANTIALIASED']
]
},
valueField: 'szId',
displayField: 'szText',
value: {$CI['ts_line_type']}
value: {$TS_LT}
},{
xtype: 'panel',
border: false,
bodyStyle: 'padding: 10px',
html: '<p>{$Labels->GetLabel('_EVE_POS_HINT_')}</p><p>{$Labels->GetLabel('_EVE_TS_HINT_')}</p>'
}]
},{
xtype: 'form',
title: 'Label',
labelWidth: 180,
labelAlign: 'right',
disabled: true,
items:[{
xtype: 'slider',
xtype: 'numberfield',
fieldLabel: '{$Labels->GetLabel('_EVE_LBL_POSX_')}',
id: 'LBL_POSX',
width: 120,
minValue: 0,
maxValue: 100,
allowDecimals: false,
minValue: -1920,
maxValue: 1920,
value: {$CI['label_x']}
},{
xtype: 'slider',
xtype: 'numberfield',
fieldLabel: '{$Labels->GetLabel('_EVE_LBL_POSY_')}',
id: 'LBL_POSY',
width: 120,
minValue: 0,
maxValue: 100,
allowDecimals: false,
minValue: -1920,
maxValue: 1920,
value: {$CI['label_y']}
},{
xtype: 'checkbox',
@ -935,20 +943,22 @@ EFUFU;
displayField: 'szText',
value: {$CI['label_font_face']}
},{
xtype: 'slider',
xtype: 'numberfield',
fieldLabel: '{$Labels->GetLabel('_EVE_LBL_FSCALE_')}',
id: 'LBL_FSCALE',
width: 120,
minValue: 0.0,
decimalPrecision: 1,
minValue: 0.1,
maxValue: 4.0,
value: {$CI['label_font_scale']}
},{
xtype: 'slider',
xtype: 'numberfield',
fieldLabel: '{$Labels->GetLabel('_EVE_LBL_FTHICK_')}',
id: 'LBL_FTHICK',
width: 120,
allowDecimals: false,
minValue: 1,
maxValue: 8.0,
maxValue: 8,
value: {$CI['label_font_thickness']}
},{
fieldLabel: '{$Labels->GetLabel('_EVE_LBL_LINE_T_')}',
@ -963,36 +973,42 @@ EFUFU;
xtype: 'arraystore',
fields: [ 'szId', 'szText' ],
data: [
[0, 'THIN'],
[1, 'ANTIALIAZED'],
[2, 'THICK']
[8, 'NORMAL'],
[4, 'THIN'],
[16, 'ANTIALIASED']
]
},
valueField: 'szId',
displayField: 'szText',
value: {$CI['label_line_type']}
value: {$LBL_LT}
},{
xtype: 'panel',
border: false,
bodyStyle: 'padding: 10px',
html: '<p>{$Labels->GetLabel('_EVE_POS_HINT_')}</p>'
}]
},{
xtype: 'form',
title: 'Logo',
labelWidth: 180,
labelAlign: 'right',
disabled: true,
items:[{
xtype: 'slider',
xtype: 'numberfield',
fieldLabel: '{$Labels->GetLabel('_EVE_LOGO_POSX_')}',
id: 'LOGO_POSX',
width: 120,
minValue: 0,
maxValue: 100,
allowDecimals: false,
minValue: -1920,
maxValue: 1920,
value: {$CI['logo_x']}
},{
xtype: 'slider',
xtype: 'numberfield',
fieldLabel: '{$Labels->GetLabel('_EVE_LOGO_POSY_')}',
id: 'LOGO_POSY',
width: 120,
minValue: 0,
maxValue: 100,
allowDecimals: false,
minValue: -1920,
maxValue: 1920,
value: {$CI['logo_y']}
},{
xtype: 'numberfield',
@ -1013,7 +1029,7 @@ EFUFU;
},{
xtype: 'panel',
id: 'eve_logo_ph',
html: '<center><img width="100px" id="eve_logo_img" src="/lib/controller/data/assets/images/7shields.png"></center>'
html: '<center><img width="100px" id="eve_logo_img" src="{$LOGO_URL}"></center>'
},{
xtype: 'panel',
html: '<input id="eve_logo_upload" style="width: 120px;" type="file" onchange="uploadEveLogo();"/>'

90
lib/controller/updateServerModuleSettings.php

@ -0,0 +1,90 @@
<?php
// Saves the settings window of a module (getModuleSettings.php -> saveSettings()).
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$Data = array();
$Data['success'] = false;
$Data['msg'] = 'Module Not Selected!';
$MID = isset( $_POST['MID'] ) ? intval( $_POST['MID'] ) : 0;
if( $MID > 0 ){
$Data['msg'] = 'Module Does Not Exists!';
$RR = $DATABASE->Query( "SELECT * FROM `modules` WHERE `id`={$MID}", false );
if( count( $RR ) ){
$CMD = $RR[0];
$AUX = intval( $CMD['aux_id'] );
// clamp a numeric POST field to [min,max], $def when it is missing
$pInt = function( $Name, $Min, $Max, $Def ){
if( !isset( $_POST[$Name] ) || $_POST[$Name] === '' ) return $Def;
return max( $Min, min( $Max, intval( $_POST[$Name] ) ) );
};
$pFloat = function( $Name, $Min, $Max, $Def ){
if( !isset( $_POST[$Name] ) || $_POST[$Name] === '' ) return $Def;
return max( $Min, min( $Max, floatval( $_POST[$Name] ) ) );
};
$pBool = function( $Name ){
if( !isset( $_POST[$Name] ) ) return 0;
$V = strtolower( strval( $_POST[$Name] ) );
return ( $V === 'true' || $V === '1' || $V === 'on' ) ? 1 : 0;
};
// OpenCV line types la_mojo accepts (0 and 1 are old values: 8 / 4 connected)
$pLine = function( $Name ){
$V = isset( $_POST[$Name] ) ? intval( $_POST[$Name] ) : 8;
return in_array( $V, array( 0, 1, 4, 8, 16 ) ) ? $V : 8;
};
switch( intval( $CMD['type'] ) ){
case 8:{ // Embed Video Encoder (module_eve)
$SiW = array( 320, 640, 800, 1280, 1024, 1920 );
$SiH = array( 240, 480, 600, 720, 768, 1080 );
$SIZE = $pInt( 'SIZE', 0, count( $SiW ) - 1, 3 );
$W = $SiW[$SIZE];
$H = $SiH[$SIZE];
$F = array(
'web_port' => $pInt( 'PORT', 1, 65535, 8972 ),
'width' => $W,
'height' => $H,
'compression_quality' => $pInt( 'COMPRESSION', 0, 100, 70 ),
'show_ts' => $pBool( 'SHOW1' ),
'show_label' => $pBool( 'SHOW2' ),
'show_logo' => $pBool( 'SHOW3' ),
// positions in pixels, negative values are measured from the right / bottom edge
'ts_x' => $pInt( 'TS_POSX', -$W, $W, 5 ),
'ts_y' => $pInt( 'TS_POSY', -$H, $H, 5 ),
'ts_transperant' => $pBool( 'TS_TRANS' ),
'ts_font_face' => $pInt( 'TS_FONT', 0, 7, 1 ),
'ts_font_scale' => $pFloat( 'TS_FONT_SCALE', 0.1, 4.0, 1.0 ),
'ts_font_thickness' => $pInt( 'TS_FONT_THICK', 1, 8, 1 ),
'ts_line_type' => $pLine( 'TS_LINE' ),
'label_x' => $pInt( 'LBL_POSX', -$W, $W, 5 ),
'label_y' => $pInt( 'LBL_POSY', -$H, $H, -10 ),
'label_transperant' => $pBool( 'LBL_TRANS' ),
'label_font_face' => $pInt( 'LBL_FONT', 0, 7, 1 ),
'label_font_scale' => $pFloat( 'LBL_FONT_SCALE', 0.1, 4.0, 1.0 ),
'label_font_thickness' => $pInt( 'LBL_FONT_THICK', 1, 8, 1 ),
'label_line_type' => $pLine( 'LBL_LINE' ),
'logo_x' => $pInt( 'LOG_POSX', -$W, $W, 0 ),
'logo_y' => $pInt( 'LOG_POSY', -$H, $H, 0 ),
'logo_w' => $pInt( 'LOG_W', 0, $W, 0 ),
'logo_h' => $pInt( 'LOG_H', 0, $H, 0 )
);
$SET = array();
foreach( $F as $K => $V ) $SET[] = "`{$K}`=".( is_float( $V ) ? sprintf( '%.3F', $V ) : intval( $V ) );
// exec() reports a failure instead of die() in Query()
if( $DATABASE->DBLink->exec( "UPDATE `module_eve` SET ".implode( ', ', $SET )." WHERE `id`={$AUX}" ) ){
$Data['success'] = true;
$Data['msg'] = '';
} else {
$Data['msg'] = 'Unable to save the settings!';
};
break;
};
default:
$Data['msg'] = 'Saving the settings of this module type is not supported!';
break;
};
};
};
echo json_encode( $Data );
exit();
};
header( 'location: /');
?>

62
lib/controller/uploadAsset.php

@ -0,0 +1,62 @@
<?php
// Asset upload. type=eve_logo, id=<module id>: logo of the Embed Video Encoder.
// The picture is stored as an RGBA PNG in data/assets/images/<md5>.png (the path la_mojo
// loads, relative to its working folder) and module_eve.logo_md5 is updated.
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$Data = array();
$Data['success'] = false;
$Data['msg'] = 'Wrong Parameters';
$TYPE = isset( $_POST['type'] ) ? strval( $_POST['type'] ) : '';
$MID = isset( $_POST['id'] ) ? intval( $_POST['id'] ) : 0;
if( $TYPE == 'eve_logo' && $MID > 0 ){
$RR = $DATABASE->Query( "SELECT * FROM `modules` WHERE `id`={$MID} AND `type`=8", false );
if( !count( $RR ) ){
$Data['msg'] = 'Module Does Not Exists!';
} else if( !isset( $_FILES['file'] ) || $_FILES['file']['error'] != UPLOAD_ERR_OK || !is_uploaded_file( $_FILES['file']['tmp_name'] ) ){
$Data['msg'] = 'File upload failed!';
} else if( $_FILES['file']['size'] > 4 * 1024 * 1024 ){
$Data['msg'] = 'The picture is too big (max 4 MB)!';
} else if( !function_exists( 'imagecreatefromstring' ) ){
$Data['msg'] = 'PHP GD extension is missing!';
} else {
$IMG = @imagecreatefromstring( file_get_contents( $_FILES['file']['tmp_name'] ) );
if( $IMG === false ){
$Data['msg'] = 'Unsupported picture format!';
} else {
// normalise to a true colour picture with alpha channel (la_mojo uses alpha as mask)
$W = imagesx( $IMG );
$H = imagesy( $IMG );
$OUT = imagecreatetruecolor( $W, $H );
imagealphablending( $OUT, false );
imagesavealpha( $OUT, true );
imagefill( $OUT, 0, 0, imagecolorallocatealpha( $OUT, 0, 0, 0, 127 ) );
imagecopy( $OUT, $IMG, 0, 0, 0, 0, $W, $H );
imagedestroy( $IMG );
ob_start();
imagepng( $OUT );
$PNG = ob_get_clean();
imagedestroy( $OUT );
$MD5 = md5( $PNG );
$DIR = __DIR__.'/data/assets/images';
if( !is_dir( $DIR ) ) @mkdir( $DIR, 0775, true );
if( @file_put_contents( $DIR.'/'.$MD5.'.png', $PNG ) === false ){
$Data['msg'] = 'Unable to store the picture!';
} else {
$AUX = intval( $RR[0]['aux_id'] );
$DATABASE->DBLink->exec( "UPDATE `module_eve` SET `logo_md5`='{$MD5}' WHERE `id`={$AUX}" );
$Data['success'] = true;
$Data['msg'] = '';
$Data['md5'] = $MD5;
$Data['url'] = '/lib/controller/data/assets/images/'.$MD5.'.png';
$Data['width'] = $W;
$Data['height'] = $H;
};
};
};
};
echo json_encode( $Data );
exit();
};
header( 'location: /');
?>

86
lib/javascript/jsapi_dynamic/rgoose_modules.js

@ -71,7 +71,7 @@ function updateFramePreview(){
ctx.closePath();
if( Ext.getCmp('eve_show_logo').getValue() ){
var image = document.getElementById('eve_logo_img');
if( image.complete && image.naturalHeight !== 0 ){
if( image != null && image.complete && image.naturalHeight !== 0 ){
var i_w = Ext.getCmp('LOGO_WIDTH').getValue();
var i_h = Ext.getCmp('LOGO_HEIGHT').getValue();
ctx.drawImage( image, 120, 120, i_w, i_h );
@ -92,44 +92,41 @@ async function uploadFile() {
}
function uploadEveLogo(){
if( embedVideoEncoderId > -1 ){
var llMask = new Ext.LoadMask( Ext.getCmp('eve_logo_ph').getEl(), {msg:"Please wait..."});
llMask.show();
var formData = new FormData();
var img_upload = document.getElementById('eve_logo_upload');
formData.append("file", img_upload.files[0]);
formData.append("type", 'eve_logo');
formData.append("id", embedVideoEncoderId );
$.ajax({
type: 'POST',
url: '/lib/controller/uploadAsset.php',
data: formData,
cache: false,
contentType: false,
processData: false,
success: function( data ){
llMask.hide();
console.log("success");
console.log( data );
},
error: function( data ){
llMask.hide();
console.log("error");
console.log(data);
}
});
/*
Ext.Ajax.request({
url: SITE_URL+'upload/',
headers: {'Content-type':'multipart/form-data'},
form: filefield.up('form').getForm(),
isUpload: true,
success: function(response, options) { console.log(arguments); },
failure: function(response, options) { console.log(arguments); }
});
*/
};
var img_upload = document.getElementById('eve_logo_upload');
if( embedVideoEncoderId < 1 || img_upload == null || img_upload.files.length == 0 ) return;
var llMask = new Ext.LoadMask( Ext.getCmp('eve_logo_ph').getEl(), {msg:"Please wait..."});
llMask.show();
var formData = new FormData();
formData.append("file", img_upload.files[0]);
formData.append("type", 'eve_logo');
formData.append("id", embedVideoEncoderId );
formData.append("UID", <?=$UserID;?> );
formData.append("SID", '<?=$Session;?>' );
fetch( '/lib/controller/uploadAsset.php', { method: 'POST', body: formData, credentials: 'same-origin' } )
.then( function( r ){ return r.json(); } )
.then( function( data ){
llMask.hide();
if( data.success ){
var image = document.getElementById('eve_logo_img');
if( image ){
image.onload = updateFramePreview;
image.src = data.url;
};
// first upload: propose the picture size, kept inside 256x256
var lw = Ext.getCmp('LOGO_WIDTH'), lh = Ext.getCmp('LOGO_HEIGHT');
if( lw && lh && ( !lw.getValue() || !lh.getValue() ) ){
var k = Math.min( 1, 256 / Math.max( data.width, data.height ) );
lw.setValue( Math.round( data.width * k ) );
lh.setValue( Math.round( data.height * k ) );
};
} else {
Ext.Msg.show({ title: "<?=$Labels->GetLabel('_ERROR_MSG_');?>", msg: data.msg, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR });
};
})
.catch( function( e ){
llMask.hide();
Ext.Msg.show({ title: "<?=$Labels->GetLabel('_ERROR_MSG_');?>", msg: String( e ), buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR });
});
};
var moduleSettingsEditorWindow = null;
@ -147,6 +144,14 @@ function showModuleSettingsEditor( ModuleID ){
resizable: false,
items:[],
buttons: [{
id: 'mo_se_ed_save',
text: "<?=$Labels->GetLabel('_SAVE_');?>",
hidden: true,
handler: function(){
var c = Ext.getCmp('mod_set_content');
if( c && typeof c.saveSettings == 'function' ) c.saveSettings();
}
},{
text: "<?=$Labels->GetLabel('_CLOSE_');?>",
handler: function(){
moduleSettingsEditorWindow.hide();
@ -154,6 +159,8 @@ function showModuleSettingsEditor( ModuleID ){
}]
});
};
embedVideoEncoderId = ModuleID;
Ext.getCmp('mo_se_ed_save').hide();
moduleSettingsEditorWindow.show();
Ext.Ajax.request({
url: '/lib/controller/getModuleSettings.php',
@ -170,6 +177,7 @@ function showModuleSettingsEditor( ModuleID ){
moduleSettingsEditorWindow.removeAll( true );
moduleSettingsEditorWindow.add( data );
moduleSettingsEditorWindow.doLayout();
Ext.getCmp('mo_se_ed_save').setVisible( typeof data.saveSettings == 'function' );
} else {
moduleSettingsEditorWindow.close();
moduleSettingsEditorWindow = null;

Loading…
Cancel
Save