diff --git a/lib/ajax_asm.php b/lib/ajax_asm.php index 266d1e9..bf2569f 100644 --- a/lib/ajax_asm.php +++ b/lib/ajax_asm.php @@ -32,8 +32,8 @@ if( isset($_GET['Lang'])){ $UCL=$_GET['Lang']/1; if ($UCL) $_SESSION['userlang']=$UCL; else $_SESSION['userlang']=$UserLang; } -if( isset($_SESSION['userlang']) )$Labels=new Language($_SESSION['userlang'], '_php'); -else $Labels=new Language( $UserLang, '_php'); +if( isset($_SESSION['userlang']) )$Labels=new Language($_SESSION['userlang']);//, '_php'); +else $Labels=new Language( $UserLang );//, '_php'); if( $UserLang == 3 || $UserLang == 255 ){ $RTL_SITE = true; diff --git a/lib/assembler.php b/lib/assembler.php index 9e4f9bf..63e54e1 100644 --- a/lib/assembler.php +++ b/lib/assembler.php @@ -44,8 +44,8 @@ if( isset($_GET['Lang'])){ $UCL=$_GET['Lang']/1; if ($UCL) $_SESSION['userlang']=$UCL; else $_SESSION['userlang']=$UserLang; } -if( isset($_SESSION['userlang']) )$Labels=new Language($_SESSION['userlang'], '_php'); -else $Labels=new Language( $UserLang, '_php'); +if( isset($_SESSION['userlang']) )$Labels=new Language( $_SESSION['userlang'] ); // '_php'); +else $Labels=new Language( $UserLang );// '_php'); if( $UserLang == 3 || $UserLang == 255 ){ $RTL_SITE = true; diff --git a/lib/controller/addServerModule.php b/lib/controller/addServerModule.php new file mode 100644 index 0000000..ff7cac5 --- /dev/null +++ b/lib/controller/addServerModule.php @@ -0,0 +1,59 @@ +Data['id'] ); + $ACCESS = intval($CUser->Data['access'] ); + if( $UID > 1 && $ACCESS > 4 ){ + $Data['status'] = 'nok'; + $Z = intval( $_POST['SERVID'] ); + $T = intval( $_POST['TYPE'] ); + if( $Z && $T ){ + $QS = "SELECT * FROM `server_module_types` WHERE `id`={$T}"; + $ZZ = $DATABASE->Query( $QS ); + if( count( $ZZ ) ){ + $CTI = $ZZ[0]; + $ADE = true; + if( $CTI['allow_multiply'] == 0 ){ + $QS = "SELECT * FROM `server_modules` WHERE `server_id`={$Z} AND `type`={$T}"; + $SS = $DATABASE->Query( $QS ); + if( count( $SS ) ){ + $ADE = false; + $Data['msg'] = 'This type of Module can be added only Once!'; + }; + }; + if( $ADE ){ + $QS = "INSERT INTO `server_modules` SET `server_id`={$Z}, `type`={$T}, `enabled`=0"; + $DATABASE->Query( $QS ); + $MID = $DATABASE->getLastInsertID(); + $MCID = 0; + switch( $T ){ + case 3:{ + //Kafka + $QS = "INSERT INTO `modules_kafka` SET `brocker_port`=2929"; + $DATABASE->Query( $QS ); + $MCID = $DATABASE->getLastInsertID(); + + break; + }; + case 9:{ + //EmbedVido + $QS = "INSERT INTO `module_embed_video_settings` SET `web_port`=8972"; + $DATABASE->Query( $QS ); + $MCID = $DATABASE->getLastInsertID(); + break; + }; + }; + $QS = "UPDATE `server_modules` SET `aux_id`={$MCID} WHERE `id`={$MID}"; + $DATABASE->Query( $QS ); + $Data['status'] = 'ok'; + }; + } else { + $Data['msg'] = 'Wrong Module Type is supplied!'; + }; + } else { + $Data['msg'] = 'No Server ID or Module Type is supplied!'; + }; + echo json_encode( $Data ); + exit(); + }; + header('location: /'); +?> \ No newline at end of file diff --git a/lib/controller/doModuleOperation.php b/lib/controller/doModuleOperation.php new file mode 100644 index 0000000..dbb082e --- /dev/null +++ b/lib/controller/doModuleOperation.php @@ -0,0 +1,72 @@ +Data['id'] > 1 ){ + $Data = array(); + $Data['success'] = false; + if( isset( $_POST['MID'] ) ) { + $MID = intval($_POST['MID']); + } else $MID = 0; + if( isset( $_POST['OPID'] ) ){ + $CMD = intval( $_POST['OPID'] ); + } else { + $CMD = 0; + }; + if( isset( $_POST['OPCODE'] ) ){ + $OPCODE = intval( $_POST['OPCODE'] ); + } else { + $OPCODE = 0; + }; + if( $MID > 0 && $CMD > 0 ){ + $Data['success'] = true; + switch( $CMD ){ + case 1: { + $QS = "SELECT * FROM `server_modules` WHERE `id`={$MID}"; + $TT = $DATABASE->Query( $QS ); + if( count( $TT ) ){ + $JJ = $TT[0]; + 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 9:{// Embed VIO + $QS = "DELETE FROM `module_embed_video_settings` WHERE `id`={$JJ['aux_id']}"; + $DATABASE->Query( $QS ); + break; + }; + case 10:{// Modem Manager + $QS = "DELETE FROM `module_mm_settings` WHERE `id`={$JJ['aux_id']}"; + $DATABASE->Query( $QS ); + $QS = "DELETE FROM `module_mm_modems` WHERE `mmm_id`={$JJ['aux_id']}"; + $DATABASE->Query( $QS ); + break; + }; + }; + + $QS = "DELETE FROM `server_modules` WHERE `id`={$MID}"; + $DATABASE->Query( $QS ); + }; + break; + }; + case 2: $QS = "UPDATE `server_modules` SET `enabled`={$OPCODE} WHERE `id`={$MID}"; break; + }; + $DATABASE->Query( $QS, false ); + $Data['query'] = $QS; + } else { + $Data['msg']='Wrong Parameters'; + }; + echo json_encode( $Data ); + exit(); + }; + header('location: /'); +?> \ No newline at end of file diff --git a/lib/controller/getModuleEditor.php b/lib/controller/getModuleEditor.php index 5b99fa2..9bfdc31 100644 --- a/lib/controller/getModuleEditor.php +++ b/lib/controller/getModuleEditor.php @@ -9,13 +9,6 @@ $CR = $Result[0]; switch( $CR['type'] ){ case 1: //ZLMedia - $QS = "SELECT * FROM uart_settings WHERE id={$CR['aux_id']}"; - $Result = $DATABASE->Query( $QS ); - $Z = $Result[0]; - $R_name = $Labels->GetLabel('_RES_HW_UART_DESC_'); - $R_dev = $CR['device']; - $R_nfo = 'Speed: ' . $Z['speed'] . ', Bits: ' . $Z['bit'] . ', Parity: ' . $Z['parity'] . ', Stop Bit: '. $Z['stop_bit']; - $R_image = 'unnamed.png'; $TPL =<<Data['id'] > 1 ){ + $EID = intval( $_POST['MID'] ); + switch( $EID ){ + case 1: //ZLMedia + $TPL ='
%%%NAME%%%
%%%INFO%%%
'; + $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_ZL_MEDIA_DESC_SHO_') , $TPL ); + $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_ZL_MEDIA_DESC_LOO_'), $TPL ); + echo $TPL; + break; + case 2: //DCB USB + echo "TBD"; + break; + case 3: //Kafka + $TPL ='
%%%NAME%%%
%%%INFO%%%
'; + $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_KAFKA_DESC_SHO_') , $TPL ); + $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_KAFKA_DESC_LOO_'), $TPL ); + echo $TPL; + break; + case 4: + case 5: + case 6: + echo "TBD"; + break; + case 7: // SSDP + $TPL ='
%%%NAME%%%
%%%INFO%%%
'; + $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_SSDP_DESC_SHO_') , $TPL ); + $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_SSDP_DESC_LOO_'), $TPL ); + echo $TPL; + break; + case 8: // Onvif + $TPL ='
%%%NAME%%%
%%%INFO%%%
'; + $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_ONVIF_DESC_SHO_') , $TPL ); + $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_ONVIF_DESC_LOO_'), $TPL ); + echo $TPL; + break; + case 9://Embed Video Encoder + $TPL ='
%%%NAME%%%
%%%INFO%%%
'; + $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_EVE_DESC_SHO_') , $TPL ); + $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_EVE_DESC_LOO_'), $TPL ); + echo $TPL; + break; + case 10: //Modem + $TPL ='
%%%NAME%%%
%%%INFO%%%
'; + $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_KAFKA_DESC_SHO_') , $TPL ); + $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_KAFKA_DESC_LOO_'), $TPL ); + echo $TPL; + break; + }; + } else { + header('location: /'); + }; +?> \ No newline at end of file diff --git a/lib/controller/getModuleSettings.php b/lib/controller/getModuleSettings.php new file mode 100644 index 0000000..5846563 --- /dev/null +++ b/lib/controller/getModuleSettings.php @@ -0,0 +1,787 @@ +Data['id'] > 1 ){ + $EID = intval( $_POST['MID'] ); + $QS = "SELECT * FROM server_modules WHERE id = {$EID}"; + $Result = $DATABASE->Query( $QS, false ); + if( count( $Result ) ){ + $CR = $Result[0]; + switch( $CR['type'] ){ + case 1: //ZLMedia + $TPL =<<%%%NAME%%%%%%INFO%%%' + },{ + xtype: 'spacer', + height: 5 + },{ + border: false, + frame: false, + xtype: 'panel', + html: '
%%%LOINFO%%%
' + },{ + xtype: 'spacer', + height: 5 + },{ + xtype: 'combo', + fieldLabel: 'Module Status', + id: 'mod_ena', + lazyRender:true, + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + store: new Ext.data.ArrayStore({ + fields: ['status_val','status_txt'], + data: [[0,'Disabled'],[1,'Enabled']] + }), + value: %%%ENA_VAL%%%, + valueField: 'status_val', + displayField: 'status_txt', + listeners:{ + select: function( t, r, i ){ + if( r.data.status_val ) enableModule({$EID}); else disableModule({$EID}); + } + } + },{ + xtype: 'spacer', + height: 5 + },{ + xtype: 'button', + id: 'mo_edit_btn', + disabled: false, + width: '100%', + text: 'Edit Module Config', + handler: function(){ + } + },{ + xtype: 'spacer', + height: 5 + },{ + xtype: 'button', + id: 'mo_del_btn', + disabled: false, + width: '100%', + text: 'Remove Module', + handler: function(){ + removeModule({$EID}); + } + }] + +} +EFUFU; + $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_ZL_MEDIA_DESC_SHO_') , $TPL ); + $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_ZL_MEDIA_DESC_LOO_'), $TPL ); + $TPL = str_ireplace( '%%%LOINFO%%%','' , $TPL ); + $TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL ); + echo $TPL; + break; + case 2: //DCB USB + break; + case 3: //Kafka + $QS="SELECT * FROM `modules_kafka` WHERE `module_id`={$CR['aux_id']}"; + $II = $DATABASE->Query( $QS ); + $CI = $II[0]; + $R_nfo = 'Broker Node:'. $CI['brocker_address'].':'.$CI['brocker_port'].((intval($CI['use_ssl'])>0)?'':''); + $USSL = (intval($CI['use_ssl'])>0)?'true':'false'; +$TPL =<<GetLabel('_KAFKA_BROKER_')}', + labelWidth: 200, + labelAlign: 'right', + border: false, + frame: false, + items:[{ + xtype: 'spacer', + height: 10 + },{ + xtype: 'textfield', + fieldLabel: 'Broker Address', + value: '{$CI['brocker_address']}' + },{ + xtype: 'numberfield', + fieldLabel: 'Broker Port', + value: {$CI['brocker_port']} + },{ + xtype: 'checkbox', + fieldLabel: 'Use SSL', + checked: {$USSL} + },{ + xtype: 'panel', + html: 'CA certificate file for verifying the broker\'s certificate [cert]' + },{ + xtype: 'panel', + html: 'Client\'s certificate [pem]' + },{ + xtype: 'panel', + html: 'Client\'s key [key]' + },{ + xtype: 'panel', + html: 'Key password, if any' + }] + },{ + title: '{$Labels->GetLabel('_KAFKA_TOP_EVTS_')}', + html: '' + }], + status: 'ok', + wTitle: '{$Labels->GetLabel('_KAFKA_DESC_SHO_')}' + +} +EFUFU; + + echo $TPL; + break; + case 7: // SSDP + $TPL =<<%%%NAME%%%%%%INFO%%%' + },{ + xtype: 'spacer', + height: 5 + },{ + border: false, + frame: false, + xtype: 'panel', + html: '
%%%LOINFO%%%
' + },{ + xtype: 'spacer', + height: 5 + },{ + xtype: 'combo', + fieldLabel: 'Module Status', + id: 'mod_ena', + lazyRender:true, + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + store: new Ext.data.ArrayStore({ + fields: ['status_val','status_txt'], + data: [[0,'Disabled'],[1,'Enabled']] + }), + value: %%%ENA_VAL%%%, + valueField: 'status_val', + displayField: 'status_txt', + listeners:{ + select: function( t, r, i ){ + if( r.data.status_val ) enableModule({$EID}); else disableModule({$EID}); + } + } + },{ + xtype: 'spacer', + height: 5 + },{ + xtype: 'button', + id: 'mo_del_btn', + disabled: false, + width: '100%', + text: 'Remove Module', + handler: function(){ + removeModule({$EID}); + } + }] + +} +EFUFU; + $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_SSDP_DESC_SHO_') , $TPL ); + $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_SSDP_DESC_LOO_'), $TPL ); + $TPL = str_ireplace( '%%%LOINFO%%%',$Labels->GetLabel('_MOD_NO_NEDCONF_'), $TPL ); + $TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL ); + echo $TPL; + break; + case 8: // Onvif + $TPL =<<%%%NAME%%%%%%INFO%%%' + },{ + xtype: 'spacer', + height: 5 + },{ + border: false, + frame: false, + xtype: 'panel', + html: '
%%%LOINFO%%%
' + },{ + xtype: 'spacer', + height: 5 + },{ + xtype: 'combo', + fieldLabel: 'Module Status', + id: 'mod_ena', + lazyRender:true, + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + store: { + xtype: 'arraystore', + fields: ['status_val','status_txt'], + data: [[0,'Disabled'],[1,'Enabled']] + }, + value: %%%ENA_VAL%%%, + valueField: 'status_val', + displayField: 'status_txt', + listeners:{ + select: function( t, r, i ){ + if( r.data.status_val ) enableModule({$EID}); else disableModule({$EID}); + } + } + },{ + xtype: 'spacer', + height: 5 + },{ + xtype: 'button', + id: 'mo_del_btn', + disabled: false, + width: '100%', + text: 'Remove Module', + handler: function(){ + removeModule({$EID}); + } + }] +} +EFUFU; + $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_ONVIF_DESC_SHO_') , $TPL ); + $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_ONVIF_DESC_LOO_'), $TPL ); + $TPL = str_ireplace( '%%%LOINFO%%%',$Labels->GetLabel('_MOD_NO_NEDCONF_'), $TPL ); + $TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL ); + echo $TPL; + break; + case 9://Embed Video Encoder + $QS="SELECT * FROM `module_embed_video_settings` WHERE `id`={$CR['aux_id']}"; + $II = $DATABASE->Query( $QS ); + $CI = $II[0]; + $TS = array( '320x240', '640x480', '800x600', '1280x720', '1024x768', '1920x1080' ); + $YY = $CI['width'].'x'.$CI['height']; + for( $i=0; $iGetLabel("_ERROR_MSG_")}', + msg: data['msg'], + buttons: Ext.Msg.OK, + fn: function(){ + SettingsLidar3D.hide(); + }, + icon: Ext.MessageBox.ERROR + }); + }; + }, + failure: failureAJAXFunction + }); + }, + items:[{ + xtype: 'panel', + title: 'Output Settings', + items:[{ + xtype: 'panel', + id: 'eve_frm_prev', + html: '', + height: 400, + width: 760, + border: false + },{ + xtype: 'form', + labelWidth: 180, + labelAlign: 'right', + border: false, + items: [{ + xtype: 'combo', + fieldLabel: '{$Labels->GetLabel('_OUTPUT_FRAME_SIZE_')}', + id: 'FRM_SIZE', + //width: 120, + typeAhead: true, + triggerAction: 'all', + lazyRender:true, + mode: 'local', + store: { + xtype: 'arraystore', + fields: [ 'szId', 'szText' ], + data: [ + [0, '320x240'], + [1, '640x480'], + [2, '800x600'], + [3, '1280x720'], + [4, '1024x768'], + [5, '1920x1080'] + ] + }, + valueField: 'szId', + displayField: 'szText', + value: {$CSID}, + listeners:{ + select: updateFramePreview, + change: updateFramePreview + } + },{ + xtype: 'numberfield', + fieldLabel: '{$Labels->GetLabel('_EVE_PORT_')}', + id: 'WA_PORT', + width: 120, + minValue: 1000, + maxValue: 65535, + value: {$CI['web_port']} + },{ + xtype: 'slider', + fieldLabel: '{$Labels->GetLabel('_EVE_COMPRESS_QUA_')}', + id: 'COMP_QUAL', + width: 120, + minValue: 0, + maxValue: 100, + value: {$CI['compression_quality']} + },{ + 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 + }] + }] + },{ + xtype: 'form', + title: 'Time Stamp', + labelWidth: 180, + labelAlign: 'right', + disabled: true, + items:[{ + xtype: 'slider', + fieldLabel: '{$Labels->GetLabel('_EVE_TS_POSX_')}', + id: 'TS_POSX', + width: 120, + minValue: 0, + maxValue: 100, + value: {$CI['ts_x']} + },{ + xtype: 'slider', + fieldLabel: '{$Labels->GetLabel('_EVE_TS_POSY_')}', + id: 'TS_POSY', + width: 120, + minValue: 0, + maxValue: 100, + value: {$CI['ts_y']} + },{ + xtype: 'checkbox', + fieldLabel: '{$Labels->GetLabel('_EVE_TRANSO_TS_')}', + id: 'eve_transp_ts', + checked: {$CI['ts_transperant']} + },{ + xtype: 'combo', + fieldLabel: '{$Labels->GetLabel('_EVE_FONT_TS_')}', + id: 'TS_FONT', + width: 120, + typeAhead: true, + triggerAction: 'all', + lazyRender:true, + mode: 'local', + store: { + xtype: 'arraystore', + fields: [ 'szId', 'szText' ], + data: [ + [0, 'SIMPLEX'], + [1, 'PLAIN'], + [2, 'DUPLEX'], + [3, 'COMPLEX'], + [4, 'TRIPLEX'], + [5, 'COMPLEX_SMALL'], + [6, 'SCRIPT_SIMPLEX'], + [7, 'SCRIPT_COMPLEX'] + ] + }, + valueField: 'szId', + displayField: 'szText', + value: {$CI['ts_font_face']} + },{ + xtype: 'slider', + fieldLabel: '{$Labels->GetLabel('_EVE_TS_FSCALE_')}', + id: 'TS_FSCALE', + width: 120, + minValue: 0.0, + maxValue: 4.0, + value: {$CI['ts_font_scale']} + },{ + xtype: 'slider', + fieldLabel: '{$Labels->GetLabel('_EVE_TS_FTHICK_')}', + id: 'TS_FTHICK', + width: 120, + minValue: 1, + maxValue: 8.0, + value: {$CI['ts_font_thickness']} + },{ + xtype: 'combo', + fieldLabel: '{$Labels->GetLabel('_EVE_TS_LINE_T_')}', + id: 'TS_LINET', + width: 120, + typeAhead: true, + triggerAction: 'all', + lazyRender:true, + mode: 'local', + store: { + xtype: 'arraystore', + fields: [ 'szId', 'szText' ], + data: [ + [0, 'THIN'], + [1, 'ANTIALIAZED'], + [2, 'THICK'] + ] + }, + valueField: 'szId', + displayField: 'szText', + value: {$CI['ts_line_type']} + }] + },{ + xtype: 'form', + title: 'Label', + labelWidth: 180, + labelAlign: 'right', + disabled: true, + items:[{ + xtype: 'slider', + fieldLabel: '{$Labels->GetLabel('_EVE_LBL_POSX_')}', + id: 'LBL_POSX', + width: 120, + minValue: 0, + maxValue: 100, + value: {$CI['label_x']} + },{ + xtype: 'slider', + fieldLabel: '{$Labels->GetLabel('_EVE_LBL_POSY_')}', + id: 'LBL_POSY', + width: 120, + minValue: 0, + maxValue: 100, + value: {$CI['label_y']} + },{ + xtype: 'checkbox', + fieldLabel: '{$Labels->GetLabel('_EVE_TRANSO_LBL_')}', + id: 'eve_transp_lbl', + checked: {$CI['label_transperant']} + },{ + xtype: 'combo', + fieldLabel: '{$Labels->GetLabel('_EVE_FONT_LBL_')}', + id: 'LBL_FONT', + width: 120, + typeAhead: true, + triggerAction: 'all', + lazyRender:true, + mode: 'local', + store:{ + xtype: 'arraystore', + fields: [ 'szId', 'szText' ], + data: [ + [0, 'SIMPLEX'], + [1, 'PLAIN'], + [2, 'DUPLEX'], + [3, 'COMPLEX'], + [4, 'TRIPLEX'], + [5, 'COMPLEX_SMALL'], + [6, 'SCRIPT_SIMPLEX'], + [7, 'SCRIPT_COMPLEX'] + ] + }, + valueField: 'szId', + displayField: 'szText', + value: {$CI['label_font_face']} + },{ + xtype: 'slider', + fieldLabel: '{$Labels->GetLabel('_EVE_LBL_FSCALE_')}', + id: 'LBL_FSCALE', + width: 120, + minValue: 0.0, + maxValue: 4.0, + value: {$CI['label_font_scale']} + },{ + xtype: 'slider', + fieldLabel: '{$Labels->GetLabel('_EVE_LBL_FTHICK_')}', + id: 'LBL_FTHICK', + width: 120, + minValue: 1, + maxValue: 8.0, + value: {$CI['label_font_thickness']} + },{ + fieldLabel: '{$Labels->GetLabel('_EVE_LBL_LINE_T_')}', + xtype: 'combo', + id: 'LBL_LINET', + width: 120, + typeAhead: true, + triggerAction: 'all', + lazyRender:true, + mode: 'local', + store: { + xtype: 'arraystore', + fields: [ 'szId', 'szText' ], + data: [ + [0, 'THIN'], + [1, 'ANTIALIAZED'], + [2, 'THICK'] + ] + }, + valueField: 'szId', + displayField: 'szText', + value: {$CI['label_line_type']} + }] + },{ + xtype: 'form', + title: 'Logo', + labelWidth: 180, + labelAlign: 'right', + disabled: true, + items:[{ + xtype: 'slider', + fieldLabel: '{$Labels->GetLabel('_EVE_LOGO_POSX_')}', + id: 'LOGO_POSX', + width: 120, + minValue: 0, + maxValue: 100, + value: {$CI['logo_x']} + },{ + xtype: 'slider', + fieldLabel: '{$Labels->GetLabel('_EVE_LOGO_POSY_')}', + id: 'LOGO_POSY', + width: 120, + minValue: 0, + maxValue: 100, + value: {$CI['logo_y']} + },{ + xtype: 'numberfield', + fieldLabel: '{$Labels->GetLabel('_EVE_LOGO_WIDTH_')}', + id: 'LOGO_WIDTH', + width: 120, + minValue: 0, + maxValue: 256, + value: {$CI['logo_w']} + },{ + xtype: 'numberfield', + fieldLabel: '{$Labels->GetLabel('_EVE_LOGO_HEIGHT_')}', + id: 'LOGO_HEIGHT', + width: 120, + minValue: 0, + maxValue: 256, + value: {$CI['logo_h']} + },{ + xtype: 'panel', + id: 'eve_logo_ph', + html: '
' + },{ + xtype: 'panel', + html: '' + }] + }], + listeners: { + afterlayout: updateFramePreview + }, + status: 'ok', + wTitle: '{$Labels->GetLabel('_EMBED_VIDEO_ENCODER_')}' +} +EFUFU; + $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_EVE_DESC_SHO_') , $TPL ); + $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_EVE_DESC_LOO_'), $TPL ); + $TPL = str_ireplace( '%%%LOINFO%%%','' , $TPL ); + $TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL ); + $Data['status'] = 'ok'; + $Data['title'] = $Labels->GetLabel('_EMBED_VIDEO_ENCODER_'); + $Data['content'] = json_decode( $TPL ); + echo $TPL; //json_encode($Data); + break; + case 10: //Modem + $QS="SELECT * FROM `modules_kafka` WHERE `module_id`={$CR['aux_id']}"; + $II = $DATABASE->Query( $QS ); + $CI = $II[0]; + $R_nfo = 'Broker Node:'. $CI['brocker_address'].':'.$CI['brocker_port'].((intval($CI['use_ssl'])>0)?'':''); +$TPL =<<%%%NAME%%%%%%INFO%%%' + },{ + xtype: 'spacer', + height: 5 + },{ + border: false, + frame: false, + xtype: 'panel', + html: '
%%%LOINFO%%%
' + },{ + xtype: 'spacer', + height: 5 + },{ + xtype: 'combo', + fieldLabel: 'Module Status', + id: 'mod_ena', + lazyRender:true, + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + store: { + xtype: 'arraystore', + fields: ['status_val','status_txt'], + data: [[0,'Disabled'],[1,'Enabled']] + }, + value: %%%ENA_VAL%%%, + valueField: 'status_val', + displayField: 'status_txt', + listeners:{ + select: function( t, r, i ){ + if( r.data.status_val ) enableModule({$EID}); else disableModule({$EID}); + } + } + },{ + xtype: 'spacer', + height: 5 + },{ + xtype: 'button', + id: 'mo_edit_btn', + disabled: false, + width: '100%', + text: 'Edit Module Config', + handler: function(){ + } + },{ + xtype: 'spacer', + height: 5 + },{ + xtype: 'button', + id: 'mo_del_btn', + disabled: false, + width: '100%', + text: 'Remove Module', + handler: function(){ + removeModule({$EID}); + } + }] + +} +EFUFU; + $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_KAFKA_DESC_SHO_') , $TPL ); + $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_KAFKA_DESC_LOO_'), $TPL ); + $TPL = str_ireplace( '%%%LOINFO%%%',$R_nfo , $TPL ); + $TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL ); + echo $TPL; + break; + }; + } else { + echo '{ xtype: \'panel\', html: \'Node '.$_POST['NODE'].' Loadded\'}'; + }; + } else { + header('location: /'); + }; +?> \ No newline at end of file diff --git a/lib/controller/getNodeSettings.php b/lib/controller/getNodeSettings.php index 93ae81f..f9aa8c7 100644 --- a/lib/controller/getNodeSettings.php +++ b/lib/controller/getNodeSettings.php @@ -2,6 +2,7 @@ require_once('../ajax_asm.php'); if( $CUser->Data['id'] > 1 ){ $Z = intval( $_POST['NID'] ); + $CT = intval( $_POST['TAB'] ); if( $Z ){ $QS = "SELECT * FROM `nodes` WHERE `id`={$Z}"; $NN = $DATABASE->Query( $QS ); @@ -28,7 +29,7 @@ frame: false, id: 'node_settings_content', border: false, - activeTab: 0, + activeTab: , items: [{ xtype: 'panel', title: 'General Info', @@ -163,7 +164,103 @@ height: 303, autoScroll: 'auto', tbar:[{ - text: 'Add Module' + text: 'Add Module', + handler: function(){ + var addModuleWindow = new Ext.Window({ + id: 'huha_boa', + title: 'Add Server Module', + modal: true, + width: 400, + height: 300, + items:[{ + xtype: 'form', + items: [{ + xtype: 'combo', + fieldLabel: "GetLabel( 'MOD_TYPE' );?>", + id: 'mod_type', + lazyRender: true, + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + store: new Ext.data.ArrayStore({ + fields: ['az_t','az_txt'], + data: [Query( $QS ); + $MIMO = array(); + foreach( $MM as $M ) $MIMO[]="[{$M['id']},'".$Labels->GetLabel($M['name'])."']"; + echo implode( ',', $MIMO ); + ?>] + }), + valueField: 'az_t', + displayField: 'az_txt', + value: 1, + listeners:{ + select: function( t, r, i ){ + var n = r.data.az_t; + Ext.Ajax.request({ + url: '/lib/controller/getModuleInfo.php', + params: { + MID: n, + UID: , + SID: '' + }, + success: function( response, opts ){ + Ext.getCmp('infopan').update( response.responseText ); + } + }); + } + } + },{ + xtype: 'panel', + id: 'infopan', + html: '
GetLabel('_ZL_MEDIA_DESC_SHO_');?>
GetLabel('_ZL_MEDIA_DESC_LOO_');?>
' + }] + }], + bbar:[{ + text: 'Cancel', + handler: function(){ + addModuleWindow.close(); + } + },{ + text: 'Add Module', + handler: function(){ + var mtyp = Ext.getCmp('mod_type').getValue(); + Ext.Ajax.request({ + url: '/lib/controller/addServerModule.php', + params: { + SERVID: , + TYPE: mtyp, + UID: , + SID: '' + }, + success: function( response, opts ){ + // If the response is JSON, you have to decode it + var data = Ext.decode(response.responseText); + if( data.status == 'ok' ){ + addModuleWindow.close(); + showSettings( SelectedNodeID, 2 ); + } else { + Ext.Msg.show({ + title:'GetLabel("_INFO_MSG_");?>', + msg: data.msg, + buttons: Ext.Msg.OK,//YESNOCANCEL, + fn: function(){ + //SettingsLidar3D.hide(); + }, + icon: Ext.MessageBox.INFO //QUESTION + }); + } + }, + failure: failureAJAXFunction + }); + } + }] + }); + addModuleWindow.show(); + } }], items:[Data['id'] > 1 ){ + $Data['success'] = false; + $Data['msg']= 'Module Not Selected!'; + if( isset( $_POST['MID'] ) ){ + $MID = intval($_POST['MID']); + if( $MID ){ + $Data['msg']='Module Does Not Exists!'; + $QS = "SELECT * FROM `server_modules` WHERE `id`={$MID}"; + $RR = $DATABASE->Query( $QS ); + if( count( $RR ) ){ + $CMD = $RR[0]; + $Data['success'] = true; + $Data['msg']=''; + switch( $CMD['type'] ){ + case 9:{ + // EVE + $SiW = array( 320, 640, 800, 1280, 1024, 1920 ); + $SiH = array( 240, 480, 600, 720, 768, 1080 ); + $SIZE = intval( $_POST['SIZE'] ); + $PORT = intval( $_POST['PORT'] ); + $COMP = intval( $_POST['COMPRESSION'] ); + $TS_X = intval( $_POST['TS_POSX'] ); + $TS_Y = intval( $_POST['TS_POSY'] ); + $TS_FF = intval( $_POST['TS_FONT'] ); + $TS_FS = intval( $_POST['TS_FONT_SCALE'] ); + $TS_FT = intval( $_POST['TS_FONT_THICK'] ); + $TS_LT = intval( $_POST['TS_LINE'] ); + $TS_TS = intval( $_POST['TS_TRANS'] ); + + $LB_X = intval( $_POST['LBL_POSX'] ); + $LB_Y = intval( $_POST['LBL_POSY'] ); + $LB_FF = intval( $_POST['LBL_FONT'] ); + $LB_FS = intval( $_POST['LBL_FONT_SCALE'] ); + $LB_FT = intval( $_POST['LBL_FONT_THICK'] ); + $LB_LT = intval( $_POST['LBL_LINE'] ); + $LB_TS = intval( $_POST['LBL_TRANS'] ); + + $LO_X = intval( $_POST['LOG_POSX'] ); + $LO_Y = intval( $_POST['LOG_POSY'] ); + $LO_W = intval( $_POST['LOG_W'] ); + $LO_H = intval( $_POST['LOG_H'] ); + + if( $_POST['SHOW1'] ) $STS = 1; else $STS = 0; + if( $_POST['SHOW2'] ) $SLB = 1; else $SLB = 0; + if( $_POST['SHOW3'] ) $SLG = 0; else $SLG = 0; + if( $_POST['TS_TRANS'] ) $TS_TS = 1; else $TS_TS = 0; + if( $_POST['LBL_TRANS'] ) $LB_TS = 1; else $LB_TS = 0; + $QS = "UPDATE `module_embed_video_settings` SET `web_port`={$PORT}, `width`={$SiW[$SIZE]}, `height`={$SiH[$SIZE]}, `compression_quality`={$COMP}, `show_ts`={$STS}, `show_label`={$SLB}, `show_logo`={$SLG}, `ts_x`={$TS_X}, `ts_y`={$TS_Y}, `ts_font_face`={$TS_FF}, `ts_font_thickness`={$TS_FT}, `ts_line_type`={$TS_LT}, `ts_transperant`={$TS_TS}, `label_x`={$LB_X}, `label_y`={$LB_Y}, `label_font_face`={$LB_FF}, `label_font_thickness`={$LB_FT}, `label_line_type`={$LB_LT}, `label_transperant`={$LB_TS}, `logo_x`={$LO_X}, `logo_y`={$LO_Y}, `logo_w`={$LO_W}, `logo_h`={$LO_H} WHERE `id`={$CMD['aux_id']}"; + $DATABASE->Query( $QS ); + break; + }; + }; + }; + }; + }; + echo json_encode( $Data ); + exit(); + }; + header( 'location: /'); +?> \ No newline at end of file diff --git a/lib/javascript/jsapi_dynamic/rgoose_main.js b/lib/javascript/jsapi_dynamic/rgoose_main.js index e27572c..f4b330a 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_main.js +++ b/lib/javascript/jsapi_dynamic/rgoose_main.js @@ -151,7 +151,19 @@ function doCheckWindowSize(){ var NotificationStack = null; +function tryKeepScreenAlive(minutes) { + navigator.wakeLock.request("screen").then(lock => { + setTimeout(() => lock.release(), minutes * 60 * 1000); + }); +} + Ext.onReady(function(){ + if ('wakeLock' in navigator) { + // Screen Wake Lock API supported + tryKeepScreenAlive(10); + }; + + doCheckWindowSize(); gSessionValidatorInterval = window.setInterval( sessionValidator, 1000 ); NotificationStack = new PNotify.Stack({dir1: 'down', firstpos1: 25}); diff --git a/lib/javascript/jsapi_dynamic/rgoose_modules.js b/lib/javascript/jsapi_dynamic/rgoose_modules.js index 3dca610..5f8ad58 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_modules.js +++ b/lib/javascript/jsapi_dynamic/rgoose_modules.js @@ -29,8 +29,8 @@ function addMediaServer(){ addMediaServerDialog.show(); }; -var embedVideoEncoderSettingsWindow = null; var embedVideoEncoderId = 0; + function updateFramePreview(){ var canvas = document.getElementById("eve_frame_preview"); if( canvas != null ){ @@ -44,7 +44,7 @@ function updateFramePreview(){ var f_w = 320; var f_h = 240; var f_p = 0; - var fsid = Ext.getCmp('FRM_SIZE').getValue(); + var fsid = Ext.getCmp('FRM_SIZE').getValue(); switch( fsid ){ case 1: f_w = 640; f_h = 480; f_p = 0; break; case 2: f_w = 800; f_h = 600; f_p = 0; break; @@ -80,6 +80,7 @@ function updateFramePreview(){ }; }; + async function uploadFile() { let formData = new FormData(); formData.append("file", fileupload.files[0]); @@ -131,6 +132,69 @@ function uploadEveLogo(){ }; }; +var moduleSettingsEditorWindow = null; + +function showModuleSettingsEditor( ModuleID ){ + if( moduleSettingsEditorWindow == null ){ + moduleSettingsEditorWindow = new Ext.Window({ + modal: true, + id: 'mo_se_ed_wi', + title: '', + width: 792, + height: 700, + layout: 'fit', + closeAction: 'hide', + resizable: false, + items:[], + buttons: [{ + text: 'GetLabel("_CANCEL_");?>', + handler: function(){ + moduleSettingsEditorWindow.hide(); + } + },{ + id: 'con_to_src', + text: 'GetLabel("_OK_");?>', + disabled: false, + handler: function(){ + Ext.getCmp('mod_set_content').saveSettings(); + } + }] + }); + }; + moduleSettingsEditorWindow.show(); + Ext.Ajax.request({ + url: '/lib/controller/getModuleSettings.php', + params: { + MID: ModuleID, + UID: , + SID: '', + }, + success: function( response, opts ){ + var data = Ext.decode( response.responseText ); + + if( data.status = 'ok' ){ + moduleSettingsEditorWindow.setTitle( data.wTitle ); + moduleSettingsEditorWindow.removeAll( true ); + moduleSettingsEditorWindow.add( data ); + moduleSettingsEditorWindow.doLayout(); + } else { + moduleSettingsEditorWindow.close(); + moduleSettingsEditorWindow = null; + Ext.Msg.show({ + title:'GetLabel("_ERROR_MSG_");?>', + msg: data.msg, + buttons: Ext.Msg.OK, + fn: function(){ + //SettingsLidar3D.hide(); + }, + icon: Ext.MessageBox.ERROR + }); + }; + }, + failure: failureAJAXFunction + }); +}; +/* function embedVideoEncoderSettings( ModuleID ){ if( embedVideoEncoderSettingsWindow == null ){ embedVideoEncoderSettingsWindow = new Ext.Window({ @@ -507,5 +571,5 @@ function embedVideoEncoderSettings( ModuleID ){ }, failure: failureAJAXFunction }); - */ -}; \ No newline at end of file + * / +};*/ \ No newline at end of file diff --git a/lib/javascript/jsapi_dynamic/rgoose_sysmap_editor.js b/lib/javascript/jsapi_dynamic/rgoose_sysmap_editor.js index f6d081e..c79e1e0 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_sysmap_editor.js +++ b/lib/javascript/jsapi_dynamic/rgoose_sysmap_editor.js @@ -80,11 +80,12 @@ function showResourceInfo( rid ){ }; var settingsWindow = null; -function showSettings( nid ){ +function showSettings( nid, tab = 0 ){ Ext.Ajax.request({ url: '/lib/controller/getNodeSettings.php', params: { NID: nid, + TAB: tab, UID: , SID: '', }, @@ -126,9 +127,10 @@ function showSettings( nid ){ }] }); }; + settingsWindow.show(); settingsWindow.removeAll( true ); settingsWindow.add( data ); - settingsWindow.show(); + settingsWindow.doLayout(); }, failure: failureAJAXFunction }); @@ -340,6 +342,63 @@ function createNode( STYPE ){ }); }; +function removeModule( ID ){ + Ext.Msg.show({ + title:'Q!', + msg: 'Are you sure delete this Module?', + buttons: Ext.Msg.YESNOCANCEL, + fn: function( btn, text ){ + if( btn == 'yes' ){ + Ext.Ajax.request({ + url: '/lib/controller/doModuleOperation.php', + params: { + OPID: 1, + MID: ID, + UID: , + SID: '' + }, + success: function(){ + showSettings( SelectedNodeID, 2 ); + } + }); + }; + }, + icon: Ext.MessageBox.QUESTION + }); +}; + +function enableModule( ID ){ + Ext.Ajax.request({ + url: '/lib/controller/doModuleOperation.php', + params: { + OPID: 2, + OPCODE: 1, + MID: ID, + UID: , + SID: '' + }, + success: function(){ + showSettings( SelectedNodeID, 2 ); + } + }); +}; + +function disableModule( ID ){ + Ext.Ajax.request({ + url: '/lib/controller/doModuleOperation.php', + params: { + OPID: 2, + OPCODE: 0, + MID: ID, + UID: , + SID: '' + }, + success: function(){ + showSettings( SelectedNodeID, 2 ); + } + }); +}; + var addSensor_window = null; function addSerialSensor( sensorType ){ if( addSensor_window!= null ){ diff --git a/lib/js_asm.php b/lib/js_asm.php index 1ebec2f..b9e354e 100644 --- a/lib/js_asm.php +++ b/lib/js_asm.php @@ -33,8 +33,8 @@ if( isset($_GET['Lang'])){ $UCL=$_GET['Lang']/1; if ($UCL) $_SESSION['userlang']=$UCL; else $_SESSION['userlang']=$UserLang; } -if( isset($_SESSION['userlang']) )$Labels=new Language($_SESSION['userlang'], '_js'); -else $Labels=new Language( $UserLang, '_js'); +if( isset($_SESSION['userlang']) )$Labels=new Language($_SESSION['userlang']);//, '_js'); +else $Labels=new Language( $UserLang );//, '_js'); if( $UserLang == 3 || $UserLang == 255 ){ $RTL_SITE = true;