Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

785 lines
19 KiB

<?php
require_once('../ajax_asm.php');
ob_start();
$UID = intval( $CUser->Data['id'] );
$ACCESS = intval( $CUser->Data['access'] );
if( $UID > 1 ){
$CID = intval( $_POST['CID'] );
$QS = "SELECT * FROM `cameras` WHERE `id`={$CID}";
$Result = $DATABASE->Query( $QS, false );
$STREAMS = array();
if( count( $Result ) ){
$Cam = $Result[0];
$Cam['name']=urldecode( $Cam['name'] );
$TB = explode( ' ', $Cam['name'] );
$Cam['name'] = $TB[0];
if( stripos($Cam['ip'],'/dev/video') !==false ){
$CLS = "camera_analog_set";
$CAM_IP = false;
} else {
$CAM_IP = true;
$CamLabel = $Cam['name'] . '_' . $CID;
if( stripos( $Cam['name'], 'hikvision' ) !== false ){
$CLS = "camera_hikvision_set";
} elseif( stripos( $Cam['name'], 'dahua' ) !== false ){
$CLS = "camera_dahua_set";
} elseif( stripos( $Cam['name'], 'axis' ) !== false ){
$CLS = "camera_axis_set";
} else {
$CLS = "camera_generic_set";
};
};
$QS = "SELECT * FROM media_streams WHERE source_id={$CID}";
$Result = $DATABASE->Query($QS,false);
$SELECTED_STREAM = 0;
if( count( $Result ) > 0 ){
$ii = 0;
foreach( $Result as $CD ){
$STREAMS[] = "[{$CD['id']},'{$CD['name']}','{$CD['img_width']}x{$CD['img_height']}@{$CD['fps']}','{$CD['compression_type']}',{$CD['bitrate']}]";
if( $Cam['stream_id'] == $CD['id'] ) $SELECTED_STREAM = $ii;
$ii++;
};
};
$STREAMS = implode(',',$STREAMS);
$QS="SELECT re.aux_id, re.device FROM resources re LEFT JOIN nodes no ON( re.node_id = no.id ) WHERE ( re.type=1 OR re.type=129 ) ";
$RR=$DATABASE->Query( $QS );
if( count( $RR ) ){
$RE=array();
foreach( $RR as $R ){
$RE[] = "[ {$R['aux_id']}, '{$R['device']}']";
};
$UARTS = implode( ',', $RE );
} else {
$UARTS = "[0, \"".$Labels->GetLabel('_NO_UARTS_DEF_')."\"]";
};
$ATAB = 0;
//v4l2-ctl -d /dev/video0 --stream-mmap --stream-count=1 --stream-to=output.jpg
if( $CAM_IP ){
$RESET_CREDENTIALS=<<<kskjhiiuwye
,{
xtype: 'button',
width: '100%',
text: '{$Labels->GetLabel('_RSET_CREDENTIALS_')}',
handler: function(){
}
}
kskjhiiuwye;
} else {
$RESET_CREDENTIALS='';
};
$ADD_CAMERA=<<<hzzhoiuyhetrkh
{
xtype: 'button',
width: '100%',
text: '{$Labels->GetLabel('_ASSIGN_CAMERA_')}',
handler: function(){
}
}
hzzhoiuyhetrkh;
$REMOVE_CAMERA=<<<hhoiuyhetrkh
{
xtype: 'button',
width: '100%',
text: '{$Labels->GetLabel('_REMOVE_CAMERA_')}',
handler: function(){
}
}
hhoiuyhetrkh;
$BBAR_BTN = $ADD_CAMERA;
$TPL_SET_CREDS_IP=<<<ZUZAKA
{
xtype: 'form',
id: 'cam_credentials',
labelWidth: 260,
labelAlign: 'right',
items: [{
xtype: 'panel',
height: 290,
border: false,
frame: false,
html: '<table width="100%" border=0><tr><td height=290 align="center"><div class="{$CLS}"></div></td>'
},{
xtype: 'panel',
html: '<div class="sideInfo_item" id="INFO_ON"><b>{$Cam['ip']}</b><br/>{$Cam['name']}<br/>{$Cam['hardware']}</div>'
},{
xtype: 'panel',
html: '<div class="sideInfo_item" id="INFO_ID">{$Labels->GetLabel('_PROV_CAC_')}</div>'
},{
xtype: 'textfield',
id: 'cam_login',
fieldLabel: '{$Labels->GetLabel('__LOGIN__')}',
width: 200
},{
xtype: 'textfield',
id: 'cam_password',
inputType: 'password',
fieldLabel: '{$Labels->GetLabel('__PASSWORD__')}',
width: 200
},{
xtype: 'combo',
id: 'cam_auth_mode',
fieldLabel: '{$Labels->GetLabel('_AUTH_MODE_0_')}',
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['mode','mode_txt'],
data: [
[0,'BASIC'],
[1,'DIGEST'],
[2,'DIGEST_IE'],
[3,'BEARER'],
[4,'NEGOTIATE'],
[5,'NTLM'],
[6,'NTLM_WB'],
[7,'ANY'],
[8,'ANYSAFE'],
[9,'ONLY'],
[10,'AWS_SIGV4']
]
}),
valueField: 'mode',
displayField: 'mode_txt',
value: 0,
width: 200
},{
xtype: 'button',
width: '100%',
text: '{$Labels->GetLabel('_SET_CREDENTIALS_')}',
handler: function(){
addDetCamWM = new Ext.LoadMask( Ext.getCmp('cam_credentials').getEl(), {msg:"{$Labels->GetLabel('_Please_Wait_')}..."});
addDetCamWM.show();
var NUU = Ext.getCmp('cam_login').getValue();
var NPP = Ext.getCmp('cam_password').getValue();
var NAM = Ext.getCmp('cam_auth_mode').getValue();
Ext.Ajax.request({
url: '/lib/controller/doCameraOperation.php',
params: {
UID: {$UserID},
SID: '{$Session}',
CID: {$CID},
UU: NUU,
PP: NPP,
AU: NAM,
CMD: 3
},
success: function( response, opts ){
addDetCamWM.hide();
var data = Ext.decode(response.responseText);
if( data.status == 'ok' ){
Ext.Msg.show({
title:'Sucess!',
msg: data.msg,
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
//loadDetectedCameras();
} else {
Ext.Msg.show({
title:'Error!',
msg: data.msg,
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.WARNING
});
};
},
failure: failureAJAXFunction
});
}
}]
}
ZUZAKA;
$TPL_ANALOG_CAM =<<<CHUPAKABRA
{
xtype: 'panel',
id: 'cam_info',
labelWidth: 260,
labelAlign: 'right',
bbar:[{$BBAR_BTN}],
items: [{
xtype: 'panel',
height: 290,
border: false,
frame: false,
html: '<table width="100%" border=0><tr><td height=290 align="center"><div class="{$CLS}"></div></td>'
},{
xtype: 'panel',
html: '<div class="sideInfo_item" id="INFO_ON"><b>{$Cam['ip']}</b><br/>{$Cam['name']}<br/>{$Cam['hardware']}</div>'
}]
}
CHUPAKABRA;
$TPL_CAM_EDITOR=<<<PZAKSJEJSDKGJHGASD
{
id: 'camedi_tabs',
xtype: 'tabpanel',
activeTab: 0,
bbar:[{$BBAR_BTN}],
items: [{
title: '{$Labels->GetLabel('_CAC_TAB_')}',
id: 'cam_info',
frame: false,
border: false,
items: [{
xtype: 'panel',
height: 290,
border: false,
frame: false,
html: '<table width="100%" border=0><tr><td height=290 align="center"><div class="{$CLS}"></div></td>'
},{
xtype: 'panel',
html: '<div class="sideInfo_item" id="INFO_ON"><b>{$Cam['ip']}</b><br/>{$Cam['name']}<br/>{$Cam['hardware']}</div>'
}{$RESET_CREDENTIALS}]
},{
title: '{$Labels->GetLabel('_STREAMS_')}',
id: 'str_tab',
frame: false,
border: false,
items:[{
xtype: 'grid',
height: 124,
id: 'nd_cam_grid',
frame: false,
ds: new Ext.data.ArrayStore({
fields: ['id','name','size','encode','bitrate'],
data: [{$STREAMS}]
}),
cm: new Ext.grid.ColumnModel({
columns: [
{header: "id", width: 50, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' },
{header: "Name", dataIndex: 'name' },
{header: "Encoding",width: 120, sortable: false, fixed: true, menuDisabled: true, dataIndex: 'encode' },
{header: "Frame", width: 120, sortable: false, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'size' },
{header: "Bitrate", width: 80, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'bitrate' }
],
defaults: {
sortable: false,
menuDisabled: true,
width: 100
}
}),
sm: new Ext.grid.RowSelectionModel({
singleSelect: true,
listeners: {
rowselect: function(sm, row, rec) {
SelectedSource = rec.data.id;
doCamOperation( {$CID}, 1, SelectedSource );
var tt = Ext.getCmp('pic_prev');
if( tt!= undefined ){
tt.update( '<center><img width="100%" src="/lib/controller/getCameraPreview.php?UID={$CUser->Data['id']}&SID={$Session}&FID='+SelectedSource+'"></center>' );
};
}
}
}),
listeners:{
viewready: function( t ){
var tt = t.getSelectionModel();
tt.selectRow({$SELECTED_STREAM});
}
}
},{
height: PanelH,
id: 'pic_prev',
html: '<center><img width="100%" src="/style/img/cam_cap0.png"></center>',
listeners:{
afterrender: function( t ){
if( SelectedSource ){
//t.update( '<center><img width="100%" src="/lib/controller/getCameraPreview.php?UID={$CUser->Data['id']}&SID={$Session}&FID='+SelectedSource+'"></center>' );
};
}
}
}],
},{
title: 'Lens Settings',
id: 'lens_tab',
frame: false,
border: false,
items:[{
layout: 'table',
frame: false,
border: false,
layoutConfig: {
columns: 3
},
defaults: {
frame: false,
bodyStyle: 'padding:10px',
border: false
},
items:[{
width: 200,
html: 'Sensor Size'
},{
xtype: 'combo',
fieldLabel: 'Sensor Size',
lazyRender: true,
id: 'sens_size',
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['size','size_txt'],
data: [
[0,'1/3.6"'],
[1,'1/3.2"'],
[2,'1/3"'],
[3,'1/2.7"'],
[4,'1/2"'],
[5,'1/1.8"'],
[6,'2/3"'],
[7,'1"'],
[8,'4/3"'],
[9,'APS-C'],
[10,'35 mm'],
[11,'645']
]
}),
valueField: 'size',
displayField: 'size_txt',
value: {$Cam['imager_type']},
listeners:{
select:function( c, r, i ){
doCamOperation( {$CID}, 2, i );
}
}
},{
html: '&nbsp;'
},{
html: 'Focal Length'
},{
xtype: 'combo',
fieldLabel: 'Lens Focal Length',
lazyRender: true,
id: 'lens_fl',
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['fl','fl_txt'],
data: [
[0,'2.7 mm.'],
[1,'3.0 mm.'],
[2,'3.2 mm.'],
[3,'3.5 mm.'],
[4,'3.7 mm.'],
[5,'3.9 mm.'],
[6,'4.0 mm.'],
[7,'4.3 mm.'],
[8,'4.8 mm.'],
[9,'5.0 mm.'],
[10,'5.1 mm.'],
[11,'5.5 mm.'],
[12,'5.8 mm.'],
[13,'6.0 mm.'],
[14,'6.2 mm.'],
[15,'6.6 mm.'],
[16,'7.0 mm.'],
[17,'7.1 mm.'],
[18,'7.5 mm.'],
[19,'7.6 mm.'],
[20,'8.0 mm.'],
[21,'8.6 mm.'],
[22,'8.9 mm.'],
[23,'9.0 mm.'],
[24,'9.2 mm.'],
[25,'9.3 mm.'],
[26,'10.0 mm.'],
[27,'10.5 mm.'],
[28,'10.6 mm.'],
[29,'10.7 mm.'],
[30,'11.0 mm.'],
[31,'11.3 mm.'],
[32,'12.0 mm.'],
[33,'12.9 mm.'],
[34,'13.0 mm.'],
[35,'13.5 mm.'],
[36,'13.6 mm.'],
[37,'14.0 mm.'],
[38,'14.6 mm.'],
[39,'15.0 mm.'],
[40,'15.1 mm.'],
[41,'15.5 mm.'],
[42,'16.0 mm.'],
[43,'17.0 mm.'],
[44,'17.5 mm.'],
[44,'17.7 mm.'],
[45,'18.0 mm.'],
[46,'18.2 mm.'],
[47,'19.0 mm.']
]
}),
valueField: 'fl',
displayField: 'fl_txt',
value: {$Cam['lens_f']},
listeners:{
select:function( c, r, i ){
doCamOperation( {$CID}, 3, i );
}
}
},{
html: '&nbsp;'
},{
html: 'Fixed Zoom'
},{
xtype: 'radio',
id: 'no_zoom',
name: 'zoom_ena',
value: ( parseFloat({$Cam['zoom']})==0 ),
checked: ( parseFloat({$Cam['zoom']})==0 ),
listeners:{
change: function( r, n, o ){
if( n ) {
doCamOperation( {$CID}, 4, 0.0 );
};
}
}
},{
html: '&nbsp;'
},{
html: 'Variable Zoom'
},{
xtype: 'radio',
id: 'on_zoom',
hideLabel: false,
fieldLabel: 'Variable Zoom',
name: 'zoom_ena',
value: ({$Cam['zoom']}>0.0),
checked: ({$Cam['zoom']}>0.0),
handler: function( a, c ){
if( c ){
Ext.getCmp('zoom_val').enable();
Ext.getCmp('zoom_val').setValue( 1 );
var zz = Ext.getCmp('zoom_d');
if( zz.rendered ) zz.update('<p>X&nbsp;1</p>');
} else {
Ext.getCmp('zoom_val').disable();
var zz = Ext.getCmp('zoom_d');
if( zz.rendered ) zz.update('&nbsp;');
};
},
listeners:{
change: function( r, n, o ){
if( n ) {
doCamOperation( {$CID}, 4, 1.0 );
};
}
}
},{
html: '&nbsp;'
},{
html: 'Zoom Ratio'
},{
xtype: 'slider',
id: 'zoom_val',
disabled: ( parseFloat({$Cam['zoom']})==0 ),
minValue: 1.0,
maxValue: 40.0,
value: {$Cam['zoom']},
listeners:{
change: function( a, c, b ){
doCamOperation( {$CID}, 4, c );
var zz = Ext.getCmp('zoom_d');
if( zz.rendered ) zz.update('<p>X&nbsp;'+ c + '</p>');
}
}
},{
id: 'zoom_d',
html: (( parseFloat({$Cam['zoom']})==0 )?'&nbsp;':'<p>X&nbsp;'+ {$Cam['zoom']} + '</p>' )
}]
}]
},{
title: '{$Labels->GetLabel('_PTZ_TAB_')}',
id: 'ptz_tab',
frame: false,
border: false,
items:[{
layout: 'table',
frame: false,
border: false,
layoutConfig: {
columns: 3
},
defaults: {
frame: false,
bodyStyle: 'padding:10px',
border: false
},
items:[{
width: 200,
html: '{$Labels->GetLabel('__PTZ_CONTROL__')}'
},{
xtype: 'combo',
fieldLabel: '{$Labels->GetLabel('__PTZ_CONTROL__')}',
lazyRender: true,
id: 'ptz_proto',
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['type','type_txt'],
data: [
[0,'{$Labels->GetLabel('_NO_PTZ_')}'],
[1,'Sony VISCA'],
[2,'Pelco-D'],
[3,'OnVif'],
[4,'PSIA'],
[5,'GB/T28181']
]
}),
value: {$Cam['protocol']},
valueField: 'type',
displayField: 'type_txt',
listeners:{
select: function( a, c, b ){
doCamOperation( {$CID}, 5, b );
if( b > 0 ){
if( b != 3 ){
Ext.getCmp('uart_id').enable();
Ext.getCmp('prot_id').enable();
} else {
Ext.getCmp('uart_id').disable();
Ext.getCmp('prot_id').disable();
};
Ext.getCmp('pan_mode').enable();
Ext.getCmp('tilt_mode').enable();
Ext.getCmp('pan_ang').enable();
Ext.getCmp('tilt_ang').enable();
} else {
Ext.getCmp('uart_id').disable();
Ext.getCmp('prot_id').disable();
Ext.getCmp('pan_mode').disable();
Ext.getCmp('tilt_mode').disable();
Ext.getCmp('pan_ang').disable();
Ext.getCmp('tilt_ang').disable();
};
}
}
},{
html: '&nbsp;'
},{
html: '{$Labels->GetLabel('_UART_PORT_')}'
},{
xtype: 'combo',
fieldLabel: '{$Labels->GetLabel('_UART_PORT_')}',
lazyRender: true,
id: 'uart_id',
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
disabled: (({$Cam['protocol']}!=1 ) && ( {$Cam['protocol']}!=2 )),
store: new Ext.data.ArrayStore({
fields: ['uart','uart_txt'],
data: [{$UARTS}]
}),
valueField: 'uart',
displayField: 'uart_txt',
value: {$Cam['uart_id']},
listeners:{
select: function( a, c, b ){
doCamOperation( {$CID}, 6, b );
}
}
},{
html: '&nbsp;'
},{
html: '{$Labels->GetLabel('_CAM_PROTO_ID_')}'
},{
xtype: 'numberfield',
id: 'prot_id',
width: '95%',
disabled: (({$Cam['protocol']}!=1 ) && ( {$Cam['protocol']}!=2 )),
minValue: 0,
maxValue: 255,
value: {$Cam['protocol_aux']},
listeners:{
change: function( a, c, b ){
doCamOperation( {$CID}, 7, c );
}
}
},{
html: '&nbsp;'
},{
html: 'Pan Model'
},{
xtype: 'combo',
fieldLabel: 'Pan Model',
lazyRender: true,
id: 'pan_mode',
disabled: ({$Cam['protocol']} == 0),
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['pm','pm_txt'],
data: [
[0,'Regular'],
[1,'Reversed']
]
}),
valueField: 'pm',
displayField: 'pm_txt',
value: {$Cam['pan_model']},
listeners:{
select: function( a, c, b ){
doCamOperation( {$CID}, 8, b );
}
}
},{
html: '&nbsp;'
},{
html: 'Tottal Pan Angles'
},{
xtype: 'numberfield',
id: 'pan_ang',
width: '95%',
disabled: ({$Cam['protocol']} == 0),
minValue: 0,
maxValue: 360,
value: {$Cam['pan_angles']},
listeners:{
change: function( a, c, b ){
doCamOperation( {$CID}, 9, c );
}
}
},{
html: '&nbsp;'
},{
html: 'Tilt Model'
},{
xtype: 'combo',
fieldLabel: 'Tilt Model',
lazyRender: true,
id: 'tilt_mode',
disabled: ({$Cam['protocol']} == 0),
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['tm','tm_txt'],
data: [
[0,'Regular'],
[1,'Reversed'],
[2,'Shifted 90°'],
[3,'Rev-Shifted 90°']
]
}),
valueField: 'tm',
displayField: 'tm_txt',
value: {$Cam['tilt_model']},
listeners:{
select: function( a, c, b ){
doCamOperation( {$CID}, 10, b );
}
}
},{
html: '&nbsp;'
},{
html: 'Tottal Tilt Angles'
},{
xtype: 'numberfield',
id: 'tilt_ang',
width: '95%',
disabled: ({$Cam['protocol']} == 0),
minValue: 0,
maxValue: 180,
value: {$Cam['tilt_angles']},
listeners:{
change: function( a, c, b ){
doCamOperation( {$CID}, 11, c );
}
}
},{
html: '&nbsp;'
}]
}]
},{
title: '{$Labels->GetLabel('_TARGETING_TAB_')}',
id: 'target_tab',
frame: false,
border: false,
items:[{
layout: 'table',
frame: false,
border: false,
layoutConfig: {
columns: 3
},
defaults: {
frame: false,
bodyStyle: 'padding:10px',
border: false
},
items:[{
width: 200,
html: '{$Labels->GetLabel('_CAM_TRIGGERING_MODE_')}'
},{
xtype: 'combo',
lazyRender: true,
id: 'cam_targeting',
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['type','type_txt'],
data: [
[0,'Strict Visible Targets'],
[1,'All Near'],
[2,'ALL Far'],
[3,'All Targets']
]
}),
value: {$Cam['trigger_mode']},
valueField: 'type',
displayField: 'type_txt',
listeners:{
select: function( a, c, b ){
doCamOperation( {$CID}, 12, b );
}
}
}]
}]
}]
}
PZAKSJEJSDKGJHGASD;
$Data['status']='ok';
if( $Cam['status'] == 0 ){
$ADDCAMPOPO = '';
} else {
$ADDCAMPOPO = '';
};
if( $CAM_IP ){
switch( $Cam['status'] ){
case 0: $Data['content'] = $TPL_SET_CREDS_IP; break;
case 1: $Data['content'] = $TPL_CAM_EDITOR; break;
case 2: $Data['content'] = $TPL_CAM_EDITOR; break;
};
} else {
$Data['content'] = $TPL_CAM_EDITOR;
};
} else {
$Data['status']='error';
};
echo $Data['content'];
} else {
header('location: /');
};
?>