Web UI for ARGUS server
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.

956 lines
25 KiB

6 years ago
​
​
5 years ago
​
​
​
​
​
​
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
6 years ago
​
​
​
​
​
​
5 years ago
6 years ago
5 years ago
6 years ago
​
5 years ago
6 years ago
5 years ago
6 years ago
​
5 years ago
6 years ago
5 years ago
6 years ago
​
​
​
​
​
​
5 years ago
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
​
​
5 years ago
6 years ago
​
​
5 years ago
6 years ago
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
6 years ago
5 years ago
6 years ago
​
​
5 years ago
​
​
​
​
​
​
6 years ago
5 years ago
​
​
​
​
​
​
​
​
​
6 years ago
​
​
​
​
5 years ago
​
​
​
​
​
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
6 years ago
5 years ago
6 years ago
5 years ago
6 years ago
​
​
​
5 years ago
6 years ago
5 years ago
6 years ago
​
​
5 years ago
​
​
​
​
6 years ago
5 years ago
6 years ago
​
​
​
​
​
5 years ago
​
​
6 years ago
5 years ago
​
​
6 years ago
​
5 years ago
​
​
​
​
6 years ago
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
5 years ago
​
​
6 years ago
​
​
5 years ago
6 years ago
​
​
​
5 years ago
​
6 years ago
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
​
5 years ago
​
​
​
​
​
​
​
​
​
​
6 years ago
5 years ago
6 years ago
​
​
​
5 years ago
​
6 years ago
5 years ago
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
6 years ago
​
​
5 years ago
6 years ago
​
​
​
​
​
5 years ago
6 years ago
​
5 years ago
6 years ago
​
​
​
​
​
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
​
6 years ago
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
6 years ago
​
​
​
  1. //<?php require_once('../../js_asm.php'); ?>
  2. var SelectedCam = 0;
  3. var SelectedSource = 0;
  4. var SelectedCamPTZ = false;
  5. var connectCamDialog = null;
  6. var addIpCamDialog = null;
  7. var addE2UDialog = null;
  8. var cameraListStore = new Ext.data.JsonStore({
  9. root: 'nodes',
  10. totalProperty: 'totalCount',
  11. idProperty: 'id',
  12. remoteSort: true,
  13. fields: [{
  14. name: 'id',
  15. type: 'int'
  16. },{
  17. name: 'name',
  18. type: 'string'
  19. },{
  20. name: 'hardware',
  21. type: 'string'
  22. },{
  23. name: 'caps',
  24. type: 'int'
  25. },{
  26. name: 'ip',
  27. type: 'string'
  28. },{
  29. name: 'mac',
  30. type: 'string'
  31. }],
  32. proxy : new Ext.data.HttpProxy({
  33. method: 'POST',
  34. prettyUrls: false,
  35. url: '/lib/controller/listDiscoveredCameraSources.php',
  36. headers: {
  37. 'UID': '<?=$CUser->Data['id'];?>',
  38. 'SID': '<?=$Session;?>'
  39. }
  40. })
  41. });
  42. var sourceListStore = new Ext.data.JsonStore({
  43. root: 'nodes',
  44. totalProperty: 'totalCount',
  45. idProperty: 'id',
  46. remoteSort: true,
  47. fields: [{
  48. name: 'id',
  49. type: 'int'
  50. },{
  51. name: 'name',
  52. type: 'string'
  53. },{
  54. name: 'encode',
  55. type: 'string'
  56. },{
  57. name: 'bitrate',
  58. type: 'int'
  59. },{
  60. name: 'size',
  61. type: 'string'
  62. }]
  63. });
  64. var cameraListSelModel = new Ext.grid.RowSelectionModel({
  65. singleSelect: true,
  66. listeners: {
  67. rowselect: function(sm, row, rec) {
  68. SelectedCam = rec.data.id;
  69. var CB = Ext.getCmp('con_to_src');
  70. CB.enable();
  71. }
  72. }
  73. });
  74. var sourceListSelModel = new Ext.grid.RowSelectionModel({
  75. singleSelect: true,
  76. listeners: {
  77. rowselect: function(sm, row, rec) {
  78. SelectedSource = rec.data.id;
  79. Ext.getCmp('pic_prev').update( '<center><img height="300px" src="/lib/controller/getVideoFeed.php?UID=<?=$CUser->Data['id'];?>&SID=<?=$Session;?>&FID='+SelectedSource+'"></center>' );
  80. }
  81. }
  82. });
  83. function camCapRenderer(val){
  84. var p1, p2, p3;
  85. if( ( val & 1 ) == 1 ){
  86. p1 = '<img src="/style/img/cam_cap3.png" alt="Video Source">';
  87. } else {
  88. p1 = '<img src="/style/img/cam_cap0.png" alt="NO Video Source">';
  89. };
  90. if( ( val & 2 ) == 2 ){
  91. p2 = '<img src="/style/img/cam_cap2.png" alt="Audio Source">';
  92. } else {
  93. p2 = '<img src="/style/img/cam_cap0.png" alt="NO Audio Source">';
  94. };
  95. if( ( val & 4 ) == 4 ){
  96. p3 = '<img src="/style/img/cam_cap1.png" alt="PTZ Control">';
  97. } else {
  98. p3 = '<img src="/style/img/cam_cap0.png" alt="NO PTZ Control">';
  99. };
  100. return p1+p2+p3;
  101. };
  102. var cameraListColModel = new Ext.grid.ColumnModel({
  103. columns: [
  104. {header: "id", width: 50, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' },
  105. {header: "Type",width: 60, sortable: false, fixed: true, menuDisabled: true, renderer: camCapRenderer, dataIndex: 'caps' },
  106. {header: "IP Address", width: 120, sortable: false, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'ip' },
  107. {header: "MAC", width: 120, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'mac' },
  108. {header: "Name", dataIndex: 'name' },
  109. {header: "HW", menuDisabled: true, dataIndex: 'hardware' }
  110. ],
  111. defaults: {
  112. sortable: true,
  113. menuDisabled: true,
  114. width: 100
  115. },
  116. listeners: {
  117. hiddenchange: function(cm, colIndex, hidden) {
  118. //saveConfig(colIndex, hidden);
  119. }
  120. }
  121. });
  122. var sourceListColModel = new Ext.grid.ColumnModel({
  123. columns: [
  124. {header: "id", width: 50, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' },
  125. {header: "Name", dataIndex: 'name' },
  126. {header: "Encoding",width: 120, sortable: false, fixed: true, menuDisabled: true, dataIndex: 'encode' },
  127. {header: "Frame", width: 120, sortable: false, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'size' },
  128. {header: "Bitrate", width: 80, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'bitrate' }
  129. ],
  130. defaults: {
  131. sortable: false,
  132. menuDisabled: true,
  133. width: 100
  134. },
  135. listeners: {
  136. hiddenchange: function(cm, colIndex, hidden) {
  137. //saveConfig(colIndex, hidden);
  138. }
  139. }
  140. });
  141. function discoverOnvifSources(){
  142. Ext.Ajax.request({
  143. url: '/lib/controller/listAndDiscoverOnvifSources.php',
  144. params: {
  145. NID: 0,
  146. UID: <?=$UserID;?>,
  147. SID: '<?=$Session;?>'
  148. },
  149. success: function( response, opts ){
  150. cameraListStore.reload();
  151. },
  152. failure: failureAJAXFunction
  153. });
  154. };
  155. function loadCameraSettings( SC ){
  156. Ext.Ajax.request({
  157. url: '/lib/controller/getCameraSettings.php',
  158. params: {
  159. CID: SC,
  160. UID: <?=$UserID;?>,
  161. SID: '<?=$Session;?>'
  162. },
  163. success: function( response, opts ){
  164. var data = Ext.decode( response.responseText );
  165. if( data.success ){
  166. } else {
  167. };
  168. },
  169. failure: function( response, opts ) {
  170. Ext.getCmp('cam_login').setValue('');
  171. Ext.getCmp('cam_password').setValue('');
  172. Ext.getCmp('cac_tab').enable();
  173. Ext.getCmp('str_tab').disable();
  174. Ext.getCmp('ptz_tab').disable();
  175. Ext.getCmp('loc_tab').disable();
  176. Ext.getCmp('coc_tabs').setActiveTab( 0 );
  177. sourceListStore.removeAll();
  178. }
  179. });
  180. };
  181. function preloadOnvifCredentials( SC ){
  182. Ext.Ajax.request({
  183. url: '/lib/controller/getOnvifCredentials.php',
  184. params: {
  185. CID: SC,
  186. UID: <?=$UserID;?>,
  187. SID: '<?=$Session;?>'
  188. },
  189. success: function( response, opts ){
  190. var data = Ext.decode( response.responseText );
  191. if( data.success ){
  192. Ext.getCmp('cam_login').setValue( data.login );
  193. Ext.getCmp('cam_password').setValue( data.password );
  194. Ext.getCmp('acm_btn').enable();
  195. Ext.getCmp('cac_tab').disable();
  196. Ext.getCmp('lens_tab').enable();
  197. Ext.getCmp('str_tab').enable();
  198. Ext.getCmp('ptz_tab').enable();
  199. Ext.getCmp('loc_tab').enable();
  200. Ext.getCmp('coc_tabs').setActiveTab( 1 );
  201. sourceListStore.loadData( data, false );
  202. //document.getElementById('pic_prev').src = '/lib/controller/getVideoFeed.php?UID=<?=$CUser->Data['id'];?>&SID<?=$Session;?>&FID='+data.nodes[0].id;
  203. } else {
  204. Ext.getCmp('cam_login').setValue('');
  205. Ext.getCmp('cam_password').setValue('');
  206. Ext.getCmp('acm_btn').disable();
  207. Ext.getCmp('cac_tab').enable();
  208. Ext.getCmp('lens_tab').disable();
  209. Ext.getCmp('str_tab').disable();
  210. Ext.getCmp('ptz_tab').disable();
  211. Ext.getCmp('loc_tab').disable();
  212. Ext.getCmp('coc_tabs').setActiveTab( 0 );
  213. sourceListStore.removeAll();
  214. if( data.error != null ){
  215. Ext.Msg.show({
  216. title:'<?=$Labels->GetLabel('Error_Message');?>',
  217. msg: data['error'],
  218. buttons: Ext.Msg.OK,//YESNOCANCEL,
  219. //fn: processResult,
  220. //animEl: 'elId',
  221. icon: Ext.MessageBox.ERROR //QUESTION
  222. });
  223. };
  224. };
  225. },
  226. failure: function( response, opts ) {
  227. Ext.getCmp('cam_login').setValue('');
  228. Ext.getCmp('cam_password').setValue('');
  229. Ext.getCmp('cac_tab').enable();
  230. Ext.getCmp('lens_tab').disable();
  231. Ext.getCmp('str_tab').disable();
  232. Ext.getCmp('ptz_tab').disable();
  233. Ext.getCmp('loc_tab').disable();
  234. Ext.getCmp('coc_tabs').setActiveTab( 0 );
  235. sourceListStore.removeAll();
  236. }
  237. });
  238. };
  239. function discoverOnvifProfiles( CamID, camUser, camPasswd ){
  240. Ext.Ajax.request({
  241. url: '/lib/controller/listAndDiscoverOnvifProfiles.php',
  242. params: {
  243. NID: 0,
  244. UID: <?=$UserID;?>,
  245. SID: '<?=$Session;?>',
  246. CID: CamID,
  247. GUG: camUser,
  248. GOG: camPasswd
  249. },
  250. success: function( response, opts ){
  251. var data = Ext.decode( response.responseText );
  252. if( data['success'] == true ){
  253. sourceListStore.loadData( data, false );
  254. document.getElementById('pic_prev').src = '/lib/controller/getVideoFeed.php?UID=<?=$CUser->Data['id'];?>&SID<?=$Session;?>&FID='+data.nodes[0].id;
  255. } else {
  256. Ext.Msg.show({
  257. title:'<?=$Labels->GetLabel('Error_Message');?>',
  258. msg: data['error'],
  259. width: 640,
  260. buttons: Ext.Msg.OK,//YESNOCANCEL,
  261. //fn: processResult,602811123
  262. //animEl: 'elId',
  263. icon: Ext.MessageBox.ERROR //QUESTION
  264. });
  265. };
  266. Ext.getCmp('cac_tab').getEl().unmask();
  267. },
  268. failure: failureAJAXFunction
  269. });
  270. };
  271. var CamPropType = 0;
  272. function showCamPropDialog(){
  273. if( connectCamDialog == null ){
  274. connectCamDialog = new Ext.Window({
  275. modal: true,
  276. title: (CamPropType)?'<?=$Labels->GetLabel('_CON_2_IP_CAM_');?>':'IP Camera Settings',
  277. width: 600,
  278. height: 500,
  279. layout: 'vbox',
  280. closeAction: 'hide',
  281. border: false,
  282. items:[{
  283. id: 'coc_tabs',
  284. xtype: 'tabpanel',
  285. activeTab: 0,
  286. items: [{
  287. title: '<?=$Labels->GetLabel('_CAC_TAB_');?>',
  288. id: 'cac_tab',
  289. layout: 'table',
  290. width: '100%',
  291. border: false,
  292. disabled: false,
  293. defaults: {
  294. border: false,
  295. frame: false,
  296. bodyStyle: 'padding:10px'
  297. },
  298. layoutConfig: {
  299. columns: 3
  300. },
  301. items: [{
  302. colspan: 3,
  303. html: '<p align="center"><?=$Labels->GetLabel('_PROV_CAC_');?></p>'
  304. },{
  305. html: '<p align="right"><?=$Labels->GetLabel('_LOGIN_0_');?></p>',
  306. width: 170
  307. },{
  308. id: 'cam_login',
  309. xtype: 'textfield',
  310. width: 200
  311. },{
  312. html: '&nbsp;'
  313. },{
  314. html: '<p align="right"><?=$Labels->GetLabel('_PASSWORD_0_');?></p>'
  315. },{
  316. id: 'cam_password',
  317. xtype: 'textfield',
  318. inputType: 'password',
  319. width: 200
  320. },{
  321. html: '&nbsp;'
  322. },{
  323. html: '&nbsp;'
  324. },{
  325. xtype: 'button',
  326. text: 'Connect to Camera',
  327. width: '100%',
  328. handler: function(){
  329. Ext.getCmp('cac_tab').getEl().mask("Please wait...","x-mask-loading");
  330. var User = Ext.getCmp('cam_login').getValue();
  331. var Passwd = Ext.getCmp('cam_password').getValue();
  332. discoverOnvifProfiles( SelectedCam, User, Passwd );
  333. }
  334. },{
  335. html: '&nbsp;'
  336. }]
  337. },{
  338. title: '<?=$Labels->GetLabel('_STREAMS_');?>',
  339. id: 'str_tab',
  340. disabled: true,
  341. items:[{
  342. xtype: 'grid',
  343. title: '<?=$Labels->GetLabel('_STREAMS_');?>',
  344. height: 124,
  345. disableSelection: true,
  346. ds: sourceListStore,
  347. cm: sourceListColModel,
  348. sm: sourceListSelModel
  349. },{
  350. height: 300,
  351. id: 'pic_prev',
  352. width: 600,
  353. html: '<center><img height="300px" src="/style/img/cam_cap0.png"></center>'
  354. }]
  355. },{
  356. title: 'Lens Settings',
  357. id: 'lens_tab',
  358. disabled: true,
  359. items:[{
  360. layout: 'table',
  361. layoutConfig: {
  362. columns: 3
  363. },
  364. defaults: {
  365. frame: false,
  366. bodyStyle: 'padding:10px',
  367. border: false
  368. },
  369. items:[{
  370. width: 200,
  371. html: 'Sensor Size'
  372. },{
  373. xtype: 'combo',
  374. fieldLabel: 'Sensor Size',
  375. lazyRender: true,
  376. id: 'sens_size',
  377. mode: 'local',
  378. store: new Ext.data.ArrayStore({
  379. fields: ['size','size_txt'],
  380. data: [
  381. [0,'1/3.6"'],
  382. [1,'1/3.2"'],
  383. [2,'1/3"'],
  384. [3,'1/2.7"'],
  385. [4,'1/2"'],
  386. [5,'1/1.8"'],
  387. [6,'2/3"'],
  388. [7,'1"'],
  389. [8,'4/3"'],
  390. [9,'APS-C'],
  391. [10,'35 mm'],
  392. [11,'645']
  393. ]
  394. }),
  395. valueField: 'size',
  396. displayField: 'size_txt'
  397. },{
  398. html: '&nbsp;'
  399. },{
  400. html: 'Fixed Zoom'
  401. },{
  402. xtype: 'radio',
  403. id: 'no_zoom',
  404. name: 'zoom_ena',
  405. value: 0,
  406. checked: true
  407. },{
  408. html: '&nbsp;'
  409. },{
  410. html: 'Variable Zoom'
  411. },{
  412. xtype: 'radio',
  413. id: 'on_zoom',
  414. hideLabel: false,
  415. fieldLabel: 'Variable Zoom',
  416. html: 'koko',
  417. name: 'zoom_ena',
  418. value: 1,
  419. checked: false,
  420. handler: function( a, c ){
  421. if( c ){
  422. Ext.getCmp('max_foc').enable();
  423. Ext.getCmp('zoom_val').enable();
  424. var mf = Ext.getCmp('min_foc').getValue();
  425. if( mf > 0 ){
  426. Ext.getCmp('max_foc').setValue( mf );
  427. Ext.getCmp('zoom_val').setValue( 1 );
  428. };
  429. } else {
  430. Ext.getCmp('max_foc').disable();
  431. Ext.getCmp('zoom_val').disable();
  432. Ext.getCmp('zoom_disp').update('&nbsp;');
  433. };
  434. }
  435. },{
  436. html: '&nbsp;'
  437. },{
  438. html: 'Min. Focal Length'
  439. },{
  440. xtype: 'numberfield',
  441. id: 'min_foc',
  442. width: '95%',
  443. minValue: 1.0,
  444. maxValue: 270.0
  445. },{
  446. html: '&nbsp;'
  447. },{
  448. html: 'Max. Focal Length'
  449. },{
  450. xtype: 'numberfield',
  451. id: 'max_foc',
  452. width: '95%',
  453. disabled: true,
  454. minValue: 1.0,
  455. maxValue: 270.0,
  456. listeners:{
  457. change: function( a, c, b ){
  458. if( b == c ) return;
  459. var mf = Ext.getCmp('min_foc').getValue();
  460. if( mf > 0 ){
  461. if( c < mf ){
  462. Ext.getCmp('max_foc').setValue( mf );
  463. } else {
  464. var zl = c / mf;
  465. Ext.getCmp('zoom_val').setValue( zl );
  466. };
  467. };
  468. }
  469. }
  470. },{
  471. html: '&nbsp;'
  472. },{
  473. html: 'Zoom Ratio'
  474. },{
  475. xtype: 'slider',
  476. id: 'zoom_val',
  477. disabled: true,
  478. minValue: 1.0,
  479. maxValue: 40.0,
  480. listeners:{
  481. change: function( a, c, b ){
  482. var mf = Ext.getCmp('min_foc').getValue();
  483. if( mf > 0 ){
  484. Ext.getCmp('max_foc').setValue( mf*c );
  485. Ext.getCmp('zoom_disp').update('<p>X&nbsp;'+ c + '</p>');
  486. };
  487. }
  488. }
  489. },{
  490. id: 'zoom_disp',
  491. html: '&nbsp;'
  492. }]
  493. }]
  494. },{
  495. title: '<?=$Labels->GetLabel('_PTZ_TAB_');?>',
  496. id: 'ptz_tab',
  497. disabled: true,
  498. items:[{
  499. layout: 'table',
  500. layoutConfig: {
  501. columns: 3
  502. },
  503. defaults: {
  504. frame: false,
  505. bodyStyle: 'padding:10px',
  506. border: false
  507. },
  508. items:[{
  509. width: 200,
  510. html: 'PTZ Control'
  511. },{
  512. xtype: 'combo',
  513. fieldLabel: 'Ptz Control',
  514. lazyRender: true,
  515. id: 'ptz_proto',
  516. mode: 'local',
  517. store: new Ext.data.ArrayStore({
  518. fields: ['type','type_txt'],
  519. data: [
  520. [0,'No PTZ'],
  521. [1,'Sony VISCA'],
  522. [2,'Pelco-D'],
  523. [3,'OnVif'],
  524. [4,'PSIA'],
  525. [5,'GB/T28181']
  526. ]
  527. }),
  528. valueField: 'type',
  529. displayField: 'type_txt',
  530. listeners:{
  531. change: function( a, c, b ){
  532. if( c > 0 ){
  533. if( c != 3 ){
  534. Ext.getCmp('uart_id').enable();
  535. Ext.getCmp('prot_id').enable();
  536. } else {
  537. Ext.getCmp('uart_id').disable();
  538. Ext.getCmp('prot_id').disable();
  539. };
  540. Ext.getCmp('pan_mode').enable();
  541. Ext.getCmp('tilt_mode').enable();
  542. Ext.getCmp('pan_ang').enable();
  543. Ext.getCmp('tilt_ang').enable();
  544. } else {
  545. Ext.getCmp('uart_id').disable();
  546. Ext.getCmp('prot_id').disable();
  547. Ext.getCmp('pan_mode').disable();
  548. Ext.getCmp('tilt_mode').disable();
  549. Ext.getCmp('pan_ang').disable();
  550. Ext.getCmp('tilt_ang').disable();
  551. };
  552. }
  553. }
  554. },{
  555. html: '&nbsp;'
  556. },{
  557. html: 'UART Port'
  558. },{
  559. xtype: 'combo',
  560. fieldLabel: 'UART Port',
  561. lazyRender: true,
  562. id: 'uart_id',
  563. mode: 'local',
  564. disabled: true,
  565. store: new Ext.data.ArrayStore({
  566. fields: ['uart','uart_txt'],
  567. data: [
  568. <?php
  569. $QS="SELECT sc.aux_id, CONCAT( nd.name, \":\", sc.name ) as name FROM sockets sc LEFT JOIN nodes nd ON ( sc.node_id = nd.id ) WHERE sc.type = {$SiteID} AND nd.site_id = 1 AND ( nd.type = 0 OR nd.type = 20 )";
  570. $R = $DATABASE->Query( $QS );
  571. $P = array();
  572. foreach( $R as $RR ){
  573. $P[] = "[{$RR['aux_id']}, '{$RR['name']}']";
  574. };
  575. echo implode( ",", $P );
  576. ?>
  577. ]
  578. }),
  579. valueField: 'uart',
  580. displayField: 'uart_txt'
  581. },{
  582. html: '&nbsp;'
  583. },{
  584. html: 'Camera ID'
  585. },{
  586. xtype: 'numberfield',
  587. id: 'prot_id',
  588. width: '95%',
  589. disabled: true,
  590. minValue: 0,
  591. maxValue: 255
  592. },{
  593. html: '&nbsp;'
  594. },{
  595. html: 'Pan Model'
  596. },{
  597. xtype: 'combo',
  598. fieldLabel: 'Pan Model',
  599. lazyRender: true,
  600. id: 'pan_mode',
  601. disabled: true,
  602. mode: 'local',
  603. store: new Ext.data.ArrayStore({
  604. fields: ['pm','pm_txt'],
  605. data: [
  606. [0,'Regular'],
  607. [1,'Reversed']
  608. ]
  609. }),
  610. valueField: 'pm',
  611. displayField: 'pm_txt'
  612. },{
  613. html: '&nbsp;'
  614. },{
  615. html: 'Tottal Pan Angles'
  616. },{
  617. xtype: 'numberfield',
  618. id: 'pan_ang',
  619. width: '95%',
  620. disabled: true,
  621. minValue: 0,
  622. maxValue: 360
  623. },{
  624. html: '&nbsp;'
  625. },{
  626. html: 'Tilt Model'
  627. },{
  628. xtype: 'combo',
  629. fieldLabel: 'Tilt Model',
  630. lazyRender: true,
  631. id: 'tilt_mode',
  632. disabled: true,
  633. mode: 'local',
  634. store: new Ext.data.ArrayStore({
  635. fields: ['tm','tm_txt'],
  636. data: [
  637. [0,'Regular'],
  638. [1,'Reversed'],
  639. [2,'Shifted 90°'],
  640. [3,'Rev-Shifted 90°']
  641. ]
  642. }),
  643. valueField: 'tm',
  644. displayField: 'tm_txt'
  645. },{
  646. html: '&nbsp;'
  647. },{
  648. html: 'Tottal Tilt Angles'
  649. },{
  650. xtype: 'numberfield',
  651. id: 'tilt_ang',
  652. width: '95%',
  653. disabled: true,
  654. minValue: 0,
  655. maxValue: 180
  656. },{
  657. html: '&nbsp;'
  658. }]
  659. }]
  660. },{
  661. title: '<?=$Labels->GetLabel('_ADV_TAB_');?>',
  662. disabled: true,
  663. layout: 'table',
  664. id: 'loc_tab',
  665. border: false,
  666. defaults: {
  667. // applied to each contained panel
  668. border: false,
  669. frame: false,
  670. bodyStyle: 'text-align:right;padding-left:10px;padding-right:10px;'
  671. },
  672. layoutConfig: {
  673. columns: 3
  674. },
  675. items: [{
  676. html: '<?=$Labels->GetLabel('_CAM_MAP_NAME_');?>:'
  677. },{
  678. id: 'cam_label',
  679. xtype: 'textfield',
  680. width: 200
  681. },{
  682. html: '&nbsp;'
  683. }]
  684. }]
  685. }],
  686. bbar:[{
  687. text: '<?=$Labels->GetLabel('_CANCEL_');?>',
  688. handler: function(){
  689. //addDialog.close();
  690. //addDialog = null;
  691. connectCamDialog.hide();
  692. //connectOnvifDialog = null;
  693. }
  694. },'->',{
  695. text: 'Add Camera to Map',
  696. id: 'acm_btn',
  697. disabled: true,
  698. handler: function(){
  699. var CLAB = Ext.getCmp('cam_label').getValue();
  700. var CPTZP = Ext.getCmp('ptz_proto').getValue();
  701. var CPTZU = Ext.getCmp('uart_id').getValue();
  702. var CPTZID = Ext.getCmp('prot_id').getValue();
  703. var CPANM = Ext.getCmp('pan_mode').getValue();
  704. var CTILTM = Ext.getCmp('tilt_mode').getValue();
  705. var CPANANG = Ext.getCmp('pan_ang').getValue();
  706. var CTILTANG = Ext.getCmp('tilt_ang').getValue();
  707. var CIMAGER = Ext.getCmp('sens_size').getValue();
  708. var CMINF = Ext.getCmp('min_foc').getValue();
  709. var CMAXF = Ext.getCmp('max_foc').getValue();
  710. if( CLAB != '' ){
  711. Ext.Ajax.request({
  712. url: '/lib/controller/AddCameraNode.php',
  713. params: {
  714. NID: <?=$SiteID;?>,
  715. UID: <?=$UserID;?>,
  716. SID: '<?=$Session;?>',
  717. CID: SelectedCam,
  718. LAB: CLAB,
  719. UART: CPTZU,
  720. PROTOID: CPTZID,
  721. PANMODE: CPANM,
  722. TILTMODE: CTILTM,
  723. PANANG: CPANANG,
  724. TILTANG: CTILTANG,
  725. IMSIZE: CIMAGER,
  726. FMIN: CMINF,
  727. FMAX: CMAXF,
  728. PTZ: CPTZP
  729. },
  730. success: function( response, opts ){
  731. addIpCamDialog.close();
  732. addIpCamDialog = null;
  733. connectCamDialog.close();
  734. connectCamDialog = null;
  735. },
  736. failure: failureAJAXFunction
  737. });
  738. } else {
  739. Ext.Msg.show({
  740. title:'Data Error!',
  741. msg: 'Please Provide Camera Name!',
  742. buttons: Ext.Msg.OK,
  743. icon: Ext.MessageBox.INFO
  744. });
  745. };
  746. }
  747. }]
  748. });
  749. } else {
  750. };
  751. connectCamDialog.show();
  752. };
  753. function connectToSeleced(){
  754. CamPropType = 1;
  755. if( SelectedCam > 0 ){
  756. showCamPropDialog();
  757. preloadOnvifCredentials( SelectedCam );
  758. //loadCameraSettings( SelectedCam );
  759. };
  760. };
  761. function addIpCam(){
  762. if( addIpCamDialog == null ){
  763. addIpCamDialog = new Ext.Window({
  764. modal: true,
  765. title: '<?=$Labels->GetLabel('_DET_IP_CAMERA_LST_');?>',
  766. width: 800,
  767. height: 600,
  768. layout: 'fit',
  769. closeAction: 'hide',
  770. items:{
  771. xtype: 'grid',
  772. ds: cameraListStore,
  773. cm: cameraListColModel,
  774. sm: cameraListSelModel,
  775. viewConfig: {
  776. forceFit: true
  777. },
  778. bbar: [{
  779. text: '<?=$Labels->GetLabel('_CANCEL_');?>',
  780. handler: function(){
  781. addIpCamDialog.hide();
  782. }
  783. },'->',{
  784. id: 'con_to_src',
  785. text: '<?=$Labels->GetLabel('_CONNECT_2_SEL_');?>',
  786. disabled: ( SelectedCam == 0 ),
  787. handler: connectToSeleced
  788. }]
  789. }
  790. });
  791. };
  792. addIpCamDialog.show();
  793. cameraListStore.load({params:{start:0, limit:50}});
  794. };
  795. function addEthernet2Uart(){
  796. if( addE2UDialog == null ){
  797. addE2UDialog = new Ext.Window({
  798. modal: true,
  799. title: 'Add Ethernet To Serial Adapter',
  800. width: 400,
  801. height: 300,
  802. layout: 'fit',
  803. closeAction: 'hide',
  804. items:[{
  805. xtype: 'form',
  806. labelWidth: 120, // label settings here cascade unless overridden
  807. frame: false,
  808. bodyStyle:'padding:5px 5px 0',
  809. defaultType: 'textfield',
  810. items:[{
  811. xtype: 'combo',
  812. fieldLabel: 'Speed',
  813. id: 'ued_speed',
  814. lazyRender:true,
  815. mode: 'local',
  816. store: new Ext.data.ArrayStore({
  817. fields: ['speed'],
  818. data: [[19200], [115200]]
  819. }),
  820. valueField: 'speed',
  821. displayField: 'speed'
  822. },{
  823. xtype: 'combo',
  824. fieldLabel: 'Bits',
  825. id: 'ued_bit',
  826. lazyRender:true,
  827. mode: 'local',
  828. store: new Ext.data.ArrayStore({
  829. fields: ['bits'],
  830. data: [[5],[6],[7],[8],[9]]
  831. }),
  832. valueField: 'bits',
  833. displayField: 'bits'
  834. },{
  835. xtype: 'combo',
  836. fieldLabel: 'Stop Bit',
  837. lazyRender:true,
  838. id: 'ued_stops',
  839. mode: 'local',
  840. store: new Ext.data.ArrayStore({
  841. fields: ['stops'],
  842. data: [[1],[1.5],[2]]
  843. }),
  844. valueField: 'stops',
  845. displayField: 'stops'
  846. },{
  847. xtype: 'combo',
  848. fieldLabel: 'Parity',
  849. lazyRender:true,
  850. id: 'ued_parity',
  851. mode: 'local',
  852. store: new Ext.data.ArrayStore({
  853. fields: ['parity'],
  854. data: [['Odd'], ['Even'],['None']]
  855. }),
  856. valueField: 'parity',
  857. displayField: 'parity'
  858. },{
  859. xtype: 'combo',
  860. fieldLabel: 'Working Mode',
  861. lazyRender: true,
  862. id: 'ued_mode',
  863. mode: 'local',
  864. store: new Ext.data.ArrayStore({
  865. fields: ['mode','mode_txt'],
  866. data: [[0,'UDP Client'], [1,'TCP Client'], [2,'UDP Server'], [3,'TCP Server']]
  867. }),
  868. valueField: 'mode',
  869. displayField: 'mode_txt'
  870. },{
  871. fieldLabel: 'IP Address',
  872. id: 'ued_ip'
  873. },{
  874. fieldLabel: 'IP Port',
  875. id: 'ued_port'
  876. }],
  877. bbar: [{
  878. text: 'Cancel',
  879. handler: function(){//discoverOnvifSources
  880. addE2UDialog.hide();
  881. }
  882. },'->',{
  883. id: 'con_to_src',
  884. text: 'Add Adapter to Site',
  885. disabled: false,
  886. handler: function(){
  887. var SPD = Ext.getCmp('ued_speed').getValue();
  888. var BIT = Ext.getCmp('ued_bit').getValue();
  889. var STP = Ext.getCmp('ued_stops').getValue();
  890. var PAR = Ext.getCmp('ued_parity').getValue();
  891. var MOD = Ext.getCmp('ued_mode').getValue();
  892. var IP = Ext.getCmp('ued_ip').getValue();
  893. var PORT= Ext.getCmp('ued_port').getValue();
  894. Ext.Ajax.request({
  895. url: '/lib/controller/addNetworkNode.php',
  896. params: {
  897. NID: <?=$SiteID;?>,
  898. TYPE: 20,
  899. UART_SPEED: SPD,
  900. UART_BITS: BIT,
  901. UART_STOP: STP,
  902. UART_PAR: PAR,
  903. UART_MODE: MOD,
  904. UART_IP: IP,
  905. UART_PORT: PORT,
  906. UID: <?=$UserID;?>,
  907. SID: '<?=$Session;?>'
  908. },
  909. success: function( response, opts ){
  910. var data = Ext.decode(response.responseText);
  911. if( data.sucess == false ){
  912. Ext.Msg.show({
  913. title:'Request Failure!',
  914. msg: data.error,
  915. buttons: Ext.Msg.OK,
  916. icon: Ext.MessageBox.INFO
  917. });
  918. } else {
  919. loadSystemEditor();
  920. };
  921. addE2UDialog.hide();
  922. },
  923. failure: function( response, opts ) {
  924. failureAJAXFunction( response, opts );
  925. addE2UDialog.hide();
  926. }
  927. });
  928. }
  929. }]
  930. }]
  931. });
  932. };
  933. addE2UDialog.show();
  934. };