Web Interface For Lite Argus Control modules
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.

1497 lines
44 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //<?php require_once('../../js_asm.php'); ?>
  2. var helpContentTopicID = -1;
  3. function loadHelpContent( topicID ){
  4. if( helpContentTopicID == topicID ) return;
  5. helpContentTopicID = topicID;
  6. Ext.Ajax.request({
  7. url: '/lib/controller/getHelpTopic.php',
  8. params: {
  9. UID: <?=$UserID;?>,
  10. SID: '<?=$Session;?>',
  11. TID: topicID
  12. },
  13. success: function( response, opts ){
  14. var tData = Ext.decode(response.responseText);
  15. var tPanel = Ext.getCmp('help_content');
  16. tPanel.removeAll( true );
  17. tPanel.add( tData );
  18. tPanel.doLayout();
  19. },
  20. failure: failureAJAXFunction
  21. });
  22. };
  23. function clearHelpContent(){
  24. helpContentTopicID = -1;
  25. };
  26. function loadRessources(){
  27. Ext.Ajax.request({
  28. url: '/lib/controller/getResources.php',
  29. params: {
  30. UID: <?=$UserID;?>,
  31. SID: '<?=$Session;?>',
  32. },
  33. success: function( response, opts ){
  34. var tData = Ext.decode(response.responseText);
  35. var tPanel = Ext.getCmp('resources_container');
  36. if( tData.status == 'ok' ){
  37. var res = Ext.decode( tData.resources );
  38. tPanel.removeAll( true );
  39. tPanel.add( res );
  40. tPanel.doLayout();
  41. } else {
  42. };
  43. },
  44. failure: failureAJAXFunction
  45. });
  46. };
  47. function loadModules(){
  48. Ext.Ajax.request({
  49. url: '/lib/controller/getModules.php',
  50. params: {
  51. UID: <?=$UserID;?>,
  52. SID: '<?=$Session;?>',
  53. },
  54. success: function( response, opts ){
  55. var tData = Ext.decode(response.responseText);
  56. var tPanel = Ext.getCmp('modules_container');
  57. if( tData.status == 'ok' ){
  58. var res = Ext.decode( tData.modules );
  59. tPanel.removeAll( true );
  60. tPanel.add( res );
  61. tPanel.doLayout();
  62. } else {
  63. tPanel.removeAll( true );
  64. tPanel.doLayout();
  65. var tPanel = Ext.getCmp('mod_ed_small');
  66. tPanel.removeAll( true );
  67. tPanel.add( { html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>' } );
  68. tPanel.doLayout();
  69. };
  70. },
  71. failure: failureAJAXFunction
  72. });
  73. };
  74. function loadDetectedCameras(){
  75. Ext.Ajax.request({
  76. url: '/lib/controller/getCameras.php',
  77. params: {
  78. UID: <?=$UserID;?>,
  79. TYP: 0,
  80. SID: '<?=$Session;?>',
  81. },
  82. success: function( response, opts ){
  83. var tData = Ext.decode(response.responseText);
  84. var tPanel = Ext.getCmp('dcam_container');
  85. if( tData.status == 'ok' ){
  86. var res = Ext.decode( tData.cameras );
  87. tPanel.removeAll( true );
  88. tPanel.add( res );
  89. tPanel.doLayout();
  90. } else {
  91. tPanel.removeAll( true );
  92. tPanel.doLayout();
  93. var tPanel = Ext.getCmp('mod_ed_small');
  94. tPanel.removeAll( true );
  95. tPanel.add( { html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>' } );
  96. tPanel.doLayout();
  97. };
  98. },
  99. failure: failureAJAXFunction
  100. });
  101. };
  102. function loadAssignedCameras(){
  103. };
  104. function editResource( rid ){
  105. var loadEditor = true;
  106. if( settingsAreChanged ){
  107. Ext.Msg.show({
  108. title:'<?=$Labels->GetLabel('_SETTINGS_CHANGED_');?>',
  109. msg: '<?=$Labels->GetLabel('_SET_CHANGED_WOULD_SAVE_');?>',
  110. buttons: Ext.Msg.YESNO,
  111. icon: Ext.MessageBox.WARNING,
  112. fn: function(btn, text){
  113. if( btn == 'yes' ){
  114. cleanupChangeNotifier();
  115. } else {
  116. loadEditor = false;
  117. };
  118. }
  119. });
  120. };
  121. if( loadEditor ){
  122. Ext.Ajax.request({
  123. url: '/lib/controller/getResourceEditor.php',
  124. params: {
  125. RID: rid,
  126. UID: <?=$UserID;?>,
  127. SID: '<?=$Session;?>',
  128. },
  129. success: function( response, opts ){
  130. var data = Ext.decode(response.responseText);
  131. var resourceEdPanel = Ext.getCmp('res_ed_small');
  132. if( resourceEdPanel ){
  133. resourceEdPanel.removeAll( true );
  134. resourceEdPanel.add( data );
  135. resourceEdPanel.doLayout();
  136. };
  137. },
  138. failure: failureAJAXFunction
  139. });
  140. };
  141. };
  142. function editModule( mid ){
  143. var loadEditor = true;
  144. if( settingsAreChanged ){
  145. Ext.Msg.show({
  146. title:'<?=$Labels->GetLabel('_SETTINGS_CHANGED_');?>',
  147. msg: '<?=$Labels->GetLabel('_SET_CHANGED_WOULD_SAVE_');?>',
  148. buttons: Ext.Msg.YESNO,
  149. icon: Ext.MessageBox.WARNING,
  150. fn: function(btn, text){
  151. if( btn == 'yes' ){
  152. cleanupChangeNotifier();
  153. } else {
  154. loadEditor = false;
  155. };
  156. }
  157. });
  158. };
  159. if( loadEditor ){
  160. Ext.Ajax.request({
  161. url: '/lib/controller/getModuleEditor.php',
  162. params: {
  163. MID: mid,
  164. UID: <?=$UserID;?>,
  165. SID: '<?=$Session;?>',
  166. },
  167. success: function( response, opts ){
  168. var data = Ext.decode(response.responseText);
  169. var moduleEdPanel = Ext.getCmp('mod_ed_small');
  170. if( moduleEdPanel ){
  171. moduleEdPanel.removeAll( true );
  172. moduleEdPanel.add( data );
  173. moduleEdPanel.doLayout();
  174. };
  175. },
  176. failure: failureAJAXFunction
  177. });
  178. };
  179. };
  180. function enableModule( ID ){
  181. Ext.Ajax.request({
  182. url: '/lib/controller/doModuleOperation.php',
  183. params: {
  184. OPID: 2,
  185. OPCODE: 1,
  186. MID: ID,
  187. UID: <?=$UserID;?>,
  188. SID: '<?=$Session;?>'
  189. },
  190. success: function(){
  191. //showSettings( SelectedNodeID, 2 );
  192. loadModules();
  193. }
  194. });
  195. };
  196. function disableModule( ID ){
  197. Ext.Ajax.request({
  198. url: '/lib/controller/doModuleOperation.php',
  199. params: {
  200. OPID: 2,
  201. OPCODE: 0,
  202. MID: ID,
  203. UID: <?=$UserID;?>,
  204. SID: '<?=$Session;?>'
  205. },
  206. success: function(){
  207. //showSettings( SelectedNodeID, 2 );
  208. loadModules();
  209. }
  210. });
  211. };
  212. function doCamOperation( cid, op, param, reload = false ){
  213. Ext.Ajax.request({
  214. url: '/lib/controller/doCameraOperation.php',
  215. params: {
  216. CID: cid,
  217. CMD: 10,
  218. OPID: op,
  219. OPCODE: param,
  220. UID: <?=$UserID;?>,
  221. SID: '<?=$Session;?>'
  222. },
  223. success: function(){
  224. if( reload ) loadDetectedCameras();
  225. if( reload ) loadAssignedCameras();
  226. }
  227. });
  228. };
  229. function removeModule( ID ){
  230. Ext.Msg.show({
  231. title:'<?=$Labels->GetLabel('_PLS_CONFIRM_');?>',
  232. msg: '<?=$Labels->GetLabel('_RUS_DELETE_MODULE_');?>',
  233. buttons: Ext.Msg.YESNOCANCEL,
  234. fn: function( btn, text ){
  235. if( btn == 'yes' ){
  236. Ext.Ajax.request({
  237. url: '/lib/controller/doModuleOperation.php',
  238. params: {
  239. OPID: 1,
  240. MID: ID,
  241. UID: <?=$UserID;?>,
  242. SID: '<?=$Session;?>'
  243. },
  244. success: function(){
  245. //showSettings( SelectedNodeID, 2 );
  246. loadModules();
  247. }
  248. });
  249. };
  250. },
  251. icon: Ext.MessageBox.QUESTION
  252. });
  253. };
  254. function disableServOps(){
  255. var tC = Ext.getCmp('servopPanel01');
  256. tC.removeClass('servopInfo_item01');
  257. tC.addClass('servopInfo_item00');
  258. tC.disable();
  259. Ext.getCmp('tbtn_sop01').disable();
  260. //tC.doLayout();
  261. tC = Ext.getCmp('servopPanel02');
  262. tC.removeClass('servopInfo_item11');
  263. tC.addClass('servopInfo_item10');
  264. tC.disable();
  265. Ext.getCmp('tbtn_sop02').disable();
  266. //tC.doLayout();
  267. tC = Ext.getCmp('servopPanel03');
  268. tC.removeClass('servopInfo_item21');
  269. tC.addClass('servopInfo_item20');
  270. tC.disable();
  271. Ext.getCmp('tbtn_sop03').disable();
  272. //tC.doLayout();
  273. tC = Ext.getCmp('servopPanel04');
  274. tC.removeClass('servopInfo_item31');
  275. tC.addClass('servopInfo_item30');
  276. tC.disable();
  277. Ext.getCmp('tbtn_sop04').disable();
  278. //tC.doLayout();
  279. };
  280. function enableServOps(){
  281. var tC = Ext.getCmp('servopPanel01');
  282. if( tC != undefined ){
  283. tC.removeClass('servopInfo_item00');
  284. tC.addClass('servopInfo_item01');
  285. Ext.getCmp('tbtn_sop01').enable();
  286. tC.enable();
  287. };
  288. //tC.doLayout();
  289. tC = Ext.getCmp('servopPanel02');
  290. if( tC != undefined ){
  291. tC.removeClass('servopInfo_item10');
  292. tC.addClass('servopInfo_item11');
  293. tC.enable();
  294. Ext.getCmp('tbtn_sop02').enable();
  295. };
  296. //tC.doLayout();
  297. tC = Ext.getCmp('servopPanel03');
  298. if( tC != undefined ){
  299. tC.removeClass('servopInfo_item20');
  300. tC.addClass('servopInfo_item21');
  301. tC.enable();
  302. Ext.getCmp('tbtn_sop03').enable();
  303. };
  304. //tC.doLayout();
  305. tC = Ext.getCmp('servopPanel04');
  306. if( tC != undefined ){
  307. tC.removeClass('servopInfo_item30');
  308. tC.addClass('servopInfo_item31');
  309. tC.enable();
  310. Ext.getCmp('tbtn_sop04').enable();
  311. };
  312. //tC.doLayout();
  313. };
  314. function updateServerStatus(){
  315. Ext.Ajax.request({
  316. url: '/lib/controller/getServerStatus.php',
  317. params: {
  318. SERVID: 1,
  319. UID: <?=$UserID;?>,
  320. SID: '<?=$Session;?>'
  321. },
  322. success: function( response, opts ){
  323. // If the response is JSON, you have to decode it
  324. var sps = document.getElementById("INFO_SPS");
  325. if( sps == undefined ) return;
  326. var data = Ext.decode(response.responseText);
  327. if( data.status == 'ok' ){
  328. serverIsOnLine = true;
  329. enableServOps();
  330. //document.getElementById('HW_NFO').innerHTML = data.stats.hw_info;
  331. //document.getElementById('OS_NFO').innerHTML = data.stats.os_info;
  332. //document.getElementById('BLD_NFO').innerHTML = data.stats.build;
  333. setDonatStatus( 1, 0, data.stats.stat_cpu15 );
  334. setDonatStatus( 1, 1, data.stats.stat_mem );
  335. setDonatStatus( 1, 2, data.stats.stat_disk );
  336. setDonatStatus( 1, 3, data.stats.temp0 );
  337. sps.classList.remove('setEd_infoPanel');
  338. sps.classList.add('setEl_infoPanel');
  339. } else {
  340. serverIsOnLine = false;
  341. disableServOps();
  342. if( data.status == 'na' ){
  343. setDonatStatus( 1, 0, -1 );
  344. setDonatStatus( 1, 1, -1 );
  345. setDonatStatus( 1, 2, -1 );
  346. setDonatStatus( 1, 3, -1 );
  347. sps.classList.remove('setEl_infoPanel');
  348. sps.classList.add('setEd_infoPanel');
  349. } else {
  350. Ext.Msg.show({
  351. title:'<?=$Labels->GetLabel("_INFO_MSG_");?>',
  352. msg: data.messages,
  353. buttons: Ext.Msg.OK,//YESNOCANCEL,
  354. fn: function(){
  355. },
  356. icon: Ext.MessageBox.INFO //QUESTION
  357. });
  358. };
  359. };
  360. if( tlInterval == null ){
  361. tlInterval = window.setInterval( updateServerStatus, 1200, selectedSite );
  362. };
  363. },
  364. failure: failureAJAXFunction
  365. });
  366. };
  367. var addE2UDialog = null;
  368. function addEthernet2Uart(){
  369. if( addE2UDialog == null ){
  370. addE2UDialog = new Ext.Window({
  371. modal: true,
  372. title: '<?=$Labels->GetLabel('_ADD_E2U_DIAL_TTL_');?>',
  373. width: 400,
  374. height: 560,
  375. layout: 'fit',
  376. closeAction: 'hide',
  377. items:[{
  378. xtype: 'form',
  379. labelWidth: 120, // label settings here cascade unless overridden
  380. frame: false,
  381. width: 400,
  382. labelAlign: 'right',
  383. //bodyStyle:'padding:5px 5px 0',
  384. defaultType: 'textfield',
  385. items:[{
  386. xtype: 'panel',
  387. height: 200,
  388. frame: false,
  389. border: false,
  390. html: '<center><img width="200px" src="/style/assets/eth2uart.png"></center>'
  391. },{
  392. fieldLabel: 'Name',
  393. id: 'ued_name'
  394. },{
  395. xtype: 'combo',
  396. fieldLabel: '<?=$Labels->GetLabel('_CONNECT_2_');?>',
  397. id: 'ued_servid',
  398. editable: false,
  399. typeAhead: true,
  400. triggerAction: 'all',
  401. width: '100%',
  402. lazyRender:true,
  403. mode: 'local',
  404. store: new Ext.data.ArrayStore({
  405. <?php
  406. $QS = "SELECT `id`, `name` FROM `nodes` WHERE `type`=0";
  407. $Servers = $DATABASE->Query( $QS );
  408. $SLIST = array();
  409. $SSID = 0;
  410. if( count( $Servers ) ){
  411. foreach( $Servers as $A ) $SLIST[] = '['.$A['id'].',\''.$A['name'].'\']';
  412. $SSID = intval( $Servers[0]['id'] );
  413. };
  414. //[1,'Server Node'], [2,'Aux Server']
  415. ?>
  416. fields: ['sid', 'snam'],
  417. data: [<?=implode(',',$SLIST);?>]
  418. }),
  419. value: <?=$SSID;?>,
  420. valueField: 'sid',
  421. displayField: 'snam'
  422. },{
  423. xtype: 'combo',
  424. fieldLabel: '<?=$Labels->GetLabel('UART_COM_SPEED');?>',
  425. id: 'ued_speed',
  426. editable: false,
  427. typeAhead: true,
  428. triggerAction: 'all',
  429. width: '100%',
  430. lazyRender:true,
  431. mode: 'local',
  432. store: new Ext.data.ArrayStore({
  433. fields: ['speed'],
  434. data: [[19200], [115200]]
  435. }),
  436. value: 19200,
  437. valueField: 'speed',
  438. displayField: 'speed'
  439. },{
  440. xtype: 'combo',
  441. fieldLabel: '<?=$Labels->GetLabel('UART_COM_BITS');?>',
  442. id: 'ued_bit',
  443. editable: false,
  444. typeAhead: true,
  445. triggerAction: 'all',
  446. width: '100%',
  447. lazyRender:true,
  448. mode: 'local',
  449. store: new Ext.data.ArrayStore({
  450. fields: ['bits'],
  451. data: [[5],[6],[7],[8],[9]]
  452. }),
  453. value: 8,
  454. valueField: 'bits',
  455. displayField: 'bits'
  456. },{
  457. xtype: 'combo',
  458. fieldLabel: '<?=$Labels->GetLabel('UART_COM_SBITS');?>',
  459. id: 'ued_stops',
  460. editable: false,
  461. typeAhead: true,
  462. triggerAction: 'all',
  463. width: '100%',
  464. lazyRender:true,
  465. mode: 'local',
  466. store: new Ext.data.ArrayStore({
  467. fields: ['stops'],
  468. data: [[1],[1.5],[2]]
  469. }),
  470. value: 1,
  471. valueField: 'stops',
  472. displayField: 'stops'
  473. },{
  474. xtype: 'combo',
  475. fieldLabel: '<?=$Labels->GetLabel('UART_COM_PARITY');?>',
  476. id: 'ued_parity',
  477. editable: false,
  478. typeAhead: true,
  479. triggerAction: 'all',
  480. width: '100%',
  481. lazyRender:true,
  482. mode: 'local',
  483. store: new Ext.data.ArrayStore({
  484. fields: ['parity'],
  485. data: [['Odd'], ['Even'],['None']]
  486. }),
  487. value: 'None',
  488. valueField: 'parity',
  489. displayField: 'parity'
  490. },{
  491. xtype: 'combo',
  492. fieldLabel: '<?=$Labels->GetLabel('_WORKING_MODE_');?>',
  493. id: 'ued_mode',
  494. editable: false,
  495. typeAhead: true,
  496. triggerAction: 'all',
  497. width: '100%',
  498. lazyRender:true,
  499. mode: 'local',
  500. store: new Ext.data.ArrayStore({
  501. fields: ['mode','mode_txt'],
  502. data: [[0,'<?=$Labels->GetLabel('_UDP_CLIENT_');?>'], [1,'<?=$Labels->GetLabel('_TCP_CLIENT_');?>'], [2,'<?=$Labels->GetLabel('_UDP_SERVER_');?>'], [3,'<?=$Labels->GetLabel('_TCP_SERVER_');?>']]
  503. }),
  504. value: 3,
  505. valueField: 'mode',
  506. displayField: 'mode_txt'
  507. },{
  508. fieldLabel: '<?=$Labels->GetLabel('_DEVICE_IP_');?>',
  509. id: 'ued_ip'
  510. },{
  511. fieldLabel: '<?=$Labels->GetLabel('_DEVICE_PORT_');?>',
  512. value: 8234,
  513. id: 'ued_port'
  514. }],
  515. bbar: [{
  516. text: 'Cancel',
  517. handler: function(){//discoverOnvifSources
  518. addE2UDialog.hide();
  519. }
  520. },'->',{
  521. id: 'con_to_src',
  522. text: 'Add Adapter to Site',
  523. disabled: false,
  524. handler: function(){
  525. var SPD = Ext.getCmp('ued_speed').getValue();
  526. var BIT = Ext.getCmp('ued_bit').getValue();
  527. var STP = Ext.getCmp('ued_stops').getValue();
  528. var PAR = Ext.getCmp('ued_parity').getValue();
  529. var MOD = Ext.getCmp('ued_mode').getValue();
  530. var IP = Ext.getCmp('ued_ip').getValue();
  531. var PORT= Ext.getCmp('ued_port').getValue();
  532. var MAC = '';//Ext.getCmp('ued_mac').getValue();
  533. var NAME= Ext.getCmp('ued_name').getValue();
  534. var SRV = Ext.getCmp('ued_servid').getValue();
  535. Ext.Ajax.request({
  536. url: '/lib/controller/addNetworkNode.php',
  537. params: {
  538. SITEID: <?=$SiteID;?>,
  539. TYPE: 20,
  540. UART_SPEED: SPD,
  541. UART_BITS: BIT,
  542. UART_STOP: STP,
  543. UART_PAR: PAR,
  544. UART_MODE: MOD,
  545. UART_IP: IP,
  546. UART_PORT: PORT,
  547. UART_MAC: MAC,
  548. UART_NAME: NAME,
  549. UID: <?=$UserID;?>,
  550. SRVID: SRV,
  551. SID: '<?=$Session;?>'
  552. },
  553. success: function( response, opts ){
  554. var data = Ext.decode(response.responseText);
  555. if( data.sucess == false ){
  556. Ext.Msg.show({
  557. title:'Request Failure!',
  558. msg: data.error,
  559. buttons: Ext.Msg.OK,
  560. icon: Ext.MessageBox.INFO
  561. });
  562. } else {
  563. loadSystemEditor();
  564. };
  565. addE2UDialog.hide();
  566. },
  567. failure: function( response, opts ) {
  568. failureAJAXFunction( response, opts );
  569. addE2UDialog.hide();
  570. }
  571. });
  572. }
  573. }]
  574. }]
  575. });
  576. };
  577. addE2UDialog.show();
  578. };
  579. var addDetCamDialog = null;
  580. var addDetCamWM = null;
  581. function addDetectedIPCam(){
  582. if( addDetCamDialog == null ){
  583. addDetCamDialog = new Ext.Window({
  584. modal: true,
  585. title: '<?=$Labels->GetLabel('_ADD_CAM_DIAL_TTL_');?>',
  586. width: 400,
  587. height: 187,
  588. layout: 'form',
  589. closeAction: 'hide',
  590. labelWidth: 160,
  591. labelAlign: 'right',
  592. items:[{
  593. xtype: 'spacer',
  594. height: 8
  595. },{
  596. xtype: 'textfield',
  597. id: 'ncam_ip',
  598. fieldLabel: 'Camera IP Address',
  599. value: ''
  600. },{
  601. xtype: 'textfield',
  602. id: 'ncam_user',
  603. fieldLabel: 'Access Login',
  604. value: ''
  605. },{
  606. xtype: 'textfield',
  607. id: 'ncam_pwd',
  608. inputType: 'password',
  609. fieldLabel: 'Access Password',
  610. value: ''
  611. },{
  612. xtype: 'combo',
  613. id: 'ncam_auth_mode',
  614. fieldLabel: '<?=$Labels->GetLabel('_AUTH_MODE_0_');?>',
  615. lazyRender: true,
  616. mode: 'local',
  617. forceSelection: true,
  618. triggerAction: 'all',
  619. editable: false,
  620. disableKeyFilter: true,
  621. store: new Ext.data.ArrayStore({
  622. fields: ['mode','mode_txt'],
  623. data: [
  624. [0,'BASIC'],
  625. [1,'DIGEST'],
  626. [2,'DIGEST_IE'],
  627. [3,'BEARER'],
  628. [4,'NEGOTIATE'],
  629. [5,'NTLM'],
  630. [6,'NTLM_WB'],
  631. [7,'ANY'],
  632. [8,'ANYSAFE'],
  633. [9,'ONLY'],
  634. [10,'AWS_SIGV4']
  635. ]
  636. }),
  637. valueField: 'mode',
  638. displayField: 'mode_txt',
  639. value: 0,
  640. width: 200
  641. },{
  642. xtype: 'spacer',
  643. height: 8
  644. },{
  645. xtype:'button',
  646. width: '100%',
  647. text: 'Add Camera to List',
  648. handler: function(){
  649. addDetCamWM = new Ext.LoadMask( addDetCamDialog.getEl(), {msg:"<?=$Labels->GetLabel('_Please_Wait_');?>..."});
  650. addDetCamWM.show();
  651. var NIP = Ext.getCmp('ncam_ip').getValue();
  652. var NUU = Ext.getCmp('ncam_user').getValue();
  653. var NPP = Ext.getCmp('ncam_pwd').getValue();
  654. var NAM = Ext.getCmp('ncam_auth_mode').getValue();
  655. Ext.Ajax.request({
  656. url: '/lib/controller/doCameraOperation.php',
  657. params: {
  658. UID: <?=$UserID;?>,
  659. SID: '<?=$Session;?>',
  660. IP: NIP,
  661. UU: NUU,
  662. PP: NPP,
  663. AU: NAM,
  664. CMD: 2
  665. },
  666. success: function( response, opts ){
  667. addDetCamWM.hide();
  668. var data = Ext.decode(response.responseText);
  669. if( data.status == 'ok' ){
  670. Ext.Msg.show({
  671. title:'Sucess!',
  672. msg: data.msg,
  673. buttons: Ext.Msg.OK,
  674. icon: Ext.MessageBox.INFO
  675. });
  676. loadDetectedCameras();
  677. } else {
  678. Ext.Msg.show({
  679. title:'Error!',
  680. msg: data.msg,
  681. buttons: Ext.Msg.OK,
  682. icon: Ext.MessageBox.WARNING
  683. });
  684. };
  685. addDetCamDialog.hide();
  686. },
  687. failure: failureAJAXFunction
  688. });
  689. }
  690. }]
  691. });
  692. };
  693. addDetCamDialog.show();
  694. };
  695. function showSettingsGeneral(){
  696. stopStatusUpdater();
  697. content_lvl1 = 1;
  698. content_lvl2 = 4;
  699. var tPanel = Ext.getCmp('main_content');
  700. tPanel.removeAll( true );
  701. <?php
  702. //$QS="SELECT * FROM `servers` WHERE `id`=1";
  703. //$SDD = $DATABASE->Query( $QS );
  704. //$NData = $SDD[0];
  705. $QS="SELECT * FROM `resources` WHERE `node_id`=1 AND ( `type`=101 OR `type`=102 )";
  706. $CN = $DATABASE->Query( $QS );
  707. $IL=array();
  708. foreach( $CN as $N ){
  709. $QS="SELECT * FROM `networks` WHERE `nif_id`={$N['aux_id']} AND `type`=0";
  710. $NWD = $DATABASE->Query( $QS );
  711. $NW = $NWD[0];
  712. $IL[]="<td width=\"50px\"><img width=\"32\" src=\"/style/assets/".(($N['type']==101)?'NICs.png':'wifi-icon.png')."\"></td><td align=\"right\"><b>{$N['device']}:</b></td><td><b>{$NW['address']}</b></td>";
  713. };
  714. $NIFO = '<table><tr>' . implode( '</tr><tr>', $IL ) . '</tr></table>';
  715. ?>
  716. tPanel.add({
  717. xtype: 'tabpanel',
  718. frame: false,
  719. id: 'node_settings_content',
  720. border: false,
  721. activeTab: content_lvl3,
  722. items: [{
  723. xtype: 'panel',
  724. id: 'gi_tab',
  725. title: 'General Info',
  726. layout: 'hbox',
  727. items:[{
  728. xtype: 'panel',
  729. flex: 1,
  730. height: PanelH-15,
  731. autoScroll: false,
  732. html: '<table width="100%" height="100%" border=0><tr><td height="290px" align="center" valign="middle"><div class="server_img_set"></div></td></tr>\
  733. <tr><td height="100px"><table width="100%" border=0><tr>\
  734. <td align="center"><svg class="donut" width="80" height="100%" viewBox="0 0 42 42"><circle id="status_1_donut0_segment2" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#b1c94e" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut0_segment3" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#aaddff" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut0_segment1" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#ce4b99" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><g class="chart-text"><text x="50%" y="50%" class="chart-number" id="status_1_totalValue0">0</text><text x="50%" y="50%" class="chart-label">CPU</text></g></svg></td>\
  735. <td align="center"><svg class="donut" width="80" height="100%" viewBox="0 0 42 42"><circle id="status_1_donut1_segment2" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#b1c94e" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut1_segment3" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#aaddff" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut1_segment1" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#ce4b99" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><g class="chart-text"><text x="50%" y="50%" class="chart-number" id="status_1_totalValue1">0</text><text x="50%" y="50%" class="chart-label">MEM</text></g></svg></td>\
  736. <td align="center"><svg class="donut" width="80" height="100%" viewBox="0 0 42 42"><circle id="status_1_donut2_segment2" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#b1c94e" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut2_segment3" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#aaddff" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut2_segment1" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#ce4b99" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><g class="chart-text"><text x="50%" y="50%" class="chart-number" id="status_1_totalValue2">0</text><text x="50%" y="50%" class="chart-label">DISK</text></g></svg></td>\
  737. <td align="center"><svg class="donut" width="80" height="100%" viewBox="0 0 42 42"><circle id="status_1_donut3_segment2" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#b1c94e" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut3_segment3" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#aaddff" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut3_segment1" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#ce4b99" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><g class="chart-text"><text x="50%" y="50%" class="chart-number" id="status_1_totalValue3">0</text><text x="50%" y="50%" class="chart-label">TEMP</text></g></svg></td>\
  738. </tr></table></td></tr>\
  739. <tr><td valign="top"><div class="setEd_infoPanel" id="INFO_SPS">\
  740. <div class="sideInfo_item" id="SW_INFO"><?=$AP_DATA['build'];?></div>\
  741. <div class="sideInfo_item" id="OS_INFO"><?=$AP_DATA['os_info'];?></div>\
  742. <div class="sideInfo_item" id="HW_INFO"><?=$AP_DATA['hw_info'];?></div>\
  743. </div></td></tr>\
  744. <tr><td height="60%">&nbsp;</td></tr></table>'
  745. },{
  746. xtype: 'panel',
  747. id: '_ed_small',
  748. flex: 1,
  749. height: PanelH-15,
  750. autoScroll: false,
  751. items:[{
  752. xtype: 'panel',
  753. baseCls:'servopInfo_item00',
  754. id: 'servopPanel01',
  755. items:[{
  756. xtype: 'panel',
  757. frame: false,
  758. border: false,
  759. unstyled: true,
  760. html: '<p><?=$Labels->GetLabel('_SERV_RESTART_DESC_');?></p><br/>'
  761. },{
  762. xtype: 'button',
  763. lazyRender: true,
  764. iconCls: 'srv_op_restart',
  765. text: '<?=$Labels->GetLabel('_SERV_RESTART_OP_');?>',
  766. id: 'tbtn_sop01',
  767. scale: 'large',
  768. width: '95%',
  769. disabled: true,
  770. handler: function( bt ){
  771. Ext.Msg.show({
  772. title:'<?=$Labels->GetLabel('_SERV_RESTART_QT_');?>',
  773. msg: '<?=$Labels->GetLabel('_SERV_RESTART_QM_');?>',
  774. buttons: Ext.Msg.YESNO,
  775. width: 400,
  776. icon: Ext.MessageBox.INFO,
  777. fn: function(btn, text){
  778. if( btn == 'yes' ){
  779. disableServOps();
  780. doDeviceOperation( 1, 250,'', true );
  781. };
  782. }
  783. });
  784. }
  785. }]
  786. },{
  787. xtype: 'spacer',
  788. height: 8
  789. },{
  790. xtype: 'panel',
  791. baseCls:'servopInfo_item10',
  792. id: 'servopPanel02',
  793. items:[{
  794. xtype: 'panel',
  795. frame: false,
  796. border: false,
  797. unstyled: true,
  798. html: '<p><?=$Labels->GetLabel('_SERV_HW_DET_DESC_');?></p><br/>'
  799. },{
  800. xtype: 'button',
  801. iconCls: 'srv_op_hw_init',
  802. text: '<?=$Labels->GetLabel('_SERV_HW_DET_OP_');?>',
  803. id: 'tbtn_sop02',
  804. scale: 'large',
  805. width: '95%',
  806. disabled: true,
  807. handler: function( bt ){
  808. Ext.Msg.show({
  809. title:'<?=$Labels->GetLabel('_SERV_HW_DET_QT_');?>',
  810. msg: '<?=$Labels->GetLabel('_SERV_HW_DET_QM_');?>',
  811. buttons: Ext.Msg.YESNO,
  812. width: 400,
  813. icon: Ext.MessageBox.INFO,
  814. fn: function(btn, text){
  815. if( btn == 'yes' ){
  816. disableServOps();
  817. doDeviceOperation( 1, 251,'', true );
  818. };
  819. }
  820. });
  821. }
  822. }]
  823. },{
  824. xtype: 'spacer',
  825. height: 8
  826. },{
  827. xtype: 'panel',
  828. baseCls:'servopInfo_item20',
  829. id: 'servopPanel03',
  830. items:[{
  831. xtype: 'panel',
  832. frame: false,
  833. border: false,
  834. unstyled: true,
  835. html: '<p><?=$Labels->GetLabel('_SERV_OSRESET_DESC_');?></p><br/>'
  836. },{
  837. xtype: 'button',
  838. iconCls: 'srv_op_power_cycle',
  839. text: '<?=$Labels->GetLabel('_SERV_OSRESET_OP_');?>',
  840. id: 'tbtn_sop03',
  841. scale: 'large',
  842. width: '95%',
  843. disabled: true,
  844. handler: function( bt ){
  845. Ext.Msg.show({
  846. title:'<?=$Labels->GetLabel('_SERV_OSRESET_QT_');?>',
  847. msg: '<?=$Labels->GetLabel('_SERV_OSRESET_QM_');?>',
  848. buttons: Ext.Msg.YESNO,
  849. width: 400,
  850. icon: Ext.MessageBox.WARNING,
  851. fn: function(btn, text){
  852. if( btn == 'yes' ){
  853. cleanupChangeNotifier();
  854. } else {
  855. loadEditor = false;
  856. };
  857. }
  858. });
  859. }
  860. }]
  861. },{
  862. xtype: 'spacer',
  863. height: 8
  864. },{
  865. xtype: 'panel',
  866. baseCls:'servopInfo_item30',
  867. id: 'servopPanel04',
  868. items:[{
  869. xtype: 'panel',
  870. frame: false,
  871. border: false,
  872. unstyled: true,
  873. html: '<p><?=$Labels->GetLabel('_SERV_FACTORY_DESC_');?></p><br/>'
  874. },{
  875. xtype: 'button',
  876. iconCls: 'srv_op_factory_reset',
  877. text: '<?=$Labels->GetLabel('_SERV_FACTORY_OP_');?>',
  878. id: 'tbtn_sop04',
  879. scale: 'large',
  880. width: '95%',
  881. disabled: true,
  882. handler: function( bt ){
  883. Ext.Msg.show({
  884. title:'<?=$Labels->GetLabel('_SERV_FACTORY_QT_');?>',
  885. msg: '<?=$Labels->GetLabel('_SERV_FACTORY_QM_');?>',
  886. buttons: Ext.Msg.YESNO,
  887. width: 400,
  888. icon: Ext.MessageBox.ERROR,
  889. fn: function(btn, text){
  890. if( btn == 'yes' ){
  891. disableServOps();
  892. doDeviceOperation( 1, 254,'', true );
  893. };
  894. }
  895. });
  896. }
  897. }]
  898. }]
  899. }]
  900. },{
  901. xtype: 'panel',
  902. title: 'Resources',
  903. id: 'res_tab',
  904. layout: 'hbox',
  905. items:[{
  906. xtype: 'panel',
  907. id: 'resources_container',
  908. flex: 1,
  909. height: PanelH-15,
  910. autoScroll: 'auto',
  911. tbar:[{
  912. text: '<?=$Labels->GetLabel( '_ADD_REMOTE_UART_' );?>',
  913. handler: function(){
  914. addEthernet2Uart();
  915. }
  916. }],
  917. items:[]
  918. },{
  919. xtype: 'panel',
  920. id: 'res_ed_small',
  921. flex: 1,
  922. height: PanelH-15,
  923. layout: 'fit',
  924. items:[{
  925. html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>'
  926. }]
  927. }]
  928. },{
  929. xtype: 'panel',
  930. title: 'Modules',
  931. id: 'mod_tab',
  932. layout: 'hbox',
  933. items:[{
  934. xtype: 'panel',
  935. id: 'modules_container',
  936. flex: 1,
  937. height: PanelH-15,
  938. autoScroll: 'auto',
  939. tbar:[{
  940. text: 'Add Module',
  941. handler: function(){
  942. var addModuleWindow = new Ext.Window({
  943. id: 'huha_boa',
  944. title: 'Add Server Module',
  945. modal: true,
  946. width: 400,
  947. height: 300,
  948. items:[{
  949. xtype: 'form',
  950. items: [{
  951. xtype: 'combo',
  952. fieldLabel: "<?=$Labels->GetLabel( 'MOD_TYPE' );?>",
  953. id: 'mod_type',
  954. lazyRender: true,
  955. mode: 'local',
  956. forceSelection: true,
  957. triggerAction: 'all',
  958. editable: false,
  959. disableKeyFilter: true,
  960. store: new Ext.data.ArrayStore({
  961. fields: ['az_t','az_txt'],
  962. data: [<?php
  963. $QS = "SELECT * FROM `module_types`";
  964. $MM = $DATABASE->Query( $QS );
  965. $MIMO = array();
  966. foreach( $MM as $M ) $MIMO[]="[{$M['id']},'".$Labels->GetLabel($M['name'])."']";
  967. echo implode( ',', $MIMO );
  968. ?>]
  969. }),
  970. valueField: 'az_t',
  971. displayField: 'az_txt',
  972. value: 1,
  973. listeners:{
  974. select: function( t, r, i ){
  975. var n = r.data.az_t;
  976. Ext.Ajax.request({
  977. url: '/lib/controller/getModuleInfo.php',
  978. params: {
  979. MID: n,
  980. UID: <?=$UserID;?>,
  981. SID: '<?=$Session;?>'
  982. },
  983. success: function( response, opts ){
  984. Ext.getCmp('infopan').update( response.responseText );
  985. }
  986. });
  987. }
  988. }
  989. },{
  990. xtype: 'panel',
  991. id: 'infopan',
  992. html: ''
  993. }]
  994. }],
  995. bbar:[{
  996. text: 'Cancel',
  997. handler: function(){
  998. addModuleWindow.close();
  999. }
  1000. },{
  1001. text: 'Add Module',
  1002. handler: function(){
  1003. var mtyp = Ext.getCmp('mod_type').getValue();
  1004. Ext.Ajax.request({
  1005. url: '/lib/controller/addModule.php',
  1006. params: {
  1007. SERVID: 1,
  1008. TYPE: mtyp,
  1009. UID: <?=$UserID;?>,
  1010. SID: '<?=$Session;?>'
  1011. },
  1012. success: function( response, opts ){
  1013. // If the response is JSON, you have to decode it
  1014. var data = Ext.decode(response.responseText);
  1015. if( data.status == 'ok' ){
  1016. addModuleWindow.close();
  1017. loadModules();
  1018. } else {
  1019. Ext.Msg.show({
  1020. title:'<?=$Labels->GetLabel("_INFO_MSG_");?>',
  1021. msg: data.message,
  1022. buttons: Ext.Msg.OK,//YESNOCANCEL,
  1023. fn: function(){
  1024. //SettingsLidar3D.hide();
  1025. },
  1026. icon: Ext.MessageBox.INFO //QUESTION
  1027. });
  1028. }
  1029. },
  1030. failure: failureAJAXFunction
  1031. });
  1032. }
  1033. }]
  1034. });
  1035. addModuleWindow.show();
  1036. }
  1037. }],
  1038. items:[]
  1039. },{
  1040. xtype: 'panel',
  1041. id: 'mod_ed_small',
  1042. flex: 1,
  1043. height: PanelH-15,
  1044. layout: 'fit',
  1045. items:[{
  1046. html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>'
  1047. }]
  1048. }]
  1049. },{
  1050. xtype: 'panel',
  1051. id: 'net_tab',
  1052. title: 'Filters',
  1053. items:[]
  1054. }],
  1055. listeners:{
  1056. tabchange: function( tp, t ){
  1057. switch( t.getId() ){
  1058. case 'gi_tab': {
  1059. content_lvl3=0;
  1060. updateServerStatus();
  1061. break;
  1062. };
  1063. case 'res_tab': {
  1064. content_lvl3=1;
  1065. stopStatusUpdater();
  1066. loadRessources();
  1067. break;
  1068. };
  1069. case 'mod_tab':{
  1070. content_lvl3=2;
  1071. stopStatusUpdater();
  1072. loadModules();
  1073. break;
  1074. };
  1075. case 'net_tab':{
  1076. content_lvl3=3;
  1077. stopStatusUpdater();
  1078. break;
  1079. };
  1080. };
  1081. updateUserContent();
  1082. },
  1083. afterrender: function(){
  1084. settingsAreChanged = false;
  1085. }
  1086. },
  1087. updateSettings: function(){
  1088. alert('Update Settings');
  1089. }
  1090. });
  1091. tPanel.doLayout();
  1092. updateServerStatus();
  1093. };
  1094. function showSettingsSensors(){
  1095. stopStatusUpdater();
  1096. content_lvl1 = 1;
  1097. content_lvl2 = 4;
  1098. var tPanel = Ext.getCmp('main_content');
  1099. tPanel.removeAll( true );
  1100. tPanel.doLayout();
  1101. updateServerStatus();
  1102. };
  1103. var cameraEditorContent = null;
  1104. function editCamera( cid, etyp ){
  1105. SelectedCam = cid;
  1106. switch( etyp ){
  1107. case 0: cameraEditorContent = Ext.getCmp('dcam_op_small'); break;
  1108. };
  1109. Ext.Ajax.request({
  1110. url: '/lib/controller/getCameraEditor.php',
  1111. params: {
  1112. CID: SelectedCam,
  1113. UID: <?=$UserID;?>,
  1114. SID: '<?=$Session;?>'
  1115. },
  1116. success: function( response, opts ){
  1117. var data = Ext.decode( response.responseText );
  1118. if( data.status == 'ok' ){
  1119. if( cameraEditorContent!= null ){
  1120. var content = Ext.decode( data.content );
  1121. cameraEditorContent.removeAll( true );
  1122. cameraEditorContent.add( content );
  1123. cameraEditorContent.doLayout();
  1124. };
  1125. } else {
  1126. if( cameraEditorContent!= null ){
  1127. cameraEditorContent.removeAll( true );
  1128. cameraEditorContent.add( data );
  1129. cameraEditorContent.doLayout();
  1130. };
  1131. };
  1132. },
  1133. failure: function( response, opts ) {
  1134. //Ext.getCmp('cam_login').setValue('');
  1135. Ext.getCmp('cam_password').setValue('');
  1136. Ext.getCmp('cac_tab').enable();
  1137. Ext.getCmp('str_tab').disable();
  1138. Ext.getCmp('ptz_tab').disable();
  1139. Ext.getCmp('loc_tab').disable();
  1140. Ext.getCmp('coc_tabs').setActiveTab( 0 );
  1141. sourceListStore.removeAll();
  1142. }
  1143. });
  1144. };
  1145. function showSettingsVideo(){
  1146. stopStatusUpdater();
  1147. content_lvl1 = 1;
  1148. content_lvl2 = 4;
  1149. var tPanel = Ext.getCmp('main_content');
  1150. tPanel.removeAll( true );
  1151. tPanel.add({
  1152. xtype: 'tabpanel',
  1153. frame: false,
  1154. id: 'node_settings_content',
  1155. border: false,
  1156. activeTab: content_lvl3,
  1157. items: [{
  1158. xtype: 'panel',
  1159. title: 'Detected Cameras',
  1160. id: 'cam_det_tab',
  1161. layout: 'hbox',
  1162. items:[{
  1163. xtype: 'panel',
  1164. id: 'dcam_container',
  1165. flex: 1,
  1166. height: PanelH-15,
  1167. autoScroll: 'auto',
  1168. tbar:[{
  1169. text: '<?=$Labels->GetLabel( '_MANUADD_CAMERA_' );?>',
  1170. handler: function(){
  1171. addDetectedIPCam();
  1172. }
  1173. }],
  1174. items:[]
  1175. },{
  1176. xtype: 'panel',
  1177. id: 'dcam_op_small',
  1178. flex: 1,
  1179. height: PanelH-15,
  1180. layout: 'fit',
  1181. items:[{
  1182. html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>'
  1183. }]
  1184. }]
  1185. },{
  1186. xtype: 'panel',
  1187. id: 'gi_tab',
  1188. title: 'Assigned Cameras',
  1189. layout: 'hbox',
  1190. items:[{
  1191. xtype: 'panel',
  1192. flex: 1,
  1193. height: PanelH-15,
  1194. autoScroll: false,
  1195. html: '<table width="100%" height="100%" border=0><tr><td height="290px" align="center" valign="middle"><div class="server_img_set"></div></td></tr>\
  1196. <tr><td height="100px"><table width="100%" border=0><tr>\
  1197. <td align="center"><svg class="donut" width="80" height="100%" viewBox="0 0 42 42"><circle id="status_1_donut0_segment2" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#b1c94e" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut0_segment3" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#aaddff" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut0_segment1" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#ce4b99" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><g class="chart-text"><text x="50%" y="50%" class="chart-number" id="status_1_totalValue0">0</text><text x="50%" y="50%" class="chart-label">CPU</text></g></svg></td>\
  1198. <td align="center"><svg class="donut" width="80" height="100%" viewBox="0 0 42 42"><circle id="status_1_donut1_segment2" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#b1c94e" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut1_segment3" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#aaddff" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut1_segment1" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#ce4b99" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><g class="chart-text"><text x="50%" y="50%" class="chart-number" id="status_1_totalValue1">0</text><text x="50%" y="50%" class="chart-label">MEM</text></g></svg></td>\
  1199. <td align="center"><svg class="donut" width="80" height="100%" viewBox="0 0 42 42"><circle id="status_1_donut2_segment2" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#b1c94e" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut2_segment3" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#aaddff" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut2_segment1" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#ce4b99" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><g class="chart-text"><text x="50%" y="50%" class="chart-number" id="status_1_totalValue2">0</text><text x="50%" y="50%" class="chart-label">DISK</text></g></svg></td>\
  1200. <td align="center"><svg class="donut" width="80" height="100%" viewBox="0 0 42 42"><circle id="status_1_donut3_segment2" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#b1c94e" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut3_segment3" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#aaddff" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut3_segment1" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#ce4b99" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><g class="chart-text"><text x="50%" y="50%" class="chart-number" id="status_1_totalValue3">0</text><text x="50%" y="50%" class="chart-label">TEMP</text></g></svg></td>\
  1201. </tr></table></td></tr>\
  1202. <tr><td valign="top"><div class="setEd_infoPanel" id="INFO_SPS">\
  1203. <div class="sideInfo_item" id="SW_INFO"><?=$AP_DATA['build'];?></div>\
  1204. <div class="sideInfo_item" id="OS_INFO"><?=$AP_DATA['os_info'];?></div>\
  1205. <div class="sideInfo_item" id="HW_INFO"><?=$AP_DATA['hw_info'];?></div>\
  1206. </div></td></tr>\
  1207. <tr><td height="60%">&nbsp;</td></tr></table>'
  1208. },{
  1209. }]
  1210. }],
  1211. listeners:{
  1212. tabchange: function( tp, t ){
  1213. switch( t.getId() ){
  1214. case 'cam_det_tab': {
  1215. content_lvl3=0;
  1216. stopStatusUpdater();
  1217. loadDetectedCameras();
  1218. break;
  1219. };
  1220. case 'res_tab': {
  1221. content_lvl3=1;
  1222. stopStatusUpdater();
  1223. loadRessources();
  1224. break;
  1225. };
  1226. case 'mod_tab':{
  1227. content_lvl3=2;
  1228. stopStatusUpdater();
  1229. loadModules();
  1230. break;
  1231. };
  1232. case 'net_tab':{
  1233. content_lvl3=3;
  1234. stopStatusUpdater();
  1235. break;
  1236. };
  1237. };
  1238. updateUserContent();
  1239. },
  1240. afterrender: function(){
  1241. settingsAreChanged = false;
  1242. }
  1243. }
  1244. });
  1245. tPanel.doLayout();
  1246. updateServerStatus();
  1247. };
  1248. function showSettingsUpgrade(){
  1249. stopStatusUpdater();
  1250. content_lvl1 = 1;
  1251. content_lvl2 = 4;
  1252. var tPanel = Ext.getCmp('main_content');
  1253. tPanel.removeAll( true );
  1254. tPanel.doLayout();
  1255. updateServerStatus();
  1256. };
  1257. function initSettingsView(){
  1258. if( tlInterval!= null ){
  1259. window.clearInterval( tlInterval );
  1260. tlInterval = null;
  1261. timelineObj = null;
  1262. };
  1263. setUserContent( 210 );
  1264. var tP = Ext.getCmp('left_side_menu');
  1265. tP.doLayout();
  1266. tP.setVisible( false );
  1267. tP.removeAll( true );
  1268. tP.add({
  1269. title: '<?=$Labels->GetLabel('_DET_SETTINGS_');?>',
  1270. layout: 'vbox',
  1271. height: 120,
  1272. pack: 'center',
  1273. align : 'strech',
  1274. collapsed: ( content_lvl1 != 0 ),
  1275. items:[<?php
  1276. if( $AP_DATA['type'] == 1 ){
  1277. ?>
  1278. {
  1279. xtype: 'button',
  1280. width: '100%',
  1281. id:'go_home',
  1282. text: '<?=$Labels->GetLabel('_UPPER_SENSOR_');?>',
  1283. enableToggle: true,
  1284. pressed: ( content_lvl2 == 0 ),
  1285. allowDepress: false,
  1286. toggleGroup: 'det_settings',
  1287. handler: loadDashBoard
  1288. },{
  1289. xtype: 'button',
  1290. width: '100%',
  1291. id:'go_monitor',
  1292. text: '<?=$Labels->GetLabel('_BOTTOM_SENSOR_');?>',
  1293. enableToggle: true,
  1294. pressed: ( content_lvl2 == 1 ),
  1295. allowDepress: false,
  1296. toggleGroup: 'det_settings',
  1297. handler: loadMonitoring
  1298. },{
  1299. xtype: 'button',
  1300. width: '100%',
  1301. id:'go_archive',
  1302. text: '<?=$Labels->GetLabel('_FUSION_ENGINE_');?>',
  1303. enableToggle: true,
  1304. pressed: ( content_lvl2 == 2 ),
  1305. allowDepress: false,
  1306. toggleGroup: 'det_settings',
  1307. handler: loadArchive
  1308. }<?php
  1309. } else {
  1310. if( 1 || intval( $CUser->Data['sipi_enable'] ) ){
  1311. ?>
  1312. {
  1313. xtype: 'button',
  1314. width: '100%',
  1315. id:'go_singleIpi',
  1316. text: '<?=$Labels->GetLabel('_EVT_MONITOR_IPI_');?>',
  1317. enableToggle: true,
  1318. pressed: ( content_lvl2 == 3 ),
  1319. allowDepress: false,
  1320. toggleGroup: 'det_settings',
  1321. handler: loadSingleIPI
  1322. },
  1323. <?php
  1324. };
  1325. ?>
  1326. {
  1327. xtype: 'button',
  1328. width: '100%',
  1329. id:'go_out',
  1330. text: '<?=$Labels->GetLabel('_LOGOUT_');?>',
  1331. handler: doLogout
  1332. }<?php
  1333. };
  1334. ?>]
  1335. });
  1336. tP.add({
  1337. title: '<?=$Labels->GetLabel('_SYS_SETTINGS_');?>',
  1338. layout: 'vbox',
  1339. height: 120,
  1340. pack: 'center',
  1341. align : 'strech',
  1342. collapsed: ( content_lvl1 != 1 ),
  1343. items:[{
  1344. xtype: 'button',
  1345. width: '100%',
  1346. id:'sys_edit',
  1347. text: '<?=$Labels->GetLabel('_SYS_GENERAL_');?>',
  1348. enableToggle: true,
  1349. pressed: ( content_lvl2 == 4 ),
  1350. allowDepress: false,
  1351. toggleGroup: 'sys_settings',
  1352. handler: showSettingsGeneral
  1353. },{
  1354. xtype: 'button',
  1355. width: '100%',
  1356. id:'map_edit',
  1357. text: '<?=$Labels->GetLabel('_SENSOR_CONNECTION_');?>',
  1358. enableToggle: true,
  1359. pressed: ( content_lvl2 == 5 ),
  1360. allowDepress: false,
  1361. toggleGroup: 'sys_settings',
  1362. handler: showSettingsSensors
  1363. },{
  1364. xtype: 'button',
  1365. width: '100%',
  1366. id:'video_set',
  1367. text: '<?=$Labels->GetLabel('_CAMERA_MNGMNT_');?>',
  1368. enableToggle: true,
  1369. pressed: ( content_lvl2 == 6 ),
  1370. allowDepress: false,
  1371. toggleGroup: 'sys_settings',
  1372. handler: showSettingsVideo
  1373. },{
  1374. xtype: 'button',
  1375. width: '100%',
  1376. id:'soft_update',
  1377. text: '<?=$Labels->GetLabel('_UPGRADE_MNGMNT_');?>',
  1378. enableToggle: true,
  1379. pressed: ( content_lvl2 == 7 ),
  1380. allowDepress: false,
  1381. toggleGroup: 'sys_settings',
  1382. handler: showSettingsUpgrade
  1383. }]
  1384. });
  1385. tP.add({
  1386. title: '<?=$Labels->GetLabel('_NET_SETTINGS_');?>',
  1387. collapsed: ( content_lvl1 != 2 ),
  1388. items:[{
  1389. xtype: 'button',
  1390. width: '100%',
  1391. text: 'Ethernet',
  1392. enableToggle: true,
  1393. pressed: ( content_lvl2 == 8 ),
  1394. allowDepress: false,
  1395. id:'ethernet',
  1396. },{
  1397. xtype: 'button',
  1398. width: '100%',
  1399. text: 'WiFi',
  1400. enableToggle: true,
  1401. pressed: ( content_lvl2 == 9 ),
  1402. allowDepress: false,
  1403. id:'wifi',
  1404. },{
  1405. xtype: 'button',
  1406. width: '100%',
  1407. text: 'Integration',
  1408. enableToggle: true,
  1409. pressed: ( content_lvl2 == 10 ),
  1410. allowDepress: false,
  1411. id:'api_serv',
  1412. }]
  1413. });
  1414. tP.add({
  1415. title: '<?=$Labels->GetLabel('_PROF_SETTINGS_');?>',
  1416. items:[]
  1417. });
  1418. <?php
  1419. if( $CUser->Data['access'] > 5 ){
  1420. ?>tP.add({
  1421. title: '<?=$Labels->GetLabel('_ADM_SETTINGS_');?>',
  1422. collapsed: ( content_lvl1 != 3 ),
  1423. items:[{
  1424. xtype: 'button',
  1425. width: '100%',
  1426. id:'adm_acc',
  1427. text: '<?=$Labels->GetLabel('_USERS_MNGMT_');?>',
  1428. enableToggle: true,
  1429. pressed: ( content_lvl2 == 11 ),
  1430. allowDepress: false,
  1431. handler: function( b, e ){
  1432. loadUserEditor();
  1433. }
  1434. },{
  1435. xtype: 'button',
  1436. width: '100%',
  1437. id:'adm_acclog',
  1438. text: '<?=$Labels->GetLabel('_ACC_LOG_');?>',
  1439. enableToggle: true,
  1440. pressed: ( content_lvl2 == 12 ),
  1441. allowDepress: false,
  1442. handler: function( b, e ){
  1443. loadAccessLog();
  1444. }
  1445. },{
  1446. xtype: 'button',
  1447. width: '100%',
  1448. id:'adm_servlog',
  1449. text: '<?=$Labels->GetLabel('_SERV_LOG_');?>',
  1450. enableToggle: true,
  1451. pressed: ( content_lvl2 == 13 ),
  1452. allowDepress: false,
  1453. handler: function( b, e ){
  1454. loadServerLog();
  1455. }
  1456. }]
  1457. });
  1458. <?php
  1459. };
  1460. ?>
  1461. tP.setVisible( true );
  1462. tP.doLayout();
  1463. };