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.

1048 lines
27 KiB

6 years ago
​
​
5 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
​
​
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
​
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
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 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
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
5 years ago
​
​
5 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 SelectedCamTYPE = 0;
  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. showCamPropDialog();
  183. Ext.Ajax.request({
  184. url: '/lib/controller/getOnvifCredentials.php',
  185. params: {
  186. CID: SC,
  187. UID: <?=$UserID;?>,
  188. SID: '<?=$Session;?>'
  189. },
  190. success: function( response, opts ){
  191. var data = Ext.decode( response.responseText );
  192. if( data.success ){
  193. Ext.getCmp('cam_login').setValue( data.login );
  194. Ext.getCmp('cam_password').setValue( data.password );
  195. Ext.getCmp('acm_btn').enable();
  196. Ext.getCmp('cac_tab').disable();
  197. Ext.getCmp('lens_tab').enable();
  198. Ext.getCmp('str_tab').enable();
  199. Ext.getCmp('ptz_tab').enable();
  200. Ext.getCmp('loc_tab').enable();
  201. Ext.getCmp('coc_tabs').setActiveTab( 1 );
  202. sourceListStore.loadData( data, false );
  203. var tpic = document.getElementById('pic_prev');
  204. if( tpic != null ) tpic.src = '/lib/controller/getVideoFeed.php?UID=<?=$CUser->Data['id'];?>&SID<?=$Session;?>&FID='+data.nodes[0].id;
  205. //document.getElementById('pic_prev').src = '/lib/controller/getVideoFeed.php?UID=<?=$CUser->Data['id'];?>&SID<?=$Session;?>&FID='+data.nodes[0].id;
  206. } else {
  207. Ext.getCmp('cam_login').setValue('');
  208. Ext.getCmp('cam_password').setValue('');
  209. Ext.getCmp('acm_btn').disable();
  210. Ext.getCmp('cac_tab').enable();
  211. Ext.getCmp('lens_tab').disable();
  212. Ext.getCmp('str_tab').disable();
  213. Ext.getCmp('ptz_tab').disable();
  214. Ext.getCmp('loc_tab').disable();
  215. Ext.getCmp('coc_tabs').setActiveTab( 0 );
  216. sourceListStore.removeAll();
  217. if( data.error != null ){
  218. Ext.Msg.show({
  219. title:'<?=$Labels->GetLabel('Error_Message');?>',
  220. msg: data['error'],
  221. buttons: Ext.Msg.OK,//YESNOCANCEL,
  222. //fn: processResult,
  223. //animEl: 'elId',
  224. icon: Ext.MessageBox.ERROR //QUESTION
  225. });
  226. };
  227. };
  228. },
  229. failure: function( response, opts ) {
  230. Ext.getCmp('cam_login').setValue('');
  231. Ext.getCmp('cam_password').setValue('');
  232. Ext.getCmp('cac_tab').enable();
  233. Ext.getCmp('lens_tab').disable();
  234. Ext.getCmp('str_tab').disable();
  235. Ext.getCmp('ptz_tab').disable();
  236. Ext.getCmp('loc_tab').disable();
  237. Ext.getCmp('coc_tabs').setActiveTab( 0 );
  238. sourceListStore.removeAll();
  239. }
  240. });
  241. };
  242. function discoverOnvifProfiles( CamID, camUser, camPasswd ){
  243. Ext.Ajax.request({
  244. url: '/lib/controller/listAndDiscoverOnvifProfiles.php',
  245. params: {
  246. NID: 0,
  247. UID: <?=$UserID;?>,
  248. SID: '<?=$Session;?>',
  249. CID: CamID,
  250. GUG: camUser,
  251. GOG: camPasswd
  252. },
  253. success: function( response, opts ){
  254. var data = Ext.decode( response.responseText );
  255. Ext.getCmp('cac_tab').getEl().unmask();
  256. if( data['success'] == true ){
  257. Ext.getCmp('acm_btn').enable();
  258. Ext.getCmp('cac_tab').disable();
  259. Ext.getCmp('lens_tab').enable();
  260. Ext.getCmp('str_tab').enable();
  261. Ext.getCmp('ptz_tab').enable();
  262. Ext.getCmp('loc_tab').enable();
  263. Ext.getCmp('coc_tabs').setActiveTab( 1 );
  264. sourceListStore.loadData( data, false );
  265. var tpic = document.getElementById('pic_prev');
  266. if( tpic != null ) tpic.src = '/lib/controller/getVideoFeed.php?UID=<?=$CUser->Data['id'];?>&SID<?=$Session;?>&FID='+data.nodes[0].id;
  267. } else {
  268. Ext.Msg.show({
  269. title:'<?=$Labels->GetLabel('Error_Message');?>',
  270. msg: data['error'],
  271. width: 640,
  272. buttons: Ext.Msg.OK,//YESNOCANCEL,
  273. //fn: processResult,602811123
  274. //animEl: 'elId',
  275. icon: Ext.MessageBox.ERROR //QUESTION
  276. });
  277. };
  278. },
  279. failure: failureAJAXFunction
  280. });
  281. };
  282. var CamPropType = 0;
  283. function showCamPropDialog(){
  284. if( connectCamDialog == null ){
  285. connectCamDialog = new Ext.Window({
  286. modal: true,
  287. title: (CamPropType)?'<?=$Labels->GetLabel('_CON_2_IP_CAM_');?>':'IP Camera Settings',
  288. width: 600,
  289. height: 500,
  290. layout: 'vbox',
  291. closeAction: 'hide',
  292. border: false,
  293. items:[{
  294. id: 'coc_tabs',
  295. xtype: 'tabpanel',
  296. activeTab: 0,
  297. items: [{
  298. title: '<?=$Labels->GetLabel('_CAC_TAB_');?>',
  299. id: 'cac_tab',
  300. layout: 'table',
  301. width: '100%',
  302. border: false,
  303. disabled: false,
  304. defaults: {
  305. border: false,
  306. frame: false,
  307. bodyStyle: 'padding:10px'
  308. },
  309. layoutConfig: {
  310. columns: 3
  311. },
  312. items: [{
  313. colspan: 3,
  314. html: '<p align="center"><?=$Labels->GetLabel('_PROV_CAC_');?></p>'
  315. },{
  316. html: '<p align="right"><?=$Labels->GetLabel('_LOGIN_0_');?></p>',
  317. width: 170
  318. },{
  319. id: 'cam_login',
  320. xtype: 'textfield',
  321. width: 200
  322. },{
  323. html: '&nbsp;'
  324. },{
  325. html: '<p align="right"><?=$Labels->GetLabel('_PASSWORD_0_');?></p>'
  326. },{
  327. id: 'cam_password',
  328. xtype: 'textfield',
  329. inputType: 'password',
  330. width: 200
  331. },{
  332. html: '&nbsp;'
  333. },{
  334. html: '&nbsp;'
  335. },{
  336. xtype: 'button',
  337. text: 'Connect to Camera',
  338. width: '100%',
  339. handler: function(){
  340. Ext.getCmp('cac_tab').getEl().mask("Please wait...","x-mask-loading");
  341. var User = Ext.getCmp('cam_login').getValue();
  342. var Passwd = Ext.getCmp('cam_password').getValue();
  343. discoverOnvifProfiles( SelectedCam, User, Passwd );
  344. }
  345. },{
  346. html: '&nbsp;'
  347. }]
  348. },{
  349. title: '<?=$Labels->GetLabel('_STREAMS_');?>',
  350. id: 'str_tab',
  351. disabled: true,
  352. items:[{
  353. xtype: 'grid',
  354. title: '<?=$Labels->GetLabel('_STREAMS_');?>',
  355. height: 124,
  356. disableSelection: true,
  357. ds: sourceListStore,
  358. cm: sourceListColModel,
  359. sm: sourceListSelModel
  360. },{
  361. height: 300,
  362. id: 'pic_prev',
  363. width: 600,
  364. html: '<center><img height="300px" src="/style/img/cam_cap0.png"></center>'
  365. }]
  366. },{
  367. title: 'Lens Settings',
  368. id: 'lens_tab',
  369. disabled: true,
  370. items:[{
  371. layout: 'table',
  372. layoutConfig: {
  373. columns: 3
  374. },
  375. defaults: {
  376. frame: false,
  377. bodyStyle: 'padding:10px',
  378. border: false
  379. },
  380. items:[{
  381. width: 200,
  382. html: 'Sensor Size'
  383. },{
  384. xtype: 'combo',
  385. fieldLabel: 'Sensor Size',
  386. lazyRender: true,
  387. id: 'sens_size',
  388. mode: 'local',
  389. store: new Ext.data.ArrayStore({
  390. fields: ['size','size_txt'],
  391. data: [
  392. [0,'1/3.6"'],
  393. [1,'1/3.2"'],
  394. [2,'1/3"'],
  395. [3,'1/2.7"'],
  396. [4,'1/2"'],
  397. [5,'1/1.8"'],
  398. [6,'2/3"'],
  399. [7,'1"'],
  400. [8,'4/3"'],
  401. [9,'APS-C'],
  402. [10,'35 mm'],
  403. [11,'645']
  404. ]
  405. }),
  406. valueField: 'size',
  407. displayField: 'size_txt'
  408. },{
  409. html: '&nbsp;'
  410. },{
  411. html: 'Fixed Zoom'
  412. },{
  413. xtype: 'radio',
  414. id: 'no_zoom',
  415. name: 'zoom_ena',
  416. value: 0,
  417. checked: true
  418. },{
  419. html: '&nbsp;'
  420. },{
  421. html: 'Variable Zoom'
  422. },{
  423. xtype: 'radio',
  424. id: 'on_zoom',
  425. hideLabel: false,
  426. fieldLabel: 'Variable Zoom',
  427. html: 'koko',
  428. name: 'zoom_ena',
  429. value: 1,
  430. checked: false,
  431. handler: function( a, c ){
  432. if( c ){
  433. Ext.getCmp('max_foc').enable();
  434. Ext.getCmp('zoom_val').enable();
  435. var mf = Ext.getCmp('min_foc').getValue();
  436. if( mf > 0 ){
  437. Ext.getCmp('max_foc').setValue( mf );
  438. Ext.getCmp('zoom_val').setValue( 1 );
  439. };
  440. } else {
  441. Ext.getCmp('max_foc').disable();
  442. Ext.getCmp('zoom_val').disable();
  443. Ext.getCmp('zoom_disp').update('&nbsp;');
  444. };
  445. }
  446. },{
  447. html: '&nbsp;'
  448. },{
  449. html: 'Min. Focal Length'
  450. },{
  451. xtype: 'numberfield',
  452. id: 'min_foc',
  453. width: '95%',
  454. minValue: 1.0,
  455. maxValue: 270.0
  456. },{
  457. html: '&nbsp;'
  458. },{
  459. html: 'Max. Focal Length'
  460. },{
  461. xtype: 'numberfield',
  462. id: 'max_foc',
  463. width: '95%',
  464. disabled: true,
  465. minValue: 1.0,
  466. maxValue: 270.0,
  467. listeners:{
  468. change: function( a, c, b ){
  469. if( b == c ) return;
  470. var mf = Ext.getCmp('min_foc').getValue();
  471. if( mf > 0 ){
  472. if( c < mf ){
  473. Ext.getCmp('max_foc').setValue( mf );
  474. } else {
  475. var zl = c / mf;
  476. Ext.getCmp('zoom_val').setValue( zl );
  477. };
  478. };
  479. }
  480. }
  481. },{
  482. html: '&nbsp;'
  483. },{
  484. html: 'Zoom Ratio'
  485. },{
  486. xtype: 'slider',
  487. id: 'zoom_val',
  488. disabled: true,
  489. minValue: 1.0,
  490. maxValue: 40.0,
  491. listeners:{
  492. change: function( a, c, b ){
  493. var mf = Ext.getCmp('min_foc').getValue();
  494. if( mf > 0 ){
  495. Ext.getCmp('max_foc').setValue( mf*c );
  496. Ext.getCmp('zoom_disp').update('<p>X&nbsp;'+ c + '</p>');
  497. };
  498. }
  499. }
  500. },{
  501. id: 'zoom_disp',
  502. html: '&nbsp;'
  503. }]
  504. }]
  505. },{
  506. title: '<?=$Labels->GetLabel('_PTZ_TAB_');?>',
  507. id: 'ptz_tab',
  508. disabled: true,
  509. items:[{
  510. layout: 'table',
  511. layoutConfig: {
  512. columns: 3
  513. },
  514. defaults: {
  515. frame: false,
  516. bodyStyle: 'padding:10px',
  517. border: false
  518. },
  519. items:[{
  520. width: 200,
  521. html: 'PTZ Control'
  522. },{
  523. xtype: 'combo',
  524. fieldLabel: 'Ptz Control',
  525. lazyRender: true,
  526. id: 'ptz_proto',
  527. mode: 'local',
  528. store: new Ext.data.ArrayStore({
  529. fields: ['type','type_txt'],
  530. data: [
  531. [0,'No PTZ'],
  532. [1,'Sony VISCA'],
  533. [2,'Pelco-D'],
  534. [3,'OnVif'],
  535. [4,'PSIA'],
  536. [5,'GB/T28181']
  537. ]
  538. }),
  539. valueField: 'type',
  540. displayField: 'type_txt',
  541. listeners:{
  542. change: function( a, c, b ){
  543. if( c > 0 ){
  544. if( c != 3 ){
  545. Ext.getCmp('uart_id').enable();
  546. Ext.getCmp('prot_id').enable();
  547. } else {
  548. Ext.getCmp('uart_id').disable();
  549. Ext.getCmp('prot_id').disable();
  550. };
  551. Ext.getCmp('pan_mode').enable();
  552. Ext.getCmp('tilt_mode').enable();
  553. Ext.getCmp('pan_ang').enable();
  554. Ext.getCmp('tilt_ang').enable();
  555. } else {
  556. Ext.getCmp('uart_id').disable();
  557. Ext.getCmp('prot_id').disable();
  558. Ext.getCmp('pan_mode').disable();
  559. Ext.getCmp('tilt_mode').disable();
  560. Ext.getCmp('pan_ang').disable();
  561. Ext.getCmp('tilt_ang').disable();
  562. };
  563. }
  564. }
  565. },{
  566. html: '&nbsp;'
  567. },{
  568. html: 'UART Port'
  569. },{
  570. xtype: 'combo',
  571. fieldLabel: 'UART Port',
  572. lazyRender: true,
  573. id: 'uart_id',
  574. mode: 'local',
  575. disabled: true,
  576. store: new Ext.data.ArrayStore({
  577. fields: ['uart','uart_txt'],
  578. data: [<?php
  579. $QS="SELECT aux_id, device FROM resources WHERE ( type=1 OR type=129 ) AND site_id={$SiteID} ";
  580. $RR=$DATABASE->Query( $QS );
  581. if( count( $RR ) ){
  582. $RE=array();
  583. foreach( $RR as $R ){
  584. $RE[] = "[ {$R['aux_id']}, '{$R['device']}']";
  585. };
  586. echo implode( ',', $RE );
  587. } else {
  588. echo "[0, 'No UARTS DEFINED']";
  589. };
  590. ?>]
  591. }),
  592. valueField: 'uart',
  593. displayField: 'uart_txt'
  594. },{
  595. html: '&nbsp;'
  596. },{
  597. html: 'Camera ID'
  598. },{
  599. xtype: 'numberfield',
  600. id: 'prot_id',
  601. width: '95%',
  602. disabled: true,
  603. minValue: 0,
  604. maxValue: 255
  605. },{
  606. html: '&nbsp;'
  607. },{
  608. html: 'Pan Model'
  609. },{
  610. xtype: 'combo',
  611. fieldLabel: 'Pan Model',
  612. lazyRender: true,
  613. id: 'pan_mode',
  614. disabled: true,
  615. mode: 'local',
  616. store: new Ext.data.ArrayStore({
  617. fields: ['pm','pm_txt'],
  618. data: [
  619. [0,'Regular'],
  620. [1,'Reversed']
  621. ]
  622. }),
  623. valueField: 'pm',
  624. displayField: 'pm_txt'
  625. },{
  626. html: '&nbsp;'
  627. },{
  628. html: 'Tottal Pan Angles'
  629. },{
  630. xtype: 'numberfield',
  631. id: 'pan_ang',
  632. width: '95%',
  633. disabled: true,
  634. minValue: 0,
  635. maxValue: 360
  636. },{
  637. html: '&nbsp;'
  638. },{
  639. html: 'Tilt Model'
  640. },{
  641. xtype: 'combo',
  642. fieldLabel: 'Tilt Model',
  643. lazyRender: true,
  644. id: 'tilt_mode',
  645. disabled: true,
  646. mode: 'local',
  647. store: new Ext.data.ArrayStore({
  648. fields: ['tm','tm_txt'],
  649. data: [
  650. [0,'Regular'],
  651. [1,'Reversed'],
  652. [2,'Shifted 90°'],
  653. [3,'Rev-Shifted 90°']
  654. ]
  655. }),
  656. valueField: 'tm',
  657. displayField: 'tm_txt'
  658. },{
  659. html: '&nbsp;'
  660. },{
  661. html: 'Tottal Tilt Angles'
  662. },{
  663. xtype: 'numberfield',
  664. id: 'tilt_ang',
  665. width: '95%',
  666. disabled: true,
  667. minValue: 0,
  668. maxValue: 180
  669. },{
  670. html: '&nbsp;'
  671. }]
  672. }]
  673. },{
  674. title: '<?=$Labels->GetLabel('_ADV_TAB_');?>',
  675. disabled: true,
  676. layout: 'table',
  677. id: 'loc_tab',
  678. border: false,
  679. defaults: {
  680. // applied to each contained panel
  681. border: false,
  682. frame: false,
  683. bodyStyle: 'text-align:right;padding-left:10px;padding-right:10px;'
  684. },
  685. layoutConfig: {
  686. columns: 3
  687. },
  688. items: [{
  689. html: '<?=$Labels->GetLabel('_CAM_MAP_NAME_');?>:'
  690. },{
  691. id: 'cam_label',
  692. xtype: 'textfield',
  693. width: 200
  694. },{
  695. html: '&nbsp;'
  696. }]
  697. }]
  698. }],
  699. bbar:[{
  700. text: '<?=$Labels->GetLabel('_CANCEL_');?>',
  701. handler: function(){
  702. //addDialog.close();
  703. //addDialog = null;
  704. connectCamDialog.hide();
  705. //connectOnvifDialog = null;
  706. }
  707. },'->',{
  708. text: 'Add Camera to Map',
  709. id: 'acm_btn',
  710. disabled: true,
  711. handler: function(){
  712. var CLAB = Ext.getCmp('cam_label').getValue();
  713. var CPTZP = Ext.getCmp('ptz_proto').getValue();
  714. var CPTZU = Ext.getCmp('uart_id').getValue();
  715. var CPTZID = Ext.getCmp('prot_id').getValue();
  716. var CPANM = Ext.getCmp('pan_mode').getValue();
  717. var CTILTM = Ext.getCmp('tilt_mode').getValue();
  718. var CPANANG = Ext.getCmp('pan_ang').getValue();
  719. var CTILTANG = Ext.getCmp('tilt_ang').getValue();
  720. var CIMAGER = Ext.getCmp('sens_size').getValue();
  721. var CMINF = Ext.getCmp('min_foc').getValue();
  722. var CMAXF = Ext.getCmp('max_foc').getValue();
  723. var AllOK = true;
  724. if( CLAB == '' ) {
  725. AllOK = false;
  726. Ext.Msg.show({
  727. title:'Data Error!',
  728. msg: 'Please Provide Camera Name!',
  729. buttons: Ext.Msg.OK,
  730. icon: Ext.MessageBox.INFO
  731. });
  732. return;
  733. };
  734. if( SelectedSource == 0 ){
  735. AllOK = false;
  736. Ext.Msg.show({
  737. title:'Data Error!',
  738. msg: 'Please Select Image Source!',
  739. buttons: Ext.Msg.OK,
  740. icon: Ext.MessageBox.INFO
  741. });
  742. return;
  743. };
  744. if( ( SelectedCamTYPE == 11 || SelectedCamTYPE == 13 ) && CPTZP == 0 ){
  745. AllOK = false;
  746. Ext.Msg.show({
  747. title:'Data Error!',
  748. msg: 'Please Provide PTZ Protocol type!',
  749. buttons: Ext.Msg.OK,
  750. icon: Ext.MessageBox.INFO
  751. });
  752. return;
  753. };
  754. if( ( CPTZP == 1 || CPTZP == 2 ) && CPTZU == 0 ){
  755. AllOK = false;
  756. Ext.Msg.show({
  757. title:'Data Error!',
  758. msg: 'Please Provide UART Port!',
  759. buttons: Ext.Msg.OK,
  760. icon: Ext.MessageBox.INFO
  761. });
  762. return;
  763. };
  764. if( ( CPTZP == 1 || CPTZP == 2 ) && CPTZID == 0 ){
  765. AllOK = false;
  766. Ext.Msg.show({
  767. title:'Data Error!',
  768. msg: 'Please Provide Camera ID!',
  769. buttons: Ext.Msg.OK,
  770. icon: Ext.MessageBox.INFO
  771. });
  772. return;
  773. };
  774. if( AllOK ){
  775. Ext.Ajax.request({
  776. url: '/lib/controller/AddCameraNode.php',
  777. params: {
  778. SITEID: <?=$SiteID;?>,
  779. UID: <?=$UserID;?>,
  780. SID: '<?=$Session;?>',
  781. CID: SelectedCam,
  782. STREAM: SelectedSource,
  783. LAB: CLAB,
  784. UART: CPTZU,
  785. PROTOID: CPTZID,
  786. PANMODE: CPANM,
  787. TILTMODE: CTILTM,
  788. PANANG: CPANANG,
  789. TILTANG: CTILTANG,
  790. IMSIZE: CIMAGER,
  791. FMIN: CMINF,
  792. FMAX: CMAXF,
  793. PTZ: CPTZP,
  794. CTYPE: SelectedCamTYPE
  795. },
  796. success: function( response, opts ){
  797. addIpCamDialog.close();
  798. addIpCamDialog = null;
  799. connectCamDialog.close();
  800. connectCamDialog = null;
  801. },
  802. failure: failureAJAXFunction
  803. });
  804. };
  805. }
  806. }]
  807. });
  808. } else {
  809. };
  810. connectCamDialog.show();
  811. };
  812. function connectToSeleced(){
  813. CamPropType = 1;
  814. if( SelectedCam > 0 ){
  815. preloadOnvifCredentials( SelectedCam );
  816. //loadCameraSettings( SelectedCam );
  817. };
  818. };
  819. function addIpCam(){
  820. if( addIpCamDialog == null ){
  821. addIpCamDialog = new Ext.Window({
  822. modal: true,
  823. title: '<?=$Labels->GetLabel('_DET_IP_CAMERA_LST_');?>',
  824. width: 800,
  825. height: 600,
  826. layout: 'fit',
  827. closeAction: 'hide',
  828. items:{
  829. xtype: 'grid',
  830. ds: cameraListStore,
  831. cm: cameraListColModel,
  832. sm: cameraListSelModel,
  833. viewConfig: {
  834. forceFit: true
  835. },
  836. bbar: [{
  837. text: '<?=$Labels->GetLabel('_CANCEL_');?>',
  838. handler: function(){
  839. addIpCamDialog.hide();
  840. }
  841. },'->',{
  842. id: 'con_to_src',
  843. text: '<?=$Labels->GetLabel('_CONNECT_2_SEL_');?>',
  844. disabled: ( SelectedCam == 0 ),
  845. handler: connectToSeleced
  846. }]
  847. }
  848. });
  849. };
  850. addIpCamDialog.show();
  851. cameraListStore.load({params:{start:0, limit:50}});
  852. };
  853. var addAnalogCamDialog = null;
  854. function addAnalogCam(){
  855. if( addAnalogCamDialog == null ){
  856. addAnalogCamDialog = new Ext.Window({
  857. modal: true,
  858. title: '<?=$Labels->GetLabel('_DET_IP_CAMERA_LST_');?>',
  859. width: 800,
  860. height: 600,
  861. layout: 'fit',
  862. closeAction: 'hide',
  863. items:[{
  864. xtype: 'grid',
  865. ds: cameraListStore,
  866. cm: cameraListColModel,
  867. sm: cameraListSelModel,
  868. viewConfig: {
  869. forceFit: true
  870. }
  871. }],
  872. bbar: [{
  873. text: '<?=$Labels->GetLabel('_CANCEL_');?>',
  874. handler: function(){
  875. addIpCamDialog.hide();
  876. }
  877. },'->',{
  878. id: 'con_to_src',
  879. text: '<?=$Labels->GetLabel('_CONNECT_2_SEL_');?>',
  880. disabled: ( SelectedCam == 0 ),
  881. handler: connectToSeleced
  882. }]
  883. });
  884. };
  885. addAnalogCamDialog.show();
  886. };
  887. function addEthernet2Uart(){
  888. if( addE2UDialog == null ){
  889. addE2UDialog = new Ext.Window({
  890. modal: true,
  891. title: 'Add Ethernet To Serial Adapter',
  892. width: 400,
  893. height: 300,
  894. layout: 'fit',
  895. closeAction: 'hide',
  896. items:[{
  897. xtype: 'form',
  898. labelWidth: 120, // label settings here cascade unless overridden
  899. frame: false,
  900. bodyStyle:'padding:5px 5px 0',
  901. defaultType: 'textfield',
  902. items:[{
  903. xtype: 'combo',
  904. fieldLabel: 'Speed',
  905. id: 'ued_speed',
  906. lazyRender:true,
  907. mode: 'local',
  908. store: new Ext.data.ArrayStore({
  909. fields: ['speed'],
  910. data: [[19200], [115200]]
  911. }),
  912. valueField: 'speed',
  913. displayField: 'speed'
  914. },{
  915. xtype: 'combo',
  916. fieldLabel: 'Bits',
  917. id: 'ued_bit',
  918. lazyRender:true,
  919. mode: 'local',
  920. store: new Ext.data.ArrayStore({
  921. fields: ['bits'],
  922. data: [[5],[6],[7],[8],[9]]
  923. }),
  924. valueField: 'bits',
  925. displayField: 'bits'
  926. },{
  927. xtype: 'combo',
  928. fieldLabel: 'Stop Bit',
  929. lazyRender:true,
  930. id: 'ued_stops',
  931. mode: 'local',
  932. store: new Ext.data.ArrayStore({
  933. fields: ['stops'],
  934. data: [[1],[1.5],[2]]
  935. }),
  936. valueField: 'stops',
  937. displayField: 'stops'
  938. },{
  939. xtype: 'combo',
  940. fieldLabel: 'Parity',
  941. lazyRender:true,
  942. id: 'ued_parity',
  943. mode: 'local',
  944. store: new Ext.data.ArrayStore({
  945. fields: ['parity'],
  946. data: [['Odd'], ['Even'],['None']]
  947. }),
  948. valueField: 'parity',
  949. displayField: 'parity'
  950. },{
  951. xtype: 'combo',
  952. fieldLabel: 'Working Mode',
  953. lazyRender: true,
  954. id: 'ued_mode',
  955. mode: 'local',
  956. store: new Ext.data.ArrayStore({
  957. fields: ['mode','mode_txt'],
  958. data: [[0,'UDP Client'], [1,'TCP Client'], [2,'UDP Server'], [3,'TCP Server']]
  959. }),
  960. valueField: 'mode',
  961. displayField: 'mode_txt'
  962. },{
  963. fieldLabel: 'IP Address',
  964. id: 'ued_ip'
  965. },{
  966. fieldLabel: 'IP Port',
  967. id: 'ued_port'
  968. }],
  969. bbar: [{
  970. text: 'Cancel',
  971. handler: function(){//discoverOnvifSources
  972. addE2UDialog.hide();
  973. }
  974. },'->',{
  975. id: 'con_to_src',
  976. text: 'Add Adapter to Site',
  977. disabled: false,
  978. handler: function(){
  979. var SPD = Ext.getCmp('ued_speed').getValue();
  980. var BIT = Ext.getCmp('ued_bit').getValue();
  981. var STP = Ext.getCmp('ued_stops').getValue();
  982. var PAR = Ext.getCmp('ued_parity').getValue();
  983. var MOD = Ext.getCmp('ued_mode').getValue();
  984. var IP = Ext.getCmp('ued_ip').getValue();
  985. var PORT= Ext.getCmp('ued_port').getValue();
  986. Ext.Ajax.request({
  987. url: '/lib/controller/addNetworkNode.php',
  988. params: {
  989. NID: <?=$SiteID;?>,
  990. TYPE: 20,
  991. UART_SPEED: SPD,
  992. UART_BITS: BIT,
  993. UART_STOP: STP,
  994. UART_PAR: PAR,
  995. UART_MODE: MOD,
  996. UART_IP: IP,
  997. UART_PORT: PORT,
  998. UID: <?=$UserID;?>,
  999. SID: '<?=$Session;?>'
  1000. },
  1001. success: function( response, opts ){
  1002. var data = Ext.decode(response.responseText);
  1003. if( data.sucess == false ){
  1004. Ext.Msg.show({
  1005. title:'Request Failure!',
  1006. msg: data.error,
  1007. buttons: Ext.Msg.OK,
  1008. icon: Ext.MessageBox.INFO
  1009. });
  1010. } else {
  1011. loadSystemEditor();
  1012. };
  1013. addE2UDialog.hide();
  1014. },
  1015. failure: function( response, opts ) {
  1016. failureAJAXFunction( response, opts );
  1017. addE2UDialog.hide();
  1018. }
  1019. });
  1020. }
  1021. }]
  1022. }]
  1023. });
  1024. };
  1025. addE2UDialog.show();
  1026. };