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.
505 lines
13 KiB
505 lines
13 KiB
//<?php require_once('../../js_asm.php'); ?>
|
|
|
|
var netwodkData = {
|
|
edges: null,
|
|
nodes: null
|
|
};
|
|
|
|
var selectedSite = 0;
|
|
|
|
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: 'int'
|
|
},{
|
|
name: 'ip',
|
|
type: 'string'
|
|
},{
|
|
name: 'mac',
|
|
type: 'string'
|
|
}],
|
|
proxy : new Ext.data.HttpProxy({
|
|
method: 'POST',
|
|
prettyUrls: false,
|
|
url: '/lib/controller/listDiscoveredCameraSources.php',
|
|
headers: {
|
|
'UID': '<?=$CUser->Data['id'];?>',
|
|
'SID': '<?=$Session;?>'
|
|
}
|
|
})
|
|
});
|
|
|
|
var SelectedCam = 0;
|
|
|
|
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 cameraListSelModel = new Ext.grid.RowSelectionModel({
|
|
singleSelect: true,
|
|
listeners: {
|
|
rowselect: function(sm, row, rec) {
|
|
SelectedCam = rec.data.id;
|
|
var CB = Ext.getCmp('con_to_src');
|
|
CB.enable();
|
|
}
|
|
}
|
|
});
|
|
|
|
var SelectedSource = 0;
|
|
var sourceListSelModel = new Ext.grid.RowSelectionModel({
|
|
singleSelect: true,
|
|
listeners: {
|
|
rowselect: function(sm, row, rec) {
|
|
SelectedSource = rec.data.id;
|
|
//document.getElementById('pic_prev').src = '/lib/controller/getVideoFeed.php?UID=<?=$CUser->Data['id'];?>&SID<?=$Session;?>&AUX=200&FID='+SelectedSource;
|
|
document.getElementById('pic_prev').src = '/lib/controller/getVideoFeed.php?UID=<?=$CUser->Data['id'];?>&SID<?=$Session;?>&FID='+SelectedSource;
|
|
}
|
|
}
|
|
});
|
|
|
|
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 cameraListColModel = 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 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: function( response, opts ) {
|
|
//Ext.fly('some_div').update('Fail!');
|
|
}/*,
|
|
callback: function(options,success,response){
|
|
// use this if you need to perform your own success/failure checking
|
|
}*/
|
|
});
|
|
};
|
|
|
|
function preloadOnvifCredentials( SelectedCam ){
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/getOnvifCredentials.php',
|
|
params: {
|
|
CID: SelectedCam,
|
|
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('zigzag').disable();
|
|
sourceListStore.loadData( data, false );
|
|
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('zigzag').enable();
|
|
sourceListStore.removeAll();
|
|
};
|
|
},
|
|
failure: function( response, opts ) {
|
|
Ext.getCmp('cam_login').setValue('');
|
|
Ext.getCmp('cam_password').setValue('');
|
|
Ext.getCmp('zigzag').enable();
|
|
sourceListStore.removeAll();
|
|
}
|
|
});
|
|
};
|
|
|
|
function discoverOnvifProfiles( CamID, camUser, camPasswd ){
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/listAndDiscoverOnvifProfiles.php',
|
|
params: {
|
|
NID: 0,
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>',
|
|
CID: CamID,
|
|
GUG: camUser,
|
|
GOG: camPasswd
|
|
},
|
|
success: function( response, opts ){
|
|
var data = Ext.decode( response.responseText );
|
|
if( data['success'] == true ){
|
|
sourceListStore.loadData( data, false );
|
|
document.getElementById('pic_prev').src = '/lib/controller/getVideoFeed.php?UID=<?=$CUser->Data['id'];?>&SID<?=$Session;?>&FID='+data.nodes[0].id;
|
|
} else {
|
|
Ext.Msg.show({
|
|
title:'Error Message',
|
|
msg: data['error'],
|
|
buttons: Ext.Msg.OK,//YESNOCANCEL,
|
|
//fn: processResult,
|
|
//animEl: 'elId',
|
|
icon: Ext.MessageBox.ERROR //QUESTION
|
|
});
|
|
};
|
|
Ext.getCmp('zigzag').getEl().unmask();
|
|
},
|
|
failure: function( response, opts ) {
|
|
//Ext.fly('some_div').update('Fail!');
|
|
}/*,
|
|
callback: function(options,success,response){
|
|
// use this if you need to perform your own success/failure checking
|
|
}*/
|
|
});
|
|
};
|
|
|
|
var connectOnvifDialog = null;
|
|
var addDialog = null;
|
|
var SelectedCamPTZ = false;
|
|
function connectToSeleced(){
|
|
if( SelectedCam > 0 ){
|
|
if( connectOnvifDialog == null ){
|
|
connectOnvifDialog = new Ext.Window({
|
|
modal: true,
|
|
title: 'Connect to IP Camera',
|
|
width: 600,
|
|
height: 500,
|
|
layout: 'vbox',
|
|
closeAction: 'hide',
|
|
border: false,
|
|
items:[{
|
|
id: 'zigzag',
|
|
layout: 'table',
|
|
width: '100%',
|
|
border: false,
|
|
disabled: false,
|
|
defaults: {
|
|
// applied to each contained panel
|
|
border: false,
|
|
frame: false,
|
|
bodyStyle: 'padding:10px'
|
|
},
|
|
layoutConfig: {
|
|
tableAttrs: {
|
|
style: {
|
|
width: '100%'
|
|
}
|
|
},
|
|
columns: 3
|
|
},
|
|
items: [{
|
|
colspan: 3,
|
|
html: '<p align="center">Please Provide Camera Access Credentials.</p>'
|
|
},{
|
|
html: '<p align="right">Login:</p>',
|
|
width: 170
|
|
},{
|
|
id: 'cam_login',
|
|
xtype: 'textfield',
|
|
width: 200
|
|
},{
|
|
html: ' ',
|
|
width: 170
|
|
},{
|
|
html: '<p align="right">Password:</p>'
|
|
},{
|
|
id: 'cam_password',
|
|
xtype: 'textfield',
|
|
width: 200,
|
|
inputType: 'password'
|
|
},{
|
|
html: ' '
|
|
},{
|
|
html: ' '
|
|
},{
|
|
xtype: 'button',
|
|
text: 'Connect to Camera',
|
|
width: '100%',
|
|
handler: function(){
|
|
Ext.getCmp('zigzag').getEl().mask("Please wait...","x-mask-loading");
|
|
var User = Ext.getCmp('cam_login').getValue();
|
|
var Passwd = Ext.getCmp('cam_password').getValue();
|
|
discoverOnvifProfiles( SelectedCam, User, Passwd );
|
|
}
|
|
},{
|
|
html: ' '
|
|
}]
|
|
},{
|
|
xtype: 'grid',
|
|
title: 'Streams',
|
|
height: 124,
|
|
disableSelection: true,
|
|
ds: sourceListStore,
|
|
cm: sourceListColModel,
|
|
//sm: sourceListSelModel
|
|
},{
|
|
layout: 'table',
|
|
width: '100%',
|
|
border: false,
|
|
disabled: false,
|
|
defaults: {
|
|
// applied to each contained panel
|
|
border: false,
|
|
frame: false,
|
|
bodyStyle: 'text-align:right;padding-left:10px;padding-right:10px;'
|
|
},
|
|
layoutConfig: {
|
|
tableAttrs: {
|
|
style: {
|
|
width: '100%'
|
|
}
|
|
},
|
|
columns: 6
|
|
},
|
|
items: [{
|
|
html: 'Lon:'
|
|
},{
|
|
id: 'cam_pos_lon',
|
|
xtype: 'textfield',
|
|
width: 70
|
|
},{
|
|
html: 'Lat:'
|
|
},{
|
|
id: 'cam_pos_lat',
|
|
xtype: 'textfield',
|
|
width: 70
|
|
},{
|
|
html: 'Alt:'
|
|
},{
|
|
id: 'cam_pos_alt',
|
|
xtype: 'textfield',
|
|
width: 70
|
|
},{
|
|
html: 'Roll:'
|
|
},{
|
|
id: 'cam_pos_roll',
|
|
xtype: 'textfield',
|
|
width: 70
|
|
},{
|
|
html: 'Pitch:'
|
|
},{
|
|
id: 'cam_pos_pitch',
|
|
xtype: 'textfield',
|
|
width: 70
|
|
},{
|
|
html: 'Yaw:'
|
|
},{
|
|
id: 'cam_pos_yaw',
|
|
xtype: 'textfield',
|
|
width: 70
|
|
}]
|
|
},{
|
|
html: '<center><img width="200px" id="pic_prev" src="/style/img/cam_cap0.png"></center>',
|
|
width: '100%'
|
|
}],bbar:[{
|
|
text: 'Cancel',
|
|
handler: function(){
|
|
//addDialog.close();
|
|
//addDialog = null;
|
|
connectOnvifDialog.hide();
|
|
//connectOnvifDialog = null;
|
|
}
|
|
},'->',{
|
|
text: 'Add Camera to Map',
|
|
handler: function(){
|
|
p_lon = Ext.getCmp('cam_pos_lon').getValue();
|
|
p_lat = Ext.getCmp('cam_pos_lat').getValue();
|
|
p_alt = Ext.getCmp('cam_pos_alt').getValue();
|
|
p_pitch = Ext.getCmp('cam_pos_pitch').getValue();
|
|
p_roll = Ext.getCmp('cam_pos_roll').getValue();
|
|
p_yaw = Ext.getCmp('cam_pos_yaw').getValue();
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/AddCameraNode.php',
|
|
params: {
|
|
NID: <?=$SiteID;?>,
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>',
|
|
CID: SelectedCam,
|
|
LAT: p_lat,
|
|
LON: p_lon,
|
|
ALT: p_alt,
|
|
PCH: p_pitch,
|
|
ROL: p_roll,
|
|
YAW: p_yaw,
|
|
PTZ: ((SelectedCamPTZ)?1:0)
|
|
},
|
|
success: function( response, opts ){
|
|
addDialog.close();
|
|
addDialog = null;
|
|
connectOnvifDialog.close();
|
|
connectOnvifDialog = null;
|
|
},
|
|
failure: function( response, opts ) {
|
|
//Ext.fly('some_div').update('Fail!');
|
|
}/*,
|
|
callback: function(options,success,response){
|
|
// use this if you need to perform your own success/failure checking
|
|
}*/
|
|
});
|
|
}
|
|
}]
|
|
});
|
|
};
|
|
connectOnvifDialog.show();
|
|
preloadOnvifCredentials( SelectedCam );
|
|
};
|
|
};
|
|
|
|
function addIpCam(){
|
|
if( addDialog == null ){
|
|
addDialog = new Ext.Window({
|
|
modal: true,
|
|
title: 'Add IP Camera',
|
|
width: 800,
|
|
height: 600,
|
|
layout: 'fit',
|
|
closeAction: 'hide',
|
|
items:{
|
|
xtype: 'grid',
|
|
ds: cameraListStore,
|
|
cm: cameraListColModel,
|
|
sm: cameraListSelModel,
|
|
//listeners:{
|
|
// beforedestroy: function( t ){
|
|
// addDialog = null;
|
|
// return true;
|
|
// }
|
|
//},
|
|
viewConfig: {
|
|
forceFit: true
|
|
},
|
|
bbar: [{
|
|
text: 'Cancel',
|
|
handler: function(){//discoverOnvifSources
|
|
addDialog.hide();
|
|
}
|
|
},'->',{
|
|
id: 'con_to_src',
|
|
text: 'Connect To Selected',
|
|
disabled: ( SelectedCam == 0 ),
|
|
handler: connectToSeleced
|
|
}]
|
|
}
|
|
});
|
|
};
|
|
addDialog.show();
|
|
cameraListStore.load({params:{start:0, limit:50}});
|
|
};
|
|
var addE2UDialog = null;
|
|
function addEthernet2Uart(){
|
|
if( addE2UDialog == null ){
|
|
addE2UDialog = new Ext.Window({
|
|
modal: true,
|
|
title: 'Add Ethernet To Serial Adapter',
|
|
width: 800,
|
|
height: 600,
|
|
layout: 'fit',
|
|
closeAction: 'hide',
|
|
items:{
|
|
html: '<p>koko</p>',
|
|
bbar: [{
|
|
text: 'Cancel',
|
|
handler: function(){//discoverOnvifSources
|
|
addDialog.hide();
|
|
}
|
|
},'->',{
|
|
id: 'con_to_src',
|
|
text: 'Connect To Selected',
|
|
disabled: ( SelectedCam == 0 ),
|
|
handler: connectToSeleced
|
|
}]
|
|
}
|
|
});
|
|
};
|
|
addE2UDialog.show();
|
|
};
|