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.

1664 lines
43 KiB

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