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.

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