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.

1644 lines
43 KiB

6 years ago
​
​
5 years ago
​
5 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
​
​
​
​
​
​
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
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
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
​
​
​
​
​
5 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
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
5 years ago
5 years ago
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
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
​
​
​
​
​
​
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
​
​
​
​
​
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 connectIPCamDialog = null;
  6. var connectAnalCamDialog = null;
  7. var addIpCamDialog = null;
  8. var addE2UDialog = null;
  9. var addAnalogCamDialog = null;
  10. var cameraListStore = new Ext.data.JsonStore({
  11. root: 'nodes',
  12. totalProperty: 'totalCount',
  13. idProperty: 'id',
  14. remoteSort: true,
  15. fields: [{
  16. name: 'id',
  17. type: 'int'
  18. },{
  19. name: 'name',
  20. type: 'string'
  21. },{
  22. name: 'hardware',
  23. type: 'string'
  24. },{
  25. name: 'caps',
  26. type: 'string'
  27. },{
  28. name: 'ip',
  29. type: 'string'
  30. },{
  31. name: 'mac',
  32. type: 'string'
  33. },{
  34. name: 'ena',
  35. type: 'int'
  36. }],
  37. proxy : new Ext.data.HttpProxy({
  38. method: 'POST',
  39. prettyUrls: false,
  40. url: '/lib/controller/listDiscoveredCameraSources.php',
  41. headers: {
  42. 'UID': '<?=$CUser->Data['id'];?>',
  43. 'SID': '<?=$Session;?>'
  44. }
  45. })
  46. });
  47. var sourceListStore = new Ext.data.JsonStore({
  48. root: 'nodes',
  49. totalProperty: 'totalCount',
  50. idProperty: 'id',
  51. remoteSort: true,
  52. fields: [{
  53. name: 'id',
  54. type: 'int'
  55. },{
  56. name: 'name',
  57. type: 'string'
  58. },{
  59. name: 'encode',
  60. type: 'string'
  61. },{
  62. name: 'bitrate',
  63. type: 'int'
  64. },{
  65. name: 'size',
  66. type: 'string'
  67. }]
  68. });
  69. var IPCameraListSelModel = new Ext.grid.RowSelectionModel({
  70. singleSelect: true,
  71. listeners: {
  72. rowselect: function(sm, row, rec) {
  73. SelectedCam = rec.data.id;
  74. var CB = Ext.getCmp('con_to_ip_src');
  75. if( rec.data.ena ){
  76. CB.enable();
  77. } else {
  78. CB.disable();
  79. };
  80. }
  81. }
  82. });
  83. var AnalogCameraListSelModel = new Ext.grid.RowSelectionModel({
  84. singleSelect: true,
  85. listeners: {
  86. rowselect: function(sm, row, rec) {
  87. SelectedSource = rec.data.id;
  88. var CB = Ext.getCmp('con_to_anal_src');
  89. var CC = Ext.getCmp('cha_an_strim_set');
  90. if( rec.data.ena ){
  91. CB.enable();
  92. CC.enable();
  93. } else {
  94. CB.disable();
  95. CC.disable();
  96. };
  97. }
  98. }
  99. });
  100. var sourceListSelModel = new Ext.grid.RowSelectionModel({
  101. singleSelect: true,
  102. listeners: {
  103. rowselect: function(sm, row, rec) {
  104. SelectedSource = rec.data.id;
  105. Ext.getCmp('pic_prev').update( '<center><img height="300px" src="/lib/controller/getVideoFeed.php?UID=<?=$CUser->Data['id'];?>&SID=<?=$Session;?>&FID='+SelectedSource+'"></center>' );
  106. }
  107. }
  108. });
  109. function camCapRenderer(val){
  110. var p1, p2, p3;
  111. if( ( val & 1 ) == 1 ){
  112. p1 = '<img src="/style/img/cam_cap3.png" alt="Video Source">';
  113. } else {
  114. p1 = '<img src="/style/img/cam_cap0.png" alt="NO Video Source">';
  115. };
  116. if( ( val & 2 ) == 2 ){
  117. p2 = '<img src="/style/img/cam_cap2.png" alt="Audio Source">';
  118. } else {
  119. p2 = '<img src="/style/img/cam_cap0.png" alt="NO Audio Source">';
  120. };
  121. if( ( val & 4 ) == 4 ){
  122. p3 = '<img src="/style/img/cam_cap1.png" alt="PTZ Control">';
  123. } else {
  124. p3 = '<img src="/style/img/cam_cap0.png" alt="NO PTZ Control">';
  125. };
  126. return p1+p2+p3;
  127. };
  128. var IPCameraListColModel = new Ext.grid.ColumnModel({
  129. columns: [
  130. {header: "id", width: 50, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' },
  131. {header: "Type",width: 60, sortable: false, fixed: true, menuDisabled: true, /*renderer: camCapRenderer,*/ dataIndex: 'caps' },
  132. {header: "IP Address", width: 120, sortable: false, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'ip' },
  133. {header: "MAC", width: 120, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'mac' },
  134. {header: "Name", dataIndex: 'name' },
  135. {header: "HW", menuDisabled: true, dataIndex: 'hardware' }
  136. ],
  137. defaults: {
  138. sortable: true,
  139. menuDisabled: true,
  140. width: 100
  141. },
  142. listeners: {
  143. hiddenchange: function(cm, colIndex, hidden) {
  144. //saveConfig(colIndex, hidden);
  145. }
  146. }
  147. });
  148. var AnalogCameraListColModel = new Ext.grid.ColumnModel({
  149. columns: [
  150. {header: "id", width: 50, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' },
  151. {header: "Type",width: 60, sortable: false, fixed: true, menuDisabled: true, /*renderer: camCapRenderer,*/ dataIndex: 'caps' },
  152. {header: "Frame Size", width: 60, sortable: false, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'ip' },
  153. {header: "Device", width: 120, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'mac' },
  154. {header: "Name", width: 200, dataIndex: 'name' },
  155. {header: "HW", menuDisabled: true, dataIndex: 'hardware' }
  156. ],
  157. defaults: {
  158. sortable: true,
  159. menuDisabled: true,
  160. width: 100
  161. },
  162. listeners: {
  163. hiddenchange: function(cm, colIndex, hidden) {
  164. //saveConfig(colIndex, hidden);
  165. }
  166. }
  167. });
  168. var sourceListColModel = new Ext.grid.ColumnModel({
  169. columns: [
  170. {header: "id", width: 50, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' },
  171. {header: "Name", dataIndex: 'name' },
  172. {header: "Encoding",width: 120, sortable: false, fixed: true, menuDisabled: true, dataIndex: 'encode' },
  173. {header: "Frame", width: 120, sortable: false, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'size' },
  174. {header: "Bitrate", width: 80, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'bitrate' }
  175. ],
  176. defaults: {
  177. sortable: false,
  178. menuDisabled: true,
  179. width: 100
  180. },
  181. listeners: {
  182. hiddenchange: function(cm, colIndex, hidden) {
  183. //saveConfig(colIndex, hidden);
  184. }
  185. }
  186. });
  187. function discoverOnvifSources(){
  188. Ext.Ajax.request({
  189. url: '/lib/controller/listAndDiscoverOnvifSources.php',
  190. params: {
  191. NID: 0,
  192. UID: <?=$UserID;?>,
  193. SID: '<?=$Session;?>'
  194. },
  195. success: function( response, opts ){
  196. cameraListStore.reload();
  197. },
  198. failure: failureAJAXFunction
  199. });
  200. };
  201. function loadCameraSettings( SC ){
  202. Ext.Ajax.request({
  203. url: '/lib/controller/getCameraSettings.php',
  204. params: {
  205. CID: SC,
  206. UID: <?=$UserID;?>,
  207. SID: '<?=$Session;?>'
  208. },
  209. success: function( response, opts ){
  210. var data = Ext.decode( response.responseText );
  211. if( data.success ){
  212. } else {
  213. };
  214. },
  215. failure: function( response, opts ) {
  216. Ext.getCmp('cam_login').setValue('');
  217. Ext.getCmp('cam_password').setValue('');
  218. Ext.getCmp('cac_tab').enable();
  219. Ext.getCmp('str_tab').disable();
  220. Ext.getCmp('ptz_tab').disable();
  221. Ext.getCmp('loc_tab').disable();
  222. Ext.getCmp('coc_tabs').setActiveTab( 0 );
  223. sourceListStore.removeAll();
  224. }
  225. });
  226. };
  227. function preloadOnvifCredentials( SC ){
  228. showIPCamPropDialog();
  229. Ext.Ajax.request({
  230. url: '/lib/controller/getOnvifCredentials.php',
  231. params: {
  232. CID: SC,
  233. UID: <?=$UserID;?>,
  234. SID: '<?=$Session;?>'
  235. },
  236. success: function( response, opts ){
  237. var data = Ext.decode( response.responseText );
  238. if( data.success ){
  239. Ext.getCmp('cam_login').setValue( data.login );
  240. Ext.getCmp('cam_password').setValue( data.password );
  241. Ext.getCmp('acm_btn').enable();
  242. Ext.getCmp('cac_tab').disable();
  243. Ext.getCmp('lens_tab').enable();
  244. Ext.getCmp('str_tab').enable();
  245. Ext.getCmp('ptz_tab').enable();
  246. Ext.getCmp('loc_tab').enable();
  247. Ext.getCmp('coc_tabs').setActiveTab( 1 );
  248. sourceListStore.loadData( data, false );
  249. var tpic = document.getElementById('pic_prev');
  250. if( tpic != null ) tpic.src = '/lib/controller/getVideoFeed.php?UID=<?=$CUser->Data['id'];?>&SID<?=$Session;?>&FID='+data.nodes[0].id;
  251. //document.getElementById('pic_prev').src = '/lib/controller/getVideoFeed.php?UID=<?=$CUser->Data['id'];?>&SID<?=$Session;?>&FID='+data.nodes[0].id;
  252. } else {
  253. Ext.getCmp('cam_login').setValue('');
  254. Ext.getCmp('cam_password').setValue('');
  255. Ext.getCmp('acm_btn').disable();
  256. Ext.getCmp('cac_tab').enable();
  257. Ext.getCmp('lens_tab').disable();
  258. Ext.getCmp('str_tab').disable();
  259. Ext.getCmp('ptz_tab').disable();
  260. Ext.getCmp('loc_tab').disable();
  261. Ext.getCmp('coc_tabs').setActiveTab( 0 );
  262. sourceListStore.removeAll();
  263. if( data.error != null ){
  264. Ext.Msg.show({
  265. title:'<?=$Labels->GetLabel('Error_Message');?>',
  266. msg: data['error'],
  267. buttons: Ext.Msg.OK,//YESNOCANCEL,
  268. //fn: processResult,
  269. //animEl: 'elId',
  270. icon: Ext.MessageBox.ERROR //QUESTION
  271. });
  272. };
  273. };
  274. },
  275. failure: function( response, opts ) {
  276. Ext.getCmp('cam_login').setValue('');
  277. Ext.getCmp('cam_password').setValue('');
  278. Ext.getCmp('cac_tab').enable();
  279. Ext.getCmp('lens_tab').disable();
  280. Ext.getCmp('str_tab').disable();
  281. Ext.getCmp('ptz_tab').disable();
  282. Ext.getCmp('loc_tab').disable();
  283. Ext.getCmp('coc_tabs').setActiveTab( 0 );
  284. sourceListStore.removeAll();
  285. }
  286. });
  287. };
  288. function discoverOnvifProfiles( CamID, camUser, camPasswd ){
  289. Ext.Ajax.request({
  290. url: '/lib/controller/listAndDiscoverOnvifProfiles.php',
  291. params: {
  292. NID: 0,
  293. UID: <?=$UserID;?>,
  294. SID: '<?=$Session;?>',
  295. CID: CamID,
  296. GUG: camUser,
  297. GOG: camPasswd
  298. },
  299. success: function( response, opts ){
  300. var data = Ext.decode( response.responseText );
  301. Ext.getCmp('cac_tab').getEl().unmask();
  302. if( data['success'] == true ){
  303. Ext.getCmp('acm_btn').enable();
  304. Ext.getCmp('cac_tab').disable();
  305. Ext.getCmp('lens_tab').enable();
  306. Ext.getCmp('str_tab').enable();
  307. Ext.getCmp('ptz_tab').enable();
  308. Ext.getCmp('loc_tab').enable();
  309. Ext.getCmp('coc_tabs').setActiveTab( 1 );
  310. sourceListStore.loadData( data, false );
  311. var tpic = document.getElementById('pic_prev');
  312. if( tpic != null ) tpic.src = '/lib/controller/getVideoFeed.php?UID=<?=$CUser->Data['id'];?>&SID<?=$Session;?>&FID='+data.nodes[0].id;
  313. } else {
  314. Ext.Msg.show({
  315. title:'<?=$Labels->GetLabel('Error_Message');?>',
  316. msg: data['error'],
  317. width: 640,
  318. buttons: Ext.Msg.OK,//YESNOCANCEL,
  319. //fn: processResult,602811123
  320. //animEl: 'elId',
  321. icon: Ext.MessageBox.ERROR //QUESTION
  322. });
  323. };
  324. },
  325. failure: failureAJAXFunction
  326. });
  327. };
  328. var CamPropType = 0;
  329. function showIPCamPropDialog(){
  330. if( connectIPCamDialog == null ){
  331. connectIPCamDialog = new Ext.Window({
  332. modal: true,
  333. title: (CamPropType)?'<?=$Labels->GetLabel('_CON_2_IP_CAM_');?>':'IP Camera Settings',
  334. width: 600,
  335. height: 500,
  336. layout: 'vbox',
  337. closeAction: 'hide',
  338. border: false,
  339. items:[{
  340. id: 'coc_tabs',
  341. xtype: 'tabpanel',
  342. activeTab: 0,
  343. items: [{
  344. title: '<?=$Labels->GetLabel('_CAC_TAB_');?>',
  345. id: 'cac_tab',
  346. layout: 'table',
  347. width: '100%',
  348. border: false,
  349. disabled: false,
  350. defaults: {
  351. border: false,
  352. frame: false,
  353. bodyStyle: 'padding:10px'
  354. },
  355. layoutConfig: {
  356. columns: 3
  357. },
  358. items: [{
  359. colspan: 3,
  360. html: '<p align="center"><?=$Labels->GetLabel('_PROV_CAC_');?></p>'
  361. },{
  362. html: '<p align="right"><?=$Labels->GetLabel('_LOGIN_0_');?></p>',
  363. width: 170
  364. },{
  365. id: 'cam_login',
  366. xtype: 'textfield',
  367. width: 200
  368. },{
  369. html: '&nbsp;'
  370. },{
  371. html: '<p align="right"><?=$Labels->GetLabel('_PASSWORD_0_');?></p>'
  372. },{
  373. id: 'cam_password',
  374. xtype: 'textfield',
  375. inputType: 'password',
  376. width: 200
  377. },{
  378. html: '&nbsp;'
  379. },{
  380. html: '&nbsp;'
  381. },{
  382. xtype: 'button',
  383. text: 'Connect to Camera',
  384. width: '100%',
  385. handler: function(){
  386. Ext.getCmp('cac_tab').getEl().mask("Please wait...","x-mask-loading");
  387. var User = Ext.getCmp('cam_login').getValue();
  388. var Passwd = Ext.getCmp('cam_password').getValue();
  389. discoverOnvifProfiles( SelectedCam, User, Passwd );
  390. }
  391. },{
  392. html: '&nbsp;'
  393. }]
  394. },{
  395. title: '<?=$Labels->GetLabel('_STREAMS_');?>',
  396. id: 'str_tab',
  397. disabled: true,
  398. items:[{
  399. xtype: 'grid',
  400. title: '<?=$Labels->GetLabel('_STREAMS_');?>',
  401. height: 124,
  402. disableSelection: true,
  403. ds: sourceListStore,
  404. cm: sourceListColModel,
  405. sm: sourceListSelModel
  406. },{
  407. height: 300,
  408. id: 'pic_prev',
  409. width: 600,
  410. html: '<center><img height="300px" src="/style/img/cam_cap0.png"></center>'
  411. }]
  412. },{
  413. title: 'Lens Settings',
  414. id: 'lens_tab',
  415. disabled: true,
  416. items:[{
  417. layout: 'table',
  418. layoutConfig: {
  419. columns: 3
  420. },
  421. defaults: {
  422. frame: false,
  423. bodyStyle: 'padding:10px',
  424. border: false
  425. },
  426. items:[{
  427. width: 200,
  428. html: 'Sensor Size'
  429. },{
  430. xtype: 'combo',
  431. fieldLabel: 'Sensor Size',
  432. lazyRender: true,
  433. id: 'sens_size',
  434. mode: 'local',
  435. store: new Ext.data.ArrayStore({
  436. fields: ['size','size_txt'],
  437. data: [
  438. [0,'1/3.6"'],
  439. [1,'1/3.2"'],
  440. [2,'1/3"'],
  441. [3,'1/2.7"'],
  442. [4,'1/2"'],
  443. [5,'1/1.8"'],
  444. [6,'2/3"'],
  445. [7,'1"'],
  446. [8,'4/3"'],
  447. [9,'APS-C'],
  448. [10,'35 mm'],
  449. [11,'645']
  450. ]
  451. }),
  452. valueField: 'size',
  453. displayField: 'size_txt'
  454. },{
  455. html: '&nbsp;'
  456. },{
  457. html: 'Fixed Zoom'
  458. },{
  459. xtype: 'radio',
  460. id: 'no_zoom',
  461. name: 'zoom_ena',
  462. value: 0,
  463. checked: true
  464. },{
  465. html: '&nbsp;'
  466. },{
  467. html: 'Variable Zoom'
  468. },{
  469. xtype: 'radio',
  470. id: 'on_zoom',
  471. hideLabel: false,
  472. fieldLabel: 'Variable Zoom',
  473. html: 'koko',
  474. name: 'zoom_ena',
  475. value: 1,
  476. checked: false,
  477. handler: function( a, c ){
  478. if( c ){
  479. Ext.getCmp('max_foc').enable();
  480. Ext.getCmp('zoom_val').enable();
  481. var mf = Ext.getCmp('min_foc').getValue();
  482. if( mf > 0 ){
  483. Ext.getCmp('max_foc').setValue( mf );
  484. Ext.getCmp('zoom_val').setValue( 1 );
  485. };
  486. } else {
  487. Ext.getCmp('max_foc').disable();
  488. Ext.getCmp('zoom_val').disable();
  489. Ext.getCmp('zoom_disp').update('&nbsp;');
  490. };
  491. }
  492. },{
  493. html: '&nbsp;'
  494. },{
  495. html: 'Min. Focal Length'
  496. },{
  497. xtype: 'numberfield',
  498. id: 'min_foc',
  499. width: '95%',
  500. minValue: 1.0,
  501. maxValue: 270.0
  502. },{
  503. html: '&nbsp;'
  504. },{
  505. html: 'Max. Focal Length'
  506. },{
  507. xtype: 'numberfield',
  508. id: 'max_foc',
  509. width: '95%',
  510. disabled: true,
  511. minValue: 1.0,
  512. maxValue: 270.0,
  513. listeners:{
  514. change: function( a, c, b ){
  515. if( b == c ) return;
  516. var mf = Ext.getCmp('min_foc').getValue();
  517. if( mf > 0 ){
  518. if( c < mf ){
  519. Ext.getCmp('max_foc').setValue( mf );
  520. } else {
  521. var zl = c / mf;
  522. Ext.getCmp('zoom_val').setValue( zl );
  523. };
  524. };
  525. }
  526. }
  527. },{
  528. html: '&nbsp;'
  529. },{
  530. html: 'Zoom Ratio'
  531. },{
  532. xtype: 'slider',
  533. id: 'zoom_val',
  534. disabled: true,
  535. minValue: 1.0,
  536. maxValue: 40.0,
  537. listeners:{
  538. change: function( a, c, b ){
  539. var mf = Ext.getCmp('min_foc').getValue();
  540. if( mf > 0 ){
  541. Ext.getCmp('max_foc').setValue( mf*c );
  542. Ext.getCmp('zoom_disp').update('<p>X&nbsp;'+ c + '</p>');
  543. };
  544. }
  545. }
  546. },{
  547. id: 'zoom_disp',
  548. html: '&nbsp;'
  549. }]
  550. }]
  551. },{
  552. title: '<?=$Labels->GetLabel('_PTZ_TAB_');?>',
  553. id: 'ptz_tab',
  554. disabled: true,
  555. items:[{
  556. layout: 'table',
  557. layoutConfig: {
  558. columns: 3
  559. },
  560. defaults: {
  561. frame: false,
  562. bodyStyle: 'padding:10px',
  563. border: false
  564. },
  565. items:[{
  566. width: 200,
  567. html: '<?=$Labels->GetLabel('__PTZ_CONTROL__');?>'
  568. },{
  569. xtype: 'combo',
  570. fieldLabel: '<?=$Labels->GetLabel('__PTZ_CONTROL__');?>',
  571. lazyRender: true,
  572. id: 'ptz_proto',
  573. mode: 'local',
  574. store: new Ext.data.ArrayStore({
  575. fields: ['type','type_txt'],
  576. data: [
  577. [0,'<?=$Labels->GetLabel('_NO_PTZ_');?>'],
  578. [1,'Sony VISCA'],
  579. [2,'Pelco-D'],
  580. [3,'OnVif'],
  581. [4,'PSIA'],
  582. [5,'GB/T28181']
  583. ]
  584. }),
  585. valueField: 'type',
  586. displayField: 'type_txt',
  587. listeners:{
  588. change: function( a, c, b ){
  589. if( c > 0 ){
  590. if( c != 3 ){
  591. Ext.getCmp('uart_id').enable();
  592. Ext.getCmp('prot_id').enable();
  593. } else {
  594. Ext.getCmp('uart_id').disable();
  595. Ext.getCmp('prot_id').disable();
  596. };
  597. Ext.getCmp('pan_mode').enable();
  598. Ext.getCmp('tilt_mode').enable();
  599. Ext.getCmp('pan_ang').enable();
  600. Ext.getCmp('tilt_ang').enable();
  601. } else {
  602. Ext.getCmp('uart_id').disable();
  603. Ext.getCmp('prot_id').disable();
  604. Ext.getCmp('pan_mode').disable();
  605. Ext.getCmp('tilt_mode').disable();
  606. Ext.getCmp('pan_ang').disable();
  607. Ext.getCmp('tilt_ang').disable();
  608. };
  609. }
  610. }
  611. },{
  612. html: '&nbsp;'
  613. },{
  614. html: '<?=$Labels->GetLabel('_UART_PORT_');?>'
  615. },{
  616. xtype: 'combo',
  617. fieldLabel: '<?=$Labels->GetLabel('_UART_PORT_');?>',
  618. lazyRender: true,
  619. id: 'uart_id',
  620. mode: 'local',
  621. disabled: true,
  622. store: new Ext.data.ArrayStore({
  623. fields: ['uart','uart_txt'],
  624. data: [<?php
  625. $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 ) AND no.site_id={$SiteID} ";
  626. $RR=$DATABASE->Query( $QS );
  627. if( count( $RR ) ){
  628. $RE=array();
  629. foreach( $RR as $R ){
  630. $RE[] = "[ {$R['aux_id']}, '{$R['device']}']";
  631. };
  632. echo implode( ',', $RE );
  633. } else {
  634. echo "[0, \"".$Labels->GetLabel('_NO_UARTS_DEF_')."\"]";
  635. };
  636. ?>]
  637. }),
  638. valueField: 'uart',
  639. displayField: 'uart_txt'
  640. },{
  641. html: '&nbsp;'
  642. },{
  643. html: '<?=$Labels->GetLabel('_CAM_PROTO_ID_');?>'
  644. },{
  645. xtype: 'numberfield',
  646. id: 'prot_id',
  647. width: '95%',
  648. disabled: true,
  649. minValue: 0,
  650. maxValue: 255
  651. },{
  652. html: '&nbsp;'
  653. },{
  654. html: 'Pan Model'
  655. },{
  656. xtype: 'combo',
  657. fieldLabel: 'Pan Model',
  658. lazyRender: true,
  659. id: 'pan_mode',
  660. disabled: true,
  661. mode: 'local',
  662. store: new Ext.data.ArrayStore({
  663. fields: ['pm','pm_txt'],
  664. data: [
  665. [0,'Regular'],
  666. [1,'Reversed']
  667. ]
  668. }),
  669. valueField: 'pm',
  670. displayField: 'pm_txt'
  671. },{
  672. html: '&nbsp;'
  673. },{
  674. html: 'Tottal Pan Angles'
  675. },{
  676. xtype: 'numberfield',
  677. id: 'pan_ang',
  678. width: '95%',
  679. disabled: true,
  680. minValue: 0,
  681. maxValue: 360
  682. },{
  683. html: '&nbsp;'
  684. },{
  685. html: 'Tilt Model'
  686. },{
  687. xtype: 'combo',
  688. fieldLabel: 'Tilt Model',
  689. lazyRender: true,
  690. id: 'tilt_mode',
  691. disabled: true,
  692. mode: 'local',
  693. store: new Ext.data.ArrayStore({
  694. fields: ['tm','tm_txt'],
  695. data: [
  696. [0,'Regular'],
  697. [1,'Reversed'],
  698. [2,'Shifted 90°'],
  699. [3,'Rev-Shifted 90°']
  700. ]
  701. }),
  702. valueField: 'tm',
  703. displayField: 'tm_txt'
  704. },{
  705. html: '&nbsp;'
  706. },{
  707. html: 'Tottal Tilt Angles'
  708. },{
  709. xtype: 'numberfield',
  710. id: 'tilt_ang',
  711. width: '95%',
  712. disabled: true,
  713. minValue: 0,
  714. maxValue: 180
  715. },{
  716. html: '&nbsp;'
  717. }]
  718. }]
  719. },{
  720. title: '<?=$Labels->GetLabel('_ADV_TAB_');?>',
  721. disabled: true,
  722. layout: 'table',
  723. id: 'loc_tab',
  724. border: false,
  725. defaults: {
  726. // applied to each contained panel
  727. border: false,
  728. frame: false,
  729. bodyStyle: 'text-align:right;padding-left:10px;padding-right:10px;'
  730. },
  731. layoutConfig: {
  732. columns: 3
  733. },
  734. items: [{
  735. html: '<?=$Labels->GetLabel('_CAM_MAP_NAME_');?>:'
  736. },{
  737. id: 'cam_label',
  738. xtype: 'textfield',
  739. width: 200
  740. },{
  741. html: '&nbsp;'
  742. }]
  743. }]
  744. }],
  745. bbar:[{
  746. text: '<?=$Labels->GetLabel('_CANCEL_');?>',
  747. handler: function(){
  748. //addDialog.close();
  749. //addDialog = null;
  750. connectCamDialog.hide();
  751. //connectOnvifDialog = null;
  752. }
  753. },'->',{
  754. text: 'Add Camera to Map',
  755. id: 'acm_btn',
  756. disabled: true,
  757. handler: function(){
  758. var CLAB = Ext.getCmp('cam_label').getValue();
  759. var CPTZP = Ext.getCmp('ptz_proto').getValue();
  760. var CPTZU = Ext.getCmp('uart_id').getValue();
  761. var CPTZID = Ext.getCmp('prot_id').getValue();
  762. var CPANM = Ext.getCmp('pan_mode').getValue();
  763. var CTILTM = Ext.getCmp('tilt_mode').getValue();
  764. var CPANANG = Ext.getCmp('pan_ang').getValue();
  765. var CTILTANG = Ext.getCmp('tilt_ang').getValue();
  766. var CIMAGER = Ext.getCmp('sens_size').getValue();
  767. var CMINF = Ext.getCmp('min_foc').getValue();
  768. var CMAXF = Ext.getCmp('max_foc').getValue();
  769. var AllOK = true;
  770. if( CLAB == '' ) {
  771. AllOK = false;
  772. Ext.Msg.show({
  773. title:'Data Error!',
  774. msg: 'Please Provide Camera Name!',
  775. buttons: Ext.Msg.OK,
  776. icon: Ext.MessageBox.INFO
  777. });
  778. return;
  779. };
  780. if( SelectedSource == 0 ){
  781. AllOK = false;
  782. Ext.Msg.show({
  783. title:'Data Error!',
  784. msg: 'Please Select Image Source!',
  785. buttons: Ext.Msg.OK,
  786. icon: Ext.MessageBox.INFO
  787. });
  788. return;
  789. };
  790. if( ( SelectedCamTYPE == 11 || SelectedCamTYPE == 13 ) && CPTZP == 0 ){
  791. AllOK = false;
  792. Ext.Msg.show({
  793. title:'Data Error!',
  794. msg: 'Please Provide PTZ Protocol type!',
  795. buttons: Ext.Msg.OK,
  796. icon: Ext.MessageBox.INFO
  797. });
  798. return;
  799. };
  800. if( ( CPTZP == 1 || CPTZP == 2 ) && CPTZU == 0 ){
  801. AllOK = false;
  802. Ext.Msg.show({
  803. title:'Data Error!',
  804. msg: 'Please Provide UART Port!',
  805. buttons: Ext.Msg.OK,
  806. icon: Ext.MessageBox.INFO
  807. });
  808. return;
  809. };
  810. if( ( CPTZP == 1 || CPTZP == 2 ) && CPTZID == 0 ){
  811. AllOK = false;
  812. Ext.Msg.show({
  813. title:'Data Error!',
  814. msg: 'Please Provide Camera ID!',
  815. buttons: Ext.Msg.OK,
  816. icon: Ext.MessageBox.INFO
  817. });
  818. return;
  819. };
  820. if( AllOK ){
  821. Ext.Ajax.request({
  822. url: '/lib/controller/addCameraNode.php',
  823. params: {
  824. SITEID: <?=$SiteID;?>,
  825. UID: <?=$UserID;?>,
  826. SID: '<?=$Session;?>',
  827. CID: SelectedCam,
  828. STREAM: SelectedSource,
  829. LAB: CLAB,
  830. UART: CPTZU,
  831. PROTOID: CPTZID,
  832. PANMODE: CPANM,
  833. TILTMODE: CTILTM,
  834. PANANG: CPANANG,
  835. TILTANG: CTILTANG,
  836. IMSIZE: CIMAGER,
  837. FMIN: CMINF,
  838. FMAX: CMAXF,
  839. PTZ: CPTZP,
  840. CTYPE: SelectedCamTYPE
  841. },
  842. success: function( response, opts ){
  843. addIpCamDialog.close();
  844. addIpCamDialog = null;
  845. connectCamDialog.close();
  846. connectCamDialog = null;
  847. },
  848. failure: failureAJAXFunction
  849. });
  850. };
  851. }
  852. }]
  853. });
  854. } else {
  855. };
  856. connectIPCamDialog.show();
  857. };
  858. function showAnalCamPropDialog(){
  859. if( connectAnalCamDialog == null ){
  860. connectAnalCamDialog = new Ext.Window({
  861. modal: true,
  862. title: '<?=$Labels->GetLabel('_CREA_ANAL_CAM_');?>',
  863. width: 600,
  864. height: 500,
  865. layout: 'vbox',
  866. closeAction: 'hide',
  867. border: false,
  868. items:[{
  869. xtype: 'form',
  870. width: '100%',
  871. labelWidth: 200,
  872. labelAlign: 'right',
  873. labelSeparator: '',
  874. items: [{
  875. xtype: 'spacer',
  876. height: 5
  877. },{
  878. id: 'cam_label',
  879. xtype: 'textfield',
  880. fieldLabel: '<?=$Labels->GetLabel('_CAM_MAP_NAME_');?>'
  881. //width: 200
  882. },{
  883. xtype: 'spacer',
  884. height: 5
  885. }]
  886. },{
  887. id: 'coc_tabs',
  888. xtype: 'tabpanel',
  889. activeTab: 0,
  890. items: [{
  891. title: 'Lens Settings',
  892. xtype: 'form',
  893. id: 'lens_tab',
  894. disabled: false,
  895. items:[{
  896. layout: 'table',
  897. layoutConfig: {
  898. columns: 3
  899. },
  900. defaults: {
  901. frame: false,
  902. bodyStyle: 'padding:10px',
  903. border: false
  904. },
  905. items:[{
  906. width: 200,
  907. html: 'Sensor Size'
  908. },{
  909. xtype: 'combo',
  910. fieldLabel: 'Sensor Size',
  911. lazyRender: true,
  912. id: 'sens_size',
  913. mode: 'local',
  914. store: new Ext.data.ArrayStore({
  915. fields: ['size','size_txt'],
  916. data: [
  917. [0,'1/3.6"'],
  918. [1,'1/3.2"'],
  919. [2,'1/3"'],
  920. [3,'1/2.7"'],
  921. [4,'1/2"'],
  922. [5,'1/1.8"'],
  923. [6,'2/3"'],
  924. [7,'1"'],
  925. [8,'4/3"'],
  926. [9,'APS-C'],
  927. [10,'35 mm'],
  928. [11,'645']
  929. ]
  930. }),
  931. valueField: 'size',
  932. displayField: 'size_txt'
  933. },{
  934. html: '&nbsp;'
  935. },{
  936. html: 'Fixed Zoom'
  937. },{
  938. xtype: 'radio',
  939. id: 'no_zoom',
  940. name: 'zoom_ena',
  941. value: 0,
  942. checked: true
  943. },{
  944. html: '&nbsp;'
  945. },{
  946. html: 'Variable Zoom'
  947. },{
  948. xtype: 'radio',
  949. id: 'on_zoom',
  950. hideLabel: false,
  951. fieldLabel: 'Variable Zoom',
  952. html: 'koko',
  953. name: 'zoom_ena',
  954. value: 1,
  955. checked: false,
  956. handler: function( a, c ){
  957. if( c ){
  958. Ext.getCmp('max_foc').enable();
  959. Ext.getCmp('zoom_val').enable();
  960. var mf = Ext.getCmp('min_foc').getValue();
  961. if( mf > 0 ){
  962. Ext.getCmp('max_foc').setValue( mf );
  963. Ext.getCmp('zoom_val').setValue( 1 );
  964. };
  965. } else {
  966. Ext.getCmp('max_foc').disable();
  967. Ext.getCmp('zoom_val').disable();
  968. Ext.getCmp('zoom_disp').update('&nbsp;');
  969. };
  970. }
  971. },{
  972. html: '&nbsp;'
  973. },{
  974. html: 'Min. Focal Length'
  975. },{
  976. xtype: 'numberfield',
  977. id: 'min_foc',
  978. width: '95%',
  979. minValue: 1.0,
  980. maxValue: 270.0
  981. },{
  982. html: '&nbsp;'
  983. },{
  984. html: 'Max. Focal Length'
  985. },{
  986. xtype: 'numberfield',
  987. id: 'max_foc',
  988. width: '95%',
  989. disabled: true,
  990. minValue: 1.0,
  991. maxValue: 270.0,
  992. listeners:{
  993. change: function( a, c, b ){
  994. if( b == c ) return;
  995. var mf = Ext.getCmp('min_foc').getValue();
  996. if( mf > 0 ){
  997. if( c < mf ){
  998. Ext.getCmp('max_foc').setValue( mf );
  999. } else {
  1000. var zl = c / mf;
  1001. Ext.getCmp('zoom_val').setValue( zl );
  1002. };
  1003. };
  1004. }
  1005. }
  1006. },{
  1007. html: '&nbsp;'
  1008. },{
  1009. html: 'Zoom Ratio'
  1010. },{
  1011. xtype: 'slider',
  1012. id: 'zoom_val',
  1013. disabled: true,
  1014. minValue: 1.0,
  1015. maxValue: 40.0,
  1016. listeners:{
  1017. change: function( a, c, b ){
  1018. var mf = Ext.getCmp('min_foc').getValue();
  1019. if( mf > 0 ){
  1020. Ext.getCmp('max_foc').setValue( mf*c );
  1021. Ext.getCmp('zoom_disp').update('<p>X&nbsp;'+ c + '</p>');
  1022. };
  1023. }
  1024. }
  1025. },{
  1026. id: 'zoom_disp',
  1027. html: '&nbsp;'
  1028. }]
  1029. }]
  1030. },{
  1031. title: '<?=$Labels->GetLabel('_PTZ_TAB_');?>',
  1032. id: 'ptz_tab',
  1033. disabled: true,
  1034. items:[{
  1035. layout: 'table',
  1036. layoutConfig: {
  1037. columns: 3
  1038. },
  1039. defaults: {
  1040. frame: false,
  1041. bodyStyle: 'padding:10px',
  1042. border: false
  1043. },
  1044. items:[{
  1045. width: 200,
  1046. html: '<?=$Labels->GetLabel('__PTZ_CONTROL__');?>'
  1047. },{
  1048. xtype: 'combo',
  1049. fieldLabel: '<?=$Labels->GetLabel('__PTZ_CONTROL__');?>',
  1050. lazyRender: true,
  1051. id: 'ptz_proto',
  1052. mode: 'local',
  1053. forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true,
  1054. store: new Ext.data.ArrayStore({
  1055. fields: ['type','type_txt'],
  1056. data: [
  1057. [0,'<?=$Labels->GetLabel('_NO_PTZ_');?>'],
  1058. [1,'Sony VISCA'],
  1059. [2,'Pelco-D'],
  1060. [3,'OnVif'],
  1061. [4,'PSIA'],
  1062. [5,'GB/T28181']
  1063. ]
  1064. }),
  1065. valueField: 'type',
  1066. displayField: 'type_txt',
  1067. listeners:{
  1068. change: function( a, c, b ){
  1069. if( c > 0 ){
  1070. if( c != 3 ){
  1071. Ext.getCmp('uart_id').enable();
  1072. Ext.getCmp('prot_id').enable();
  1073. } else {
  1074. Ext.getCmp('uart_id').disable();
  1075. Ext.getCmp('prot_id').disable();
  1076. };
  1077. Ext.getCmp('pan_mode').enable();
  1078. Ext.getCmp('tilt_mode').enable();
  1079. Ext.getCmp('pan_ang').enable();
  1080. Ext.getCmp('tilt_ang').enable();
  1081. } else {
  1082. Ext.getCmp('uart_id').disable();
  1083. Ext.getCmp('prot_id').disable();
  1084. Ext.getCmp('pan_mode').disable();
  1085. Ext.getCmp('tilt_mode').disable();
  1086. Ext.getCmp('pan_ang').disable();
  1087. Ext.getCmp('tilt_ang').disable();
  1088. };
  1089. }
  1090. }
  1091. },{
  1092. html: '&nbsp;'
  1093. },{
  1094. html: '<?=$Labels->GetLabel('_UART_PORT_');?>'
  1095. },{
  1096. xtype: 'combo',
  1097. fieldLabel: '<?=$Labels->GetLabel('_UART_PORT_');?>',
  1098. lazyRender: true,
  1099. id: 'uart_id',
  1100. mode: 'local',
  1101. disabled: true,
  1102. forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true,
  1103. store: new Ext.data.ArrayStore({
  1104. fields: ['uart','uart_txt'],
  1105. data: [<?php
  1106. $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 ) AND no.site_id={$SiteID} ";
  1107. $RR=$DATABASE->Query( $QS );
  1108. if( count( $RR ) ){
  1109. $RE=array();
  1110. foreach( $RR as $R ){
  1111. $RE[] = "[ {$R['aux_id']}, '{$R['device']}']";
  1112. };
  1113. echo implode( ',', $RE );
  1114. } else {
  1115. echo "[0, \"".$Labels->GetLabel('_NO_UARTS_DEF_')."\"]";
  1116. };
  1117. ?>]
  1118. }),
  1119. valueField: 'uart',
  1120. displayField: 'uart_txt'
  1121. },{
  1122. html: '&nbsp;'
  1123. },{
  1124. html: '<?=$Labels->GetLabel('_CAM_PROTO_ID_');?>'
  1125. },{
  1126. xtype: 'numberfield',
  1127. id: 'prot_id',
  1128. width: '95%',
  1129. disabled: true,
  1130. minValue: 0,
  1131. maxValue: 255
  1132. },{
  1133. html: '&nbsp;'
  1134. },{
  1135. html: 'Pan Model'
  1136. },{
  1137. xtype: 'combo',
  1138. fieldLabel: 'Pan Model',
  1139. lazyRender: true,
  1140. id: 'pan_mode',
  1141. forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true,
  1142. disabled: true,
  1143. mode: 'local',
  1144. store: new Ext.data.ArrayStore({
  1145. fields: ['pm','pm_txt'],
  1146. data: [
  1147. [0,'Regular'],
  1148. [1,'Reversed']
  1149. ]
  1150. }),
  1151. valueField: 'pm',
  1152. displayField: 'pm_txt'
  1153. },{
  1154. html: '&nbsp;'
  1155. },{
  1156. html: 'Tottal Pan Angles'
  1157. },{
  1158. xtype: 'numberfield',
  1159. id: 'pan_ang',
  1160. width: '95%',
  1161. disabled: true,
  1162. minValue: 0,
  1163. maxValue: 360
  1164. },{
  1165. html: '&nbsp;'
  1166. },{
  1167. html: 'Tilt Model'
  1168. },{
  1169. xtype: 'combo',
  1170. fieldLabel: 'Tilt Model',
  1171. lazyRender: true,
  1172. id: 'tilt_mode',
  1173. disabled: true,
  1174. forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true,
  1175. mode: 'local',
  1176. store: new Ext.data.ArrayStore({
  1177. fields: ['tm','tm_txt'],
  1178. data: [
  1179. [0,'Regular'],
  1180. [1,'Reversed'],
  1181. [2,'Shifted 90°'],
  1182. [3,'Rev-Shifted 90°']
  1183. ]
  1184. }),
  1185. valueField: 'tm',
  1186. displayField: 'tm_txt'
  1187. },{
  1188. html: '&nbsp;'
  1189. },{
  1190. html: 'Tottal Tilt Angles'
  1191. },{
  1192. xtype: 'numberfield',
  1193. id: 'tilt_ang',
  1194. width: '95%',
  1195. disabled: true,
  1196. minValue: 0,
  1197. maxValue: 180
  1198. },{
  1199. html: '&nbsp;'
  1200. }]
  1201. }]
  1202. }]
  1203. }],
  1204. bbar:[{
  1205. text: '<?=$Labels->GetLabel('_CANCEL_');?>',
  1206. handler: function(){
  1207. //connectAnalCamDialog.hide();
  1208. connectAnalCamDialog.close();
  1209. connectAnalCamDialog = null;
  1210. }
  1211. },'->',{
  1212. text: '<?=$Labels->GetLabel('_ADD_CAMERA2SITE_');?>',
  1213. id: 'acm_btn',
  1214. handler: function(){
  1215. var CLAB = Ext.getCmp('cam_label').getValue();
  1216. var CPTZP = Ext.getCmp('ptz_proto').getValue();
  1217. var CPTZU = Ext.getCmp('uart_id').getValue();
  1218. var CPTZID = Ext.getCmp('prot_id').getValue();
  1219. var CPANM = Ext.getCmp('pan_mode').getValue();
  1220. var CTILTM = Ext.getCmp('tilt_mode').getValue();
  1221. var CPANANG = Ext.getCmp('pan_ang').getValue();
  1222. var CTILTANG = Ext.getCmp('tilt_ang').getValue();
  1223. var CIMAGER = Ext.getCmp('sens_size').getValue();
  1224. var CMINF = Ext.getCmp('min_foc').getValue();
  1225. var CMAXF = Ext.getCmp('max_foc').getValue();
  1226. var AllOK = true;
  1227. if( CLAB == '' ) {
  1228. AllOK = false;
  1229. Ext.Msg.show({
  1230. title:'Data Error!',
  1231. msg: 'Please Provide Camera Name!',
  1232. buttons: Ext.Msg.OK,
  1233. icon: Ext.MessageBox.INFO
  1234. });
  1235. return;
  1236. };
  1237. if( SelectedSource == 0 ){
  1238. AllOK = false;
  1239. Ext.Msg.show({
  1240. title:'Data Error!',
  1241. msg: 'Please Select Image Source!',
  1242. buttons: Ext.Msg.OK,
  1243. icon: Ext.MessageBox.INFO
  1244. });
  1245. return;
  1246. };
  1247. if( ( SelectedCamTYPE == 11 || SelectedCamTYPE == 13 ) && CPTZP == 0 ){
  1248. AllOK = false;
  1249. Ext.Msg.show({
  1250. title:'Data Error!',
  1251. msg: 'Please Provide PTZ Protocol type!',
  1252. buttons: Ext.Msg.OK,
  1253. icon: Ext.MessageBox.INFO
  1254. });
  1255. return;
  1256. };
  1257. if( ( CPTZP == 1 || CPTZP == 2 ) && CPTZU == 0 ){
  1258. AllOK = false;
  1259. Ext.Msg.show({
  1260. title:'Data Error!',
  1261. msg: 'Please Provide UART Port!',
  1262. buttons: Ext.Msg.OK,
  1263. icon: Ext.MessageBox.INFO
  1264. });
  1265. return;
  1266. };
  1267. if( ( CPTZP == 1 || CPTZP == 2 ) && CPTZID == 0 ){
  1268. AllOK = false;
  1269. Ext.Msg.show({
  1270. title:'Data Error!',
  1271. msg: 'Please Provide Camera ID!',
  1272. buttons: Ext.Msg.OK,
  1273. icon: Ext.MessageBox.INFO
  1274. });
  1275. return;
  1276. };
  1277. if( AllOK ){
  1278. Ext.Ajax.request({
  1279. url: '/lib/controller/addNetworkNode.php',
  1280. params: {
  1281. SITEID: <?=$SiteID;?>,
  1282. UID: <?=$UserID;?>,
  1283. SID: '<?=$Session;?>',
  1284. CID: SelectedCam,
  1285. STREAM: SelectedSource,
  1286. LAB: CLAB,
  1287. UART: CPTZU,
  1288. PROTOID: CPTZID,
  1289. PANMODE: CPANM,
  1290. TILTMODE: CTILTM,
  1291. PANANG: CPANANG,
  1292. TILTANG: CTILTANG,
  1293. IMSIZE: CIMAGER,
  1294. FMIN: CMINF,
  1295. FMAX: CMAXF,
  1296. PTZ: CPTZP,
  1297. TYPE: SelectedCamTYPE
  1298. },
  1299. success: function( response, opts ){
  1300. reloadNetworkData();
  1301. addAnalogCamDialog.close();
  1302. addAnalogCamDialog = null;
  1303. connectAnalCamDialog.close();
  1304. connectAnalCamDialog = null;
  1305. //loadSystemEditor();
  1306. },
  1307. failure: failureAJAXFunction
  1308. });
  1309. };
  1310. }
  1311. }]
  1312. });
  1313. } else {
  1314. };
  1315. connectAnalCamDialog.show();
  1316. if( SelectedCamTYPE == 11 ){
  1317. Ext.getCmp('ptz_tab').enable();
  1318. Ext.getCmp('on_zoom').enable();
  1319. } else {
  1320. Ext.getCmp('ptz_tab').disable();
  1321. Ext.getCmp('on_zoom').disable();
  1322. };
  1323. };
  1324. function connectToSeleced(){
  1325. CamPropType = 1;
  1326. if( SelectedCam > 0 ){
  1327. preloadOnvifCredentials( SelectedCam );
  1328. //loadCameraSettings( SelectedCam );
  1329. };
  1330. };
  1331. function addIpCam(){
  1332. if( addIpCamDialog == null ){
  1333. addIpCamDialog = new Ext.Window({
  1334. modal: true,
  1335. title: '<?=$Labels->GetLabel('_DET_IP_CAMERA_LST_');?>',
  1336. width: 800,
  1337. height: 600,
  1338. layout: 'fit',
  1339. closeAction: 'hide',
  1340. items:{
  1341. xtype: 'grid',
  1342. frame: false,
  1343. border: false,
  1344. ds: cameraListStore,
  1345. cm: IPCameraListColModel,
  1346. sm: IPCameraListSelModel,
  1347. viewConfig: {
  1348. forceFit: true
  1349. },
  1350. bbar: [{
  1351. text: '<?=$Labels->GetLabel('_CANCEL_');?>',
  1352. handler: function(){
  1353. addIpCamDialog.hide();
  1354. }
  1355. },'->',{
  1356. id: 'con_to_ip_src',
  1357. text: '<?=$Labels->GetLabel('_CONNECT_2_SEL_');?>',
  1358. disabled: ( SelectedCam == 0 ),
  1359. handler: connectToSeleced
  1360. }]
  1361. }
  1362. });
  1363. };
  1364. addIpCamDialog.show();
  1365. cameraListStore.load({params:{cam_sources:'ipv'}});
  1366. };
  1367. function addAnalogCam(){
  1368. if( addAnalogCamDialog == null ){
  1369. addAnalogCamDialog = new Ext.Window({
  1370. modal: true,
  1371. title: '<?=$Labels->GetLabel('_ANAL_SOURCES_LST_');?>',
  1372. width: 800,
  1373. height: 600,
  1374. layout: 'fit',
  1375. closeAction: 'hide',
  1376. items:[{
  1377. xtype: 'grid',
  1378. frame: false,
  1379. border: false,
  1380. ds: cameraListStore,
  1381. cm: AnalogCameraListColModel,
  1382. sm: AnalogCameraListSelModel,
  1383. viewConfig: {
  1384. forceFit: true
  1385. }
  1386. }],
  1387. bbar: [{
  1388. text: '<?=$Labels->GetLabel('_CANCEL_');?>',
  1389. handler: function(){
  1390. addAnalogCamDialog.hide();
  1391. }
  1392. },'->',{
  1393. id: 'cha_an_strim_set',
  1394. text: '<?=$Labels->GetLabel('_SETTINGS_');?>',
  1395. disabled: ( SelectedSource == 0 ),
  1396. handler: function(){
  1397. editAnalogStream( SelectedSource );
  1398. }
  1399. },{
  1400. id: 'con_to_anal_src',
  1401. text: '<?=$Labels->GetLabel('_CONNECT_2_SEL_');?>',
  1402. disabled: ( SelectedSource == 0 ),
  1403. handler: function(){
  1404. //alert( 'Cam Type:'+SelectedCamTYPE );
  1405. showAnalCamPropDialog();
  1406. }
  1407. }]
  1408. });
  1409. };
  1410. addAnalogCamDialog.show();
  1411. cameraListStore.load({params:{cam_sources:'anal'}});
  1412. };
  1413. var changer_locked = false;
  1414. function changeASS( stream, id ){
  1415. if(changer_locked) return;
  1416. changer_locked = true;
  1417. var ll = Ext.getCmp( id );
  1418. var name = ll.name;
  1419. var value = ll.getValue();
  1420. Ext.Ajax.request({
  1421. url: '/lib/controller/setAnalogStreamCtrl.php',
  1422. params: {
  1423. STREAM: stream,
  1424. PID: name,
  1425. VALUE: value,
  1426. UID: <?=$UserID;?>,
  1427. SID: '<?=$Session;?>',
  1428. },
  1429. success: function( response, opts ){
  1430. changer_locked = false;
  1431. // If the response is JSON, you have to decode it
  1432. //var data = Ext.decode(response.responseText);
  1433. },
  1434. failure: failureAJAXFunction
  1435. });
  1436. };
  1437. var AnalogStreamEditor = null;
  1438. function editAnalogStream( SelStream, live=0 ){
  1439. if( AnalogStreamEditor == null ){
  1440. AnalogStreamEditor = new Ext.Window({
  1441. modal: ((live==0)?true:false),
  1442. title: 'Analog Input Settings',
  1443. width: 440,
  1444. height: 400,
  1445. layout: 'fit',
  1446. closeAction: 'hide',
  1447. buttonAlign:'center',
  1448. items:[{
  1449. }],
  1450. bbar: ['->',{
  1451. text: '<?=$Labels->GetLabel('_CLOSE_');?>',
  1452. handler: function(){//discoverOnvifSources
  1453. AnalogStreamEditor.hide();
  1454. }
  1455. }]
  1456. });
  1457. };
  1458. AnalogStreamEditor.show();
  1459. Ext.Ajax.request({
  1460. url: '/lib/controller/getAnalogStreamCtrl.php',
  1461. params: {
  1462. STREAM: SelStream,
  1463. UID: <?=$UserID;?>,
  1464. SID: '<?=$Session;?>',
  1465. },
  1466. success: function( response, opts ){
  1467. // If the response is JSON, you have to decode it
  1468. var data = Ext.decode(response.responseText);
  1469. AnalogStreamEditor.removeAll( true );
  1470. AnalogStreamEditor.add( data );
  1471. AnalogStreamEditor.doLayout();
  1472. },
  1473. failure: failureAJAXFunction
  1474. });
  1475. };
  1476. function addEthernet2Uart(){
  1477. if( addE2UDialog == null ){
  1478. addE2UDialog = new Ext.Window({
  1479. modal: true,
  1480. title: 'Add Ethernet To Serial Adapter',
  1481. width: 400,
  1482. height: 300,
  1483. layout: 'fit',
  1484. closeAction: 'hide',
  1485. items:[{
  1486. xtype: 'form',
  1487. labelWidth: 120, // label settings here cascade unless overridden
  1488. frame: false,
  1489. bodyStyle:'padding:5px 5px 0',
  1490. defaultType: 'textfield',
  1491. items:[{
  1492. xtype: 'combo',
  1493. fieldLabel: 'Speed',
  1494. id: 'ued_speed',
  1495. lazyRender:true,
  1496. mode: 'local',
  1497. store: new Ext.data.ArrayStore({
  1498. fields: ['speed'],
  1499. data: [[19200], [115200]]
  1500. }),
  1501. valueField: 'speed',
  1502. displayField: 'speed'
  1503. },{
  1504. xtype: 'combo',
  1505. fieldLabel: 'Bits',
  1506. id: 'ued_bit',
  1507. lazyRender:true,
  1508. mode: 'local',
  1509. store: new Ext.data.ArrayStore({
  1510. fields: ['bits'],
  1511. data: [[5],[6],[7],[8],[9]]
  1512. }),
  1513. valueField: 'bits',
  1514. displayField: 'bits'
  1515. },{
  1516. xtype: 'combo',
  1517. fieldLabel: 'Stop Bit',
  1518. lazyRender:true,
  1519. id: 'ued_stops',
  1520. mode: 'local',
  1521. store: new Ext.data.ArrayStore({
  1522. fields: ['stops'],
  1523. data: [[1],[1.5],[2]]
  1524. }),
  1525. valueField: 'stops',
  1526. displayField: 'stops'
  1527. },{
  1528. xtype: 'combo',
  1529. fieldLabel: 'Parity',
  1530. lazyRender:true,
  1531. id: 'ued_parity',
  1532. mode: 'local',
  1533. store: new Ext.data.ArrayStore({
  1534. fields: ['parity'],
  1535. data: [['Odd'], ['Even'],['None']]
  1536. }),
  1537. valueField: 'parity',
  1538. displayField: 'parity'
  1539. },{
  1540. xtype: 'combo',
  1541. fieldLabel: 'Working Mode',
  1542. lazyRender: true,
  1543. id: 'ued_mode',
  1544. mode: 'local',
  1545. store: new Ext.data.ArrayStore({
  1546. fields: ['mode','mode_txt'],
  1547. data: [[0,'UDP Client'], [1,'TCP Client'], [2,'UDP Server'], [3,'TCP Server']]
  1548. }),
  1549. valueField: 'mode',
  1550. displayField: 'mode_txt'
  1551. },{
  1552. fieldLabel: 'IP Address',
  1553. id: 'ued_ip'
  1554. },{
  1555. fieldLabel: 'IP Port',
  1556. id: 'ued_port'
  1557. }],
  1558. bbar: [{
  1559. text: 'Cancel',
  1560. handler: function(){//discoverOnvifSources
  1561. addE2UDialog.hide();
  1562. }
  1563. },'->',{
  1564. id: 'con_to_src',
  1565. text: 'Add Adapter to Site',
  1566. disabled: false,
  1567. handler: function(){
  1568. var SPD = Ext.getCmp('ued_speed').getValue();
  1569. var BIT = Ext.getCmp('ued_bit').getValue();
  1570. var STP = Ext.getCmp('ued_stops').getValue();
  1571. var PAR = Ext.getCmp('ued_parity').getValue();
  1572. var MOD = Ext.getCmp('ued_mode').getValue();
  1573. var IP = Ext.getCmp('ued_ip').getValue();
  1574. var PORT= Ext.getCmp('ued_port').getValue();
  1575. Ext.Ajax.request({
  1576. url: '/lib/controller/addNetworkNode.php',
  1577. params: {
  1578. NID: <?=$SiteID;?>,
  1579. TYPE: 20,
  1580. UART_SPEED: SPD,
  1581. UART_BITS: BIT,
  1582. UART_STOP: STP,
  1583. UART_PAR: PAR,
  1584. UART_MODE: MOD,
  1585. UART_IP: IP,
  1586. UART_PORT: PORT,
  1587. UID: <?=$UserID;?>,
  1588. SID: '<?=$Session;?>'
  1589. },
  1590. success: function( response, opts ){
  1591. var data = Ext.decode(response.responseText);
  1592. if( data.sucess == false ){
  1593. Ext.Msg.show({
  1594. title:'Request Failure!',
  1595. msg: data.error,
  1596. buttons: Ext.Msg.OK,
  1597. icon: Ext.MessageBox.INFO
  1598. });
  1599. } else {
  1600. loadSystemEditor();
  1601. };
  1602. addE2UDialog.hide();
  1603. },
  1604. failure: function( response, opts ) {
  1605. failureAJAXFunction( response, opts );
  1606. addE2UDialog.hide();
  1607. }
  1608. });
  1609. }
  1610. }]
  1611. }]
  1612. });
  1613. };
  1614. addE2UDialog.show();
  1615. };