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.
 
 
 
 

1664 lines
43 KiB

//<?php require_once('../../js_asm.php'); ?>
var SelectedCam = 0;
var SelectedSource = 0;
var SelectedCamTYPE = 0;
var connectIPCamDialog = null;
var connectAnalCamDialog = null;
var addIpCamDialog = null;
var addAnalogCamDialog = null;
var cameraListStore = new Ext.data.JsonStore({
root: 'nodes',
totalProperty: 'totalCount',
idProperty: 'id',
remoteSort: true,
fields: [{
name: 'id',
type: 'int'
},{
name: 'name',
type: 'string'
},{
name: 'hardware',
type: 'string'
},{
name: 'caps',
type: 'string'
},{
name: 'ip',
type: 'string'
},{
name: 'mac',
type: 'string'
},{
name: 'ena',
type: 'int'
}],
proxy : new Ext.data.HttpProxy({
method: 'POST',
prettyUrls: false,
url: '/lib/controller/listMediaSources.php',
headers: {
'UID': '<?=$CUser->Data['id'];?>',
'SID': '<?=$Session;?>'
}
})
});
var sourceListStore = new Ext.data.JsonStore({
root: 'nodes',
totalProperty: 'totalCount',
idProperty: 'id',
remoteSort: true,
fields: [{
name: 'id',
type: 'int'
},{
name: 'name',
type: 'string'
},{
name: 'encode',
type: 'string'
},{
name: 'bitrate',
type: 'int'
},{
name: 'size',
type: 'string'
}]
});
var IPCameraListSelModel = new Ext.grid.RowSelectionModel({
singleSelect: true,
listeners: {
rowselect: function(sm, row, rec) {
SelectedCam = rec.data.id;
var CB = Ext.getCmp('con_to_ip_src');
if( rec.data.ena ){
CB.enable();
} else {
CB.disable();
};
}
}
});
var AnalogCameraListSelModel = new Ext.grid.RowSelectionModel({
singleSelect: true,
listeners: {
rowselect: function(sm, row, rec) {
SelectedSource = rec.data.id;
var CB = Ext.getCmp('con_to_anal_src');
var CC = Ext.getCmp('cha_an_strim_set');
if( rec.data.ena ){
CB.enable();
CC.enable();
} else {
CB.disable();
CC.disable();
};
}
}
});
var sourceListSelModel = new Ext.grid.RowSelectionModel({
singleSelect: true,
listeners: {
rowselect: function(sm, row, rec) {
SelectedSource = rec.data.id;
Ext.getCmp('pic_prev').update( '<center><img height="300px" src="/lib/controller/getCameraPreview.php?UID=<?=$CUser->Data['id'];?>&SID=<?=$Session;?>&FID='+SelectedSource+'"></center>' );
}
}
});
function camCapRenderer(val){
var p1, p2, p3;
if( ( val & 1 ) == 1 ){
p1 = '<img src="/style/img/cam_cap3.png" alt="Video Source">';
} else {
p1 = '<img src="/style/img/cam_cap0.png" alt="NO Video Source">';
};
if( ( val & 2 ) == 2 ){
p2 = '<img src="/style/img/cam_cap2.png" alt="Audio Source">';
} else {
p2 = '<img src="/style/img/cam_cap0.png" alt="NO Audio Source">';
};
if( ( val & 4 ) == 4 ){
p3 = '<img src="/style/img/cam_cap1.png" alt="PTZ Control">';
} else {
p3 = '<img src="/style/img/cam_cap0.png" alt="NO PTZ Control">';
};
return p1+p2+p3;
};
var IPCameraListColModel = new Ext.grid.ColumnModel({
columns: [
{header: "id", width: 50, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' },
{header: "Type",width: 60, sortable: false, fixed: true, menuDisabled: true, /*renderer: camCapRenderer,*/ dataIndex: 'caps' },
{header: "IP Address", width: 120, sortable: false, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'ip' },
{header: "MAC", width: 120, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'mac' },
{header: "Name", dataIndex: 'name' },
{header: "HW", menuDisabled: true, dataIndex: 'hardware' }
],
defaults: {
sortable: true,
menuDisabled: true,
width: 100
},
listeners: {
hiddenchange: function(cm, colIndex, hidden) {
//saveConfig(colIndex, hidden);
}
}
});
var AnalogCameraListColModel = new Ext.grid.ColumnModel({
columns: [
{header: "id", width: 50, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' },
{header: "Type",width: 60, sortable: false, fixed: true, menuDisabled: true, /*renderer: camCapRenderer,*/ dataIndex: 'caps' },
{header: "Frame Size", width: 60, sortable: false, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'ip' },
{header: "Device", width: 120, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'mac' },
{header: "Name", width: 200, dataIndex: 'name' },
{header: "HW", menuDisabled: true, dataIndex: 'hardware' }
],
defaults: {
sortable: true,
menuDisabled: true,
width: 100
},
listeners: {
hiddenchange: function(cm, colIndex, hidden) {
//saveConfig(colIndex, hidden);
}
}
});
var sourceListColModel = 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
},
listeners: {
hiddenchange: function(cm, colIndex, hidden) {
//saveConfig(colIndex, hidden);
}
}
});
function discoverOnvifSources(){
Ext.Ajax.request({
url: '/lib/controller/listAndDiscoverOnvifSources.php',
params: {
NID: 0,
UID: <?=$UserID;?>,
SID: '<?=$Session;?>'
},
success: function( response, opts ){
cameraListStore.reload();
},
failure: failureAJAXFunction
});
};
function loadCameraSettings( SC ){
Ext.Ajax.request({
url: '/lib/controller/getCameraSettings.php',
params: {
CID: SC,
UID: <?=$UserID;?>,
SID: '<?=$Session;?>'
},
success: function( response, opts ){
var data = Ext.decode( response.responseText );
if( data.success ){
} else {
};
},
failure: function( response, opts ) {
Ext.getCmp('cam_login').setValue('');
Ext.getCmp('cam_password').setValue('');
Ext.getCmp('cac_tab').enable();
Ext.getCmp('str_tab').disable();
Ext.getCmp('ptz_tab').disable();
Ext.getCmp('loc_tab').disable();
Ext.getCmp('coc_tabs').setActiveTab( 0 );
sourceListStore.removeAll();
}
});
};
function preloadOnvifCredentials( SC ){
showIPCamPropDialog();
Ext.Ajax.request({
url: '/lib/controller/getIpCamCredentials.php',
params: {
CID: SC,
UID: <?=$UserID;?>,
SID: '<?=$Session;?>'
},
success: function( response, opts ){
var data = Ext.decode( response.responseText );
if( data.success ){
Ext.getCmp('cam_login').setValue( data.login );
Ext.getCmp('cam_password').setValue( data.password );
Ext.getCmp('cam_auth_mode').setValue( data.auth_mode );
Ext.getCmp('acm_btn').enable();
Ext.getCmp('cac_tab').disable();
Ext.getCmp('lens_tab').enable();
Ext.getCmp('str_tab').enable();
Ext.getCmp('ptz_tab').enable();
Ext.getCmp('coc_tabs').setActiveTab( 1 );
sourceListStore.loadData( data, false );
var tpic = document.getElementById('pic_prev');
if( tpic != null ) tpic.src = '/lib/controller/getVideoFeed.php?UID=<?=$CUser->Data['id'];?>&SID<?=$Session;?>&FID='+data.nodes[0].id;
//document.getElementById('pic_prev').src = '/lib/controller/getVideoFeed.php?UID=<?=$CUser->Data['id'];?>&SID<?=$Session;?>&FID='+data.nodes[0].id;
} else {
Ext.getCmp('cam_login').setValue('');
Ext.getCmp('cam_password').setValue('');
Ext.getCmp('cam_auth_mode').setValue( 0 );
Ext.getCmp('acm_btn').disable();
Ext.getCmp('cac_tab').enable();
Ext.getCmp('lens_tab').disable();
Ext.getCmp('str_tab').disable();
Ext.getCmp('ptz_tab').disable();
Ext.getCmp('coc_tabs').setActiveTab( 0 );
sourceListStore.removeAll();
if( data.error != null ){
Ext.Msg.show({
title:"<?=$Labels->GetLabel('Error_Message');?>",
msg: data['error'],
buttons: Ext.Msg.OK,//YESNOCANCEL,
//fn: processResult,
//animEl: 'elId',
icon: Ext.MessageBox.ERROR //QUESTION
});
};
};
},
failure: function( response, opts ) {
Ext.getCmp('cam_login').setValue('');
Ext.getCmp('cam_password').setValue('');
Ext.getCmp('cam_auth_mode').setValue( 0 );
Ext.getCmp('cac_tab').enable();
Ext.getCmp('lens_tab').disable();
Ext.getCmp('str_tab').disable();
Ext.getCmp('ptz_tab').disable();
Ext.getCmp('coc_tabs').setActiveTab( 0 );
sourceListStore.removeAll();
}
});
};
function discoverOnvifProfiles( CamID, camUser, camPasswd, Auth ){
Ext.Ajax.request({
url: '/lib/controller/discoverOnvifProfiles.php',
params: {
NID: 0,
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
CID: CamID,
GUG: camUser,
GOG: camPasswd,
GAT: Auth
},
success: function( response, opts ){
var data = Ext.decode( response.responseText );
Ext.getCmp('cac_tab').getEl().unmask();
if( data['success'] == true ){
Ext.getCmp('acm_btn').enable();
Ext.getCmp('cac_tab').disable();
Ext.getCmp('lens_tab').enable();
Ext.getCmp('str_tab').enable();
Ext.getCmp('ptz_tab').enable();
Ext.getCmp('coc_tabs').setActiveTab( 1 );
sourceListStore.loadData( data, false );
var tpic = document.getElementById('pic_prev');
if( tpic != null ) tpic.src = '/lib/controller/getCameraPreview.php?UID=<?=$CUser->Data['id'];?>&SID<?=$Session;?>&FID='+data.nodes[0].id;
} else {
Ext.Msg.show({
title:"<?=$Labels->GetLabel('Error_Message');?>",
msg: data['error'],
width: 640,
buttons: Ext.Msg.OK,//YESNOCANCEL,
//fn: processResult,602811123
//animEl: 'elId',
icon: Ext.MessageBox.ERROR //QUESTION
});
};
},
failure: failureAJAXFunction
});
};
var CamPropType = 0;
function showIPCamPropDialog(){
if( connectIPCamDialog == null ){
connectIPCamDialog = new Ext.Window({
modal: true,
title: (CamPropType)?"<?=$Labels->GetLabel('_CON_2_IP_CAM_');?>":"IP Camera Settings",
width: 600,
height: 500,
layout: 'vbox',
closeAction: 'hide',
border: false,
items:[{
xtype: 'form',
width: '100%',
labelWidth: 200,
labelAlign: 'right',
labelSeparator: '',
items: [{
xtype: 'spacer',
height: 5
},{
id: 'cam_label',
xtype: 'textfield',
fieldLabel: "<?=$Labels->GetLabel('_CAM_MAP_NAME_');?>"
//width: 200
},{
xtype: 'combo',
fieldLabel: "<?=$Labels->GetLabel('_CTL_SERVER_NODE_');?>",
lazyRender: true,
id: 'cam_server_id',
//width: 200,
disabled: false,
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: ServerListStore,
valueField: 'server_id',
displayField: 'server_name'
},{
xtype: 'spacer',
height: 5
}]
},{
id: 'coc_tabs',
xtype: 'tabpanel',
activeTab: 0,
items: [{
title: "<?=$Labels->GetLabel('_CAC_TAB_');?>",
id: 'cac_tab',
layout: 'table',
width: '100%',
border: false,
disabled: false,
defaults: {
border: false,
frame: false,
bodyStyle: 'padding:10px'
},
layoutConfig: {
columns: 3
},
items: [{
colspan: 3,
html: "<p align='center'><?=$Labels->GetLabel('_PROV_CAC_');?></p>"
},{
html: "<p align='right'><?=$Labels->GetLabel('_LOGIN_0_');?></p>",
width: 170
},{
id: 'cam_login',
xtype: 'textfield',
width: 200
},{
html: '&nbsp;'
},{
html: "<p align='right'><?=$Labels->GetLabel('_PASSWORD_0_');?></p>"
},{
id: 'cam_password',
xtype: 'textfield',
inputType: 'password',
width: 200
},{
html: '&nbsp;'
},{
html: "<p align='right'><?=$Labels->GetLabel('_AUTH_MODE_0_');?></p>"
},{
id: 'cam_auth_mode',
xtype: 'combo',
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
},{
html: '&nbsp;'
},{
html: '&nbsp;'
},{
xtype: 'button',
text: "Connect to Camera",
width: '100%',
handler: function(){
Ext.getCmp('cac_tab').getEl().mask("Please wait...","x-mask-loading");
var User = Ext.getCmp('cam_login').getValue();
var Passwd = Ext.getCmp('cam_password').getValue();
var Auth = Ext.getCmp('cam_auth_mode').getValue();
discoverOnvifProfiles( SelectedCam, User, Passwd, Auth );
}
},{
html: '&nbsp;'
}]
},{
title: "<?=$Labels->GetLabel('_STREAMS_');?>",
id: 'str_tab',
frame: false,
disabled: true,
items:[{
xtype: 'grid',
//title: "<?=$Labels->GetLabel('_STREAMS_');?>",
height: 124,
frame: false,
disableSelection: true,
ds: sourceListStore,
cm: sourceListColModel,
sm: sourceListSelModel
},{
height: 300,
id: 'pic_prev',
width: 600,
html: '<center><img height="300px" src="/style/img/cam_cap0.png"></center>'
}]
},{
title: 'Lens Settings',
id: 'lens_tab',
disabled: true,
items:[{
layout: 'table',
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: 0
},{
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: 0
},{
html: '&nbsp;'
},{
html: "Fixed Zoom"
},{
xtype: 'radio',
id: 'no_zoom',
name: 'zoom_ena',
value: 1,
checked: true
},{
html: '&nbsp;'
},{
html: 'Variable Zoom'
},{
xtype: 'radio',
id: 'on_zoom',
hideLabel: false,
fieldLabel: 'Variable Zoom',
name: 'zoom_ena',
value: 0,
checked: false,
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;');
};
}
},{
html: '&nbsp;'
},{
html: 'Zoom Ratio'
},{
xtype: 'slider',
id: 'zoom_val',
disabled: true,
minValue: 1.0,
maxValue: 40.0,
listeners:{
change: function( a, c, b ){
var zz = Ext.getCmp('zoom_d');
if( zz.rendered ) zz.update('<p>X&nbsp;'+ c + '</p>');
}
}
},{
id: 'zoom_d',
html: '&nbsp;'
}]
}]
},{
title: '<?=$Labels->GetLabel('_PTZ_TAB_');?>',
id: 'ptz_tab',
disabled: true,
items:[{
layout: 'table',
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: 0,
valueField: 'type',
displayField: 'type_txt',
listeners:{
change: function( a, c, b ){
if( c > 0 ){
if( c != 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: true,
store: new Ext.data.ArrayStore({
fields: ['uart','uart_txt'],
data: [<?php
$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']}']";
};
echo implode( ',', $RE );
} else {
echo "[0, \"".$Labels->GetLabel('_NO_UARTS_DEF_')."\"]";
};
?>]
}),
valueField: 'uart',
displayField: 'uart_txt'
},{
html: '&nbsp;'
},{
html: '<?=$Labels->GetLabel('_CAM_PROTO_ID_');?>'
},{
xtype: 'numberfield',
id: 'prot_id',
width: '95%',
disabled: true,
minValue: 0,
maxValue: 255
},{
html: '&nbsp;'
},{
html: 'Pan Model'
},{
xtype: 'combo',
fieldLabel: 'Pan Model',
lazyRender: true,
id: 'pan_mode',
disabled: true,
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: 0
},{
html: '&nbsp;'
},{
html: 'Tottal Pan Angles'
},{
xtype: 'numberfield',
id: 'pan_ang',
width: '95%',
disabled: true,
minValue: 0,
maxValue: 360,
value: 360
},{
html: '&nbsp;'
},{
html: 'Tilt Model'
},{
xtype: 'combo',
fieldLabel: 'Tilt Model',
lazyRender: true,
id: 'tilt_mode',
disabled: true,
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: 0
},{
html: '&nbsp;'
},{
html: 'Tottal Tilt Angles'
},{
xtype: 'numberfield',
id: 'tilt_ang',
width: '95%',
disabled: true,
minValue: 0,
maxValue: 180,
value: 90
},{
html: '&nbsp;'
}]
}]
}]
}],
bbar:[{
text: '<?=$Labels->GetLabel('_CANCEL_');?>',
handler: function(){
//addDialog.close();
//addDialog = null;
connectCamDialog.hide();
//connectOnvifDialog = null;
}
},'->',{
text: 'Add Camera to Map',
id: 'acm_btn',
disabled: true,
handler: function(){
var CLAB = Ext.getCmp('cam_label').getValue();
var CPTZP = Ext.getCmp('ptz_proto').getValue();
var CPTZU = Ext.getCmp('uart_id').getValue();
var CPTZID = Ext.getCmp('prot_id').getValue();
var CPANM = Ext.getCmp('pan_mode').getValue();
var CTILTM = Ext.getCmp('tilt_mode').getValue();
var CPANANG = Ext.getCmp('pan_ang').getValue();
var CTILTANG = Ext.getCmp('tilt_ang').getValue();
var CIMAGER = Ext.getCmp('sens_size').getValue();
var CLFL = Ext.getCmp('lens_fl').getValue();
var CZOOM = Ext.getCmp('zoom_val').getValue();
var SRVID = Ext.getCmp('cam_server_id').getValue();
var AllOK = true;
if( CLAB == '' ) {
AllOK = false;
Ext.Msg.show({
title:'Data Error!',
msg: 'Please Provide Camera Name!',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
return;
};
if( SelectedSource == 0 ){
AllOK = false;
Ext.Msg.show({
title:'Data Error!',
msg: 'Please Select Image Source!',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
return;
};
if( SRVID == 0 ){
AllOK = false;
Ext.Msg.show({
title:'Data Error!',
msg: 'Please Select Server to Connect Camera!',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
return;
};
if( ( SelectedCamTYPE == 11 || SelectedCamTYPE == 13 ) && CPTZP == 0 ){
AllOK = false;
Ext.Msg.show({
title:'Data Error!',
msg: 'Please Provide PTZ Protocol type!',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
return;
};
if( ( CPTZP == 1 || CPTZP == 2 ) && CPTZU == 0 ){
AllOK = false;
Ext.Msg.show({
title:'Data Error!',
msg: 'Please Provide UART Port!',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
return;
};
if( ( CPTZP == 1 || CPTZP == 2 ) && CPTZID == 0 ){
AllOK = false;
Ext.Msg.show({
title:'Data Error!',
msg: 'Please Provide Camera ID!',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
return;
};
if( AllOK ){
Ext.Ajax.request({
url: '/lib/controller/addNetworkNode.php',
params: {
SITEID: <?=$SiteID;?>,
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
CID: SelectedCam,
STREAM: SelectedSource,
SRVID: SRVID,
LAB: CLAB,
UART: CPTZU,
PROTOID: CPTZID,
PANMODE: CPANM,
TILTMODE: CTILTM,
PANANG: CPANANG,
TILTANG: CTILTANG,
IMSIZE: CIMAGER,
LFL: CLFL,
ZOOM: CZOOM,
PTZ: CPTZP,
TYPE: SelectedCamTYPE
},
success: function( response, opts ){
var data = Ext.decode(response.responseText);
if( data.success ){
addIpCamDialog.close();
addIpCamDialog = null;
connectIPCamDialog.close();
connectIPCamDialog = null;
} else {
Ext.Msg.show({
title:'Error Message',
msg: data.msg,
buttons: Ext.Msg.OK,//YESNOCANCEL,
fn: function(){
//SettingsLidar3D.hide();
},
//animEl: 'elId',
icon: Ext.MessageBox.ERROR //QUESTION
});
};
},
failure: failureAJAXFunction
});
};
}
}]
});
} else {
};
connectIPCamDialog.show();
};
function showAnalCamPropDialog(){
if( connectAnalCamDialog == null ){
connectAnalCamDialog = new Ext.Window({
modal: true,
title: '<?=$Labels->GetLabel('_CREA_ANAL_CAM_');?>',
width: 600,
height: 500,
layout: 'vbox',
closeAction: 'hide',
border: false,
items:[{
xtype: 'form',
width: '100%',
labelWidth: 200,
labelAlign: 'right',
labelSeparator: '',
items: [{
xtype: 'spacer',
height: 5
},{
id: 'cam_label',
xtype: 'textfield',
fieldLabel: '<?=$Labels->GetLabel('_CAM_MAP_NAME_');?>'
//width: 200
},{
xtype: 'combo',
fieldLabel: '<?=$Labels->GetLabel('_CTL_SERVER_NODE_');?>',
lazyRender: true,
id: 'cam_server_id',
//width: 200,
disabled: false,
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: ServerListStore,
valueField: 'server_id',
displayField: 'server_name'
},{
xtype: 'spacer',
height: 5
}]
},{
id: 'coc_tabs',
xtype: 'tabpanel',
activeTab: 0,
items: [{
title: 'Lens Settings',
xtype: 'form',
id: 'lens_tab',
disabled: false,
items:[{
layout: 'table',
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',
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'
},{
html: '&nbsp;'
},{
html: 'Fixed Zoom'
},{
xtype: 'radio',
id: 'no_zoom',
name: 'zoom_ena',
value: 0,
checked: true
},{
html: '&nbsp;'
},{
html: 'Variable Zoom'
},{
xtype: 'radio',
id: 'on_zoom',
hideLabel: false,
fieldLabel: 'Variable Zoom',
html: 'koko',
name: 'zoom_ena',
value: 1,
checked: false,
handler: function( a, c ){
if( c ){
Ext.getCmp('max_foc').enable();
Ext.getCmp('zoom_val').enable();
var mf = Ext.getCmp('min_foc').getValue();
if( mf > 0 ){
Ext.getCmp('max_foc').setValue( mf );
Ext.getCmp('zoom_val').setValue( 1 );
};
} else {
Ext.getCmp('max_foc').disable();
Ext.getCmp('zoom_val').disable();
Ext.getCmp('zoom_disp').update('&nbsp;');
};
}
},{
html: '&nbsp;'
},{
html: 'Min. Focal Length'
},{
xtype: 'numberfield',
id: 'min_foc',
width: '95%',
minValue: 1.0,
maxValue: 270.0
},{
html: '&nbsp;'
},{
html: 'Max. Focal Length'
},{
xtype: 'numberfield',
id: 'max_foc',
width: '95%',
disabled: true,
minValue: 1.0,
maxValue: 270.0,
listeners:{
change: function( a, c, b ){
if( b == c ) return;
var mf = Ext.getCmp('min_foc').getValue();
if( mf > 0 ){
if( c < mf ){
Ext.getCmp('max_foc').setValue( mf );
} else {
var zl = c / mf;
Ext.getCmp('zoom_val').setValue( zl );
};
};
}
}
},{
html: '&nbsp;'
},{
html: 'Zoom Ratio'
},{
xtype: 'slider',
id: 'zoom_val',
disabled: true,
minValue: 1.0,
maxValue: 40.0,
listeners:{
change: function( a, c, b ){
var mf = Ext.getCmp('min_foc').getValue();
if( mf > 0 ){
Ext.getCmp('max_foc').setValue( mf*c );
Ext.getCmp('zoom_disp').update('<p>X&nbsp;'+ c + '</p>');
};
}
}
},{
id: 'zoom_disp',
html: '&nbsp;'
}]
}]
},{
title: '<?=$Labels->GetLabel('_PTZ_TAB_');?>',
id: 'ptz_tab',
disabled: true,
items:[{
layout: 'table',
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']
]
}),
valueField: 'type',
displayField: 'type_txt',
listeners:{
change: function( a, c, b ){
if( c > 0 ){
if( c != 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',
disabled: true,
forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['uart','uart_txt'],
data: [<?php
$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']}']";
};
echo implode( ',', $RE );
} else {
echo "[0, \"".$Labels->GetLabel('_NO_UARTS_DEF_')."\"]";
};
?>]
}),
valueField: 'uart',
displayField: 'uart_txt'
},{
html: '&nbsp;'
},{
html: '<?=$Labels->GetLabel('_CAM_PROTO_ID_');?>'
},{
xtype: 'numberfield',
id: 'prot_id',
width: '95%',
disabled: true,
minValue: 0,
maxValue: 255
},{
html: '&nbsp;'
},{
html: 'Pan Model'
},{
xtype: 'combo',
fieldLabel: 'Pan Model',
lazyRender: true,
id: 'pan_mode',
forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true,
disabled: true,
mode: 'local',
store: new Ext.data.ArrayStore({
fields: ['pm','pm_txt'],
data: [
[0,'Regular'],
[1,'Reversed']
]
}),
valueField: 'pm',
displayField: 'pm_txt'
},{
html: '&nbsp;'
},{
html: 'Tottal Pan Angles'
},{
xtype: 'numberfield',
id: 'pan_ang',
width: '95%',
disabled: true,
minValue: 0,
maxValue: 360
},{
html: '&nbsp;'
},{
html: 'Tilt Model'
},{
xtype: 'combo',
fieldLabel: 'Tilt Model',
lazyRender: true,
id: 'tilt_mode',
disabled: true,
forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true,
mode: 'local',
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'
},{
html: '&nbsp;'
},{
html: 'Tottal Tilt Angles'
},{
xtype: 'numberfield',
id: 'tilt_ang',
width: '95%',
disabled: true,
minValue: 0,
maxValue: 180
},{
html: '&nbsp;'
}]
}]
}]
}],
bbar:[{
text: '<?=$Labels->GetLabel('_CANCEL_');?>',
handler: function(){
//connectAnalCamDialog.hide();
connectAnalCamDialog.close();
connectAnalCamDialog = null;
}
},'->',{
text: '<?=$Labels->GetLabel('_ADD_CAMERA2SITE_');?>',
id: 'acm_btn',
handler: function(){
var CLAB = Ext.getCmp('cam_label').getValue();
var CPTZP = Ext.getCmp('ptz_proto').getValue();
var CPTZU = Ext.getCmp('uart_id').getValue();
var CPTZID = Ext.getCmp('prot_id').getValue();
var CPANM = Ext.getCmp('pan_mode').getValue();
var CTILTM = Ext.getCmp('tilt_mode').getValue();
var CPANANG = Ext.getCmp('pan_ang').getValue();
var CTILTANG = Ext.getCmp('tilt_ang').getValue();
var CIMAGER = Ext.getCmp('sens_size').getValue();
var CMINF = Ext.getCmp('min_foc').getValue();
var CMAXF = Ext.getCmp('max_foc').getValue();
var SRVID = Ext.getCmp('cam_server_id').getValue();
var AllOK = true;
if( CLAB == '' ) {
AllOK = false;
Ext.Msg.show({
title:'Data Error!',
msg: 'Please Provide Camera Name!',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
return;
};
if( SelectedSource == 0 ){
AllOK = false;
Ext.Msg.show({
title:'Data Error!',
msg: 'Please Select Image Source!',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
return;
};
if( SRVID == 0 ){
AllOK = false;
Ext.Msg.show({
title:'Data Error!',
msg: 'Please Select Server to Connect Camera!',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
return;
};
if( ( SelectedCamTYPE == 11 || SelectedCamTYPE == 13 ) && CPTZP == 0 ){
AllOK = false;
Ext.Msg.show({
title:'Data Error!',
msg: 'Please Provide PTZ Protocol type!',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
return;
};
if( ( CPTZP == 1 || CPTZP == 2 ) && CPTZU == 0 ){
AllOK = false;
Ext.Msg.show({
title:'Data Error!',
msg: 'Please Provide UART Port!',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
return;
};
if( ( CPTZP == 1 || CPTZP == 2 ) && CPTZID == 0 ){
AllOK = false;
Ext.Msg.show({
title:'Data Error!',
msg: 'Please Provide Camera ID!',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
return;
};
if( AllOK ){
Ext.Ajax.request({
url: '/lib/controller/addNetworkNode.php',
params: {
SITEID: <?=$SiteID;?>,
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
CID: SelectedCam,
STREAM: SelectedSource,
SRVID: SRVID,
LAB: CLAB,
UART: CPTZU,
PROTOID: CPTZID,
PANMODE: CPANM,
TILTMODE: CTILTM,
PANANG: CPANANG,
TILTANG: CTILTANG,
IMSIZE: CIMAGER,
FMIN: CMINF,
FMAX: CMAXF,
PTZ: CPTZP,
TYPE: SelectedCamTYPE
},
success: function( response, opts ){
var data = Ext.decode(response.responseText);
if( data.success ){
reloadNetworkData();
addAnalogCamDialog.close();
addAnalogCamDialog = null;
connectAnalCamDialog.close();
connectAnalCamDialog = null;
} else {
Ext.Msg.show({
title:'Data Error!',
msg: data.msg,
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.ERROR
});
};
//loadSystemEditor();
},
failure: failureAJAXFunction
});
};
}
}]
});
} else {
};
connectAnalCamDialog.show();
if( SelectedCamTYPE == 11 ){
Ext.getCmp('ptz_tab').enable();
Ext.getCmp('on_zoom').enable();
} else {
Ext.getCmp('ptz_tab').disable();
Ext.getCmp('on_zoom').disable();
};
};
function connectToSeleced(){
CamPropType = 1;
if( SelectedCam > 0 ){
preloadOnvifCredentials( SelectedCam );
//loadCameraSettings( SelectedCam );
};
};
function addIpCam(){
if( addIpCamDialog == null ){
addIpCamDialog = new Ext.Window({
modal: true,
title: '<?=$Labels->GetLabel('_DET_IP_CAMERA_LST_');?>',
width: 800,
height: 600,
layout: 'fit',
closeAction: 'hide',
items:{
xtype: 'grid',
frame: false,
border: false,
ds: cameraListStore,
cm: IPCameraListColModel,
sm: IPCameraListSelModel,
viewConfig: {
forceFit: true
},
bbar: [{
text: '<?=$Labels->GetLabel('_CANCEL_');?>',
handler: function(){
addIpCamDialog.hide();
}
},'->',{
id: 'con_to_ip_src',
text: '<?=$Labels->GetLabel('_CONNECT_2_SEL_');?>',
disabled: ( SelectedCam == 0 ),
handler: connectToSeleced
}]
}
});
};
addIpCamDialog.show();
cameraListStore.load({params:{cam_sources:'ipv'}});
};
function addAnalogCam(){
if( addAnalogCamDialog == null ){
addAnalogCamDialog = new Ext.Window({
modal: true,
title: '<?=$Labels->GetLabel('_ANAL_SOURCES_LST_');?>',
width: 800,
height: 600,
layout: 'fit',
closeAction: 'hide',
items:[{
xtype: 'grid',
frame: false,
border: false,
ds: cameraListStore,
cm: AnalogCameraListColModel,
sm: AnalogCameraListSelModel,
viewConfig: {
forceFit: true
}
}],
bbar: [{
text: '<?=$Labels->GetLabel('_CANCEL_');?>',
handler: function(){
addAnalogCamDialog.hide();
}
},'->',{
id: 'cha_an_strim_set',
text: '<?=$Labels->GetLabel('_SETTINGS_');?>',
disabled: ( SelectedSource == 0 ),
handler: function(){
editAnalogStream( SelectedSource );
}
},{
id: 'con_to_anal_src',
text: '<?=$Labels->GetLabel('_CONNECT_2_SEL_');?>',
disabled: ( SelectedSource == 0 ),
handler: function(){
//alert( 'Cam Type:'+SelectedCamTYPE );
showAnalCamPropDialog();
}
}]
});
};
addAnalogCamDialog.show();
cameraListStore.load({params:{cam_sources:'anal'}});
};
var changer_locked = false;
function changeASS( stream, id ){
if(changer_locked) return;
changer_locked = true;
var ll = Ext.getCmp( id );
var name = ll.name;
var value = ll.getValue();
Ext.Ajax.request({
url: '/lib/controller/setAnalogStreamCtrl.php',
params: {
STREAM: stream,
PID: name,
VALUE: value,
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
},
success: function( response, opts ){
changer_locked = false;
// If the response is JSON, you have to decode it
//var data = Ext.decode(response.responseText);
},
failure: failureAJAXFunction
});
};
var AnalogStreamEditor = null;
function editAnalogStream( SelStream, live=0 ){
if( AnalogStreamEditor == null ){
AnalogStreamEditor = new Ext.Window({
modal: ((live==0)?true:false),
title: 'Analog Input Settings',
width: 440,
height: 400,
layout: 'fit',
closeAction: 'hide',
buttonAlign:'center',
items:[{
}],
bbar: ['->',{
text: '<?=$Labels->GetLabel('_CLOSE_');?>',
handler: function(){//discoverOnvifSources
AnalogStreamEditor.hide();
}
}]
});
};
AnalogStreamEditor.show();
Ext.Ajax.request({
url: '/lib/controller/getAnalogStreamCtrl.php',
params: {
STREAM: SelStream,
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
},
success: function( response, opts ){
// If the response is JSON, you have to decode it
var data = Ext.decode(response.responseText);
AnalogStreamEditor.removeAll( true );
AnalogStreamEditor.add( data );
AnalogStreamEditor.doLayout();
},
failure: failureAJAXFunction
});
};