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.

626 lines
15 KiB

​
2 years ago
​
​
​
​
​
12 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
12 months ago
12 months ago
​
​
​
​
​
​
12 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
12 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
12 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
12 months ago
​
​
​
​
​
​
​
​
​
​
​
​
12 months ago
​
​
​
​
​
​
​
​
​
​
​
​
12 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
12 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
12 months ago
12 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
12 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
12 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //<?php require_once('../../js_asm.php'); ?>
  2. function uuidv4() {
  3. return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, c =>
  4. (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
  5. );
  6. }
  7. function ssShowSS() {
  8. if( monitoringActiveSession ){
  9. ssResetTimer();
  10. return;
  11. };
  12. ssStopTimer();
  13. document.removeEventListener( "mousemove", ssResetTimer );
  14. document.removeEventListener( "mousedown", ssResetTimer );
  15. document.removeEventListener( "keypress", ssResetTimer );
  16. document.removeEventListener( "touchmove", ssResetTimer );
  17. document.addEventListener( "mousemove", ssHideSS, false );
  18. document.addEventListener( "mousedown", ssHideSS, false );
  19. document.addEventListener( "keypress", ssHideSS, false );
  20. document.addEventListener( "touchmove", ssHideSS, false );
  21. document.getElementById('ss_bg').className='ss_bg_overlay';
  22. document.getElementById('ss_content').className='ss_overlay';
  23. ssShowTime();
  24. updateSSMode( 1 );
  25. changeContent(0,0,'');
  26. updateUserContent();
  27. showContent();
  28. if( ssInterval == null ){
  29. ssInterval = window.setInterval( ssShowTime, 333 );
  30. };
  31. ssIsActive = true;
  32. autoRiseEvent = true;
  33. };
  34. function ssShowTime(){
  35. document.getElementById('ss_content').style.fontSize = '240px';
  36. var currentdate = new Date();
  37. var cTime = (( currentdate.getHours()<10 )? '0'+currentdate.getHours(): currentdate.getHours() ) + ":" + (( currentdate.getMinutes()<10 )? '0'+currentdate.getMinutes(): currentdate.getMinutes() ) + ":" + (( currentdate.getSeconds()<10 )? '0'+currentdate.getSeconds(): currentdate.getSeconds() );
  38. document.getElementById('ss_content').innerHTML= cTime;
  39. };
  40. function ssResetTimer() {
  41. ssStopTimer();
  42. ssStartTimer();
  43. };
  44. function ssStartTimer() {
  45. if( ssTimer == null ){
  46. ssTimer = window.setTimeout( ssShowSS, ssTimeOut );
  47. };
  48. };
  49. function ssStopTimer() {
  50. if( ssTimer ){
  51. window.clearTimeout( ssTimer );
  52. ssTimer = null;
  53. };
  54. };
  55. function ssSetupTimer() {
  56. document.addEventListener( "mousemove", ssResetTimer, false);
  57. document.addEventListener( "mousedown", ssResetTimer, false);
  58. document.addEventListener( "keypress", ssResetTimer, false);
  59. document.addEventListener( "touchmove", ssResetTimer, false);
  60. ssStartTimer();
  61. };
  62. function ssHideSS(){
  63. document.getElementById('ss_bg').className='ss_hidden';
  64. document.getElementById('ss_content').className='ss_hidden';
  65. document.removeEventListener( "mousemove", ssHideSS );
  66. document.removeEventListener( "mousedown", ssHideSS );
  67. document.removeEventListener( "keypress", ssHideSS );
  68. document.removeEventListener( "touchmove", ssHideSS );
  69. if( ssInterval != null ){
  70. window.clearInterval( ssInterval );
  71. ssInterval = null;
  72. };
  73. updateSSMode( 0 );
  74. ssIsActive = true;
  75. autoRiseEvent = true;
  76. var tt = Ext.getCmp('aer_button');
  77. if( tt != undefined ){
  78. tt.toggle( true, true );
  79. } else doRefresh();
  80. ssSetupTimer();
  81. ssIsActive = false;
  82. };
  83. var sndBeep = null;
  84. var sndExcl = null;
  85. function playSound( t ){
  86. if( SoundEnable ){
  87. switch( t ){
  88. case 1:{
  89. if( sndBeep == null ) sndBeep = new Howl({
  90. src: [
  91. '/style/assets/audio/beep-07a.mp3',
  92. '/style/assets/audio/beep-07a.wav'
  93. ],
  94. loop: false,
  95. volume: 0.99,
  96. onend: function() {
  97. //console.log('Finished!');
  98. }
  99. });
  100. sndBeep.volume( SoundMode / 3 );
  101. if( !sndBeep.playing() ) sndBeep.play();
  102. break;
  103. };
  104. default:{
  105. if( sndExcl == null ) sndExcl = new Howl({
  106. src: [
  107. '/style/assets/audio/button-42.mp3',
  108. '/style/assets/audio/button-42.wav'
  109. ],
  110. loop: false,
  111. volume: 0.99
  112. });
  113. sndExcl.volume( SoundMode / 3 );
  114. if( !sndExcl.playing() ) sndExcl.play();
  115. };
  116. };
  117. };
  118. };
  119. function doRefresh(){
  120. window.location="/?t=" + uuidv4();//crypto.randomUUID();
  121. };
  122. function doLogout(){
  123. window.location = '/login.php?login=guest';//'/login.php?UID=1';
  124. };
  125. function stopStatusUpdater(){
  126. if( tlInterval!= null ){
  127. window.clearInterval( tlInterval );
  128. tlInterval = null;
  129. };
  130. };
  131. function failureAJAXFunction( responce, opts ){
  132. //if( tlInterval!= null ){
  133. // window.clearInterval( tlInterval );
  134. // tlInterval = null;
  135. // };
  136. //playSound();
  137. //Ext.Msg.show({
  138. // title:'<?=$Labels->GetLabel('_REQ_FAILURE_');?>',
  139. // msg: '<?=$Labels->GetLabel('_AJX_REQFAILURE_');?>',
  140. // buttons: Ext.Msg.OK,
  141. // icon: Ext.MessageBox.INFO
  142. // });
  143. //doLogout();
  144. };
  145. function doUserOperation( OPId, Param, reload ){
  146. Ext.Ajax.request({
  147. url: '/lib/controller/updateUserSettings.php',
  148. params: {
  149. UID: <?=$UserID;?>,
  150. SID: '<?=$Session;?>',
  151. SSS: OPId,
  152. CID: Param
  153. },
  154. success: function( response, opts ){
  155. if( reload ) doRefresh();
  156. },
  157. failure: failureAJAXFunction
  158. });
  159. };
  160. function updateUserScreenResolution( x, y ){
  161. Ext.Ajax.request({
  162. url: '/lib/controller/updateUserSettings.php',
  163. params: {
  164. UID: <?=$UserID;?>,
  165. SID: '<?=$Session;?>',
  166. SSS: 15,
  167. WID: x,
  168. HEI: y
  169. },
  170. success: function( response, opts ){
  171. doRefresh();
  172. },
  173. failure: failureAJAXFunction
  174. });
  175. };
  176. var contentChangesCount = 0;
  177. function updateUserContent(){
  178. var ser_c = Ext.encode( contentView );
  179. if( contentViewConfig != ser_c ) {
  180. Ext.Ajax.request({
  181. url: '/lib/controller/updateUserSettings.php',
  182. params: {
  183. UID: <?=$UserID;?>,
  184. SID: '<?=$Session;?>',
  185. SSS: 26,
  186. CID: ser_c
  187. },
  188. success: function(){
  189. contentViewConfig = ser_c;
  190. contentChangesCount++;
  191. if( contentChangesCount%5== 0 ) doRefresh();
  192. },
  193. failure: failureAJAXFunction
  194. });
  195. return true;
  196. };
  197. return false;
  198. };
  199. if( contentView.l == undefined ){
  200. contentView.l =[];
  201. contentView.l[0] = { v: 0, p: '' };
  202. contentView.l[1] = { v: 0, p: '' };
  203. contentView.l[2] = { v: 0, p: '' };
  204. contentView.l[3] = { v: 0, p: '' };
  205. updateUserContent();
  206. };
  207. function updateSSMode( mode ){
  208. Ext.Ajax.request({
  209. url: '/lib/controller/updateUserSettings.php',
  210. params: {
  211. UID: <?=$UserID;?>,
  212. SID: '<?=$Session;?>',
  213. SSS: 27,
  214. CID: mode
  215. }
  216. });
  217. };
  218. var gSessionValidatorInterval = null;
  219. function sessionValidator(){
  220. var cTS = (new Date())/1000;
  221. Ext.Ajax.request({
  222. url: '/lib/controller/validateUserSession.php',
  223. params: {
  224. UID: <?=$UserID;?>,
  225. SID: '<?=$Session;?>',
  226. CTS: cTS
  227. },
  228. success: function( response, opts ){
  229. var data = Ext.decode(response.responseText);
  230. if( !data.sessionIsValid ){
  231. playSound();
  232. Ext.Msg.show({
  233. title:'<?=$Labels->GetLabel('_REQ_FAILURE_');?>',
  234. msg: '<?=$Labels->GetLabel('_AJX_REQFAILURE_');?>',
  235. buttons: Ext.Msg.OK,
  236. icon: Ext.MessageBox.INFO
  237. });
  238. doLogout();
  239. };
  240. },
  241. failure: failureAJAXFunction
  242. });
  243. };
  244. function doCheckWindowSize(){
  245. if (parseInt(navigator.appVersion)>3) {
  246. if (navigator.appName=="Netscape") {
  247. winW2 = window.innerWidth;
  248. winH2 = window.innerHeight;
  249. if ( winH2<700 ) winH2=700;
  250. };
  251. if (navigator.appName.indexOf("Microsoft")!=-1) {
  252. winW2 = document.body.offsetWidth;
  253. winH2 = document.body.offsetHeight;
  254. if ( winH2<700 ) winH2=700;
  255. };
  256. };
  257. if ( winW2 != winW || winH2!=winH ){
  258. updateUserScreenResolution( winW2, winH2 );
  259. };
  260. };
  261. var NotificationStack = null;
  262. function tryKeepScreenAlive(minutes) {
  263. navigator.wakeLock.request("screen").then(lock => {
  264. setTimeout(() => lock.release(), minutes * 60 * 1000);
  265. });
  266. }
  267. function changeContent( lvl, ctx, param ){
  268. if( lvl <= contentView.l.length ){
  269. for( i = 0; i< contentView.l.length; i++){
  270. if( i == lvl ){
  271. contentView.l[i].p = param;
  272. contentView.l[i].v = ctx;
  273. } else if( i > lvl ) {
  274. contentView.l[i].p = '';
  275. contentView.l[i].v = 0;
  276. };
  277. };
  278. } else {
  279. contentView.l[lvl]={
  280. v: ctx,
  281. p: ''
  282. };
  283. };
  284. };
  285. function showContent( force ){
  286. if( force || updateUserContent() ){
  287. switch( contentView.l[0].v ){
  288. case 0:{
  289. if( mSesPlay!= null ) {
  290. mSesPlay.dispose();
  291. mSesPlay = null;
  292. };
  293. var tt = Ext.getCmp('tbtn_0');
  294. tt.toggle( true, true );
  295. tt = Ext.getCmp('tbtn_1');
  296. tt.toggle( false, true );
  297. tt = Ext.getCmp('tbtn_2');
  298. tt.toggle( false, true );
  299. var tP = Ext.getCmp('left_side_menu');
  300. tP.setVisible( true );
  301. var tZ = Ext.getCmp('right_side_menu');
  302. tZ.setVisible( false );
  303. initMonitoring();
  304. Ext.getCmp('main_viewport').doLayout();
  305. break;
  306. };
  307. case 1:{
  308. if( mSesPlay!= null ) {
  309. mSesPlay.dispose();
  310. mSesPlay = null;
  311. };
  312. var tt = Ext.getCmp('tbtn_0');
  313. tt.toggle( false, true );
  314. tt = Ext.getCmp('tbtn_1');
  315. tt.toggle( true, true );
  316. tt = Ext.getCmp('tbtn_2');
  317. tt.toggle( false, true );
  318. var tP = Ext.getCmp('left_side_menu');
  319. tP.setVisible( true );
  320. var tZ = Ext.getCmp('right_side_menu');
  321. tZ.setVisible( false );
  322. initReportsView();
  323. Ext.getCmp('main_viewport').doLayout();
  324. break;
  325. };
  326. case 2:{
  327. if( mSesPlay!= null ) {
  328. mSesPlay.dispose();
  329. mSesPlay = null;
  330. };
  331. var tt = Ext.getCmp('tbtn_0');
  332. tt.toggle( false, true );
  333. tt = Ext.getCmp('tbtn_1');
  334. tt.toggle( false, true );
  335. tt = Ext.getCmp('tbtn_2');
  336. tt.toggle( true, true );
  337. var tP = Ext.getCmp('left_side_menu');
  338. tP.setVisible( true );
  339. var tZ = Ext.getCmp('right_side_menu');
  340. tZ.setVisible( false );
  341. initSettingsView();
  342. Ext.getCmp('main_viewport').doLayout();
  343. break;
  344. };
  345. };
  346. };
  347. };
  348. function loadHelpTopic( cid, htopic ){
  349. Ext.Ajax.request({
  350. url: '/lib/controller/getHelpTopic.php',
  351. params: {
  352. HID: htopic,
  353. UID: <?=$UserID;?>,
  354. SID: '<?=$Session;?>',
  355. },
  356. success: function( response, opts ){
  357. var data = Ext.decode(response.responseText);
  358. if( data.status == 'ok' ){
  359. var tPanel = Ext.getCmp( cid );
  360. var res = Ext.decode( data.content );
  361. tPanel.removeAll( true );
  362. tPanel.add( res );
  363. tPanel.doLayout();
  364. };
  365. },
  366. failure: failureAJAXFunction
  367. });
  368. };
  369. Ext.onReady(function(){
  370. if( 'wakeLock' in navigator ) tryKeepScreenAlive(10);
  371. doCheckWindowSize();
  372. if( <?=intval($CUser->Data['ss_mode']);?> == 1 ) ssShowSS();
  373. gSessionValidatorInterval = window.setInterval( sessionValidator, 1000 );
  374. NotificationStack = new PNotify.Stack({dir1: 'down', firstpos1: 25});
  375. //window.onresize = doCheckWindowSize;
  376. Ext.QuickTips.init();
  377. if( ssEnabled ){
  378. ssSetupTimer();
  379. $(window).focus(function() {
  380. ssResetTimer();
  381. });
  382. $(window).blur(function() {
  383. ssStopTimer();
  384. });
  385. };
  386. var viewport = new Ext.Viewport({
  387. id: 'main_viewport',
  388. layout:'border',
  389. frame: false,
  390. border: false,
  391. items: [{
  392. xtype: 'panel',
  393. region: 'north',
  394. baseCls: 'x-plain',
  395. height: 60,
  396. //layout: 'fit',
  397. layout: 'hbox',
  398. frame: false,
  399. border: false,
  400. items:[{
  401. xtype: 'panel',
  402. width: '100%',
  403. layout: 'table',
  404. baseCls: 'x-plain',
  405. layoutConfig: {
  406. columns: 13
  407. },
  408. frame: false,
  409. border: true,
  410. margins: {top:10, right:10, bottom:10, left:10},
  411. items:[{
  412. xtype: 'panel',
  413. baseCls: 'x-plain',
  414. frame: false,
  415. border: false,
  416. margins: {top:5, right:20, bottom:0, left:20},
  417. html: '<img src="/style/assets/argus_logo_text.png" height="42px">'
  418. },{
  419. xtype: 'spacer',
  420. width: 10
  421. },{
  422. xtype: 'button',
  423. text: '<?=$Labels->GetLabel('_MONITORING_');?>',
  424. id: 'tbtn_0',
  425. iconCls: 'mon',
  426. scale: 'large',
  427. enableToggle: true,
  428. //pressed: (Math.floor(initView/100)==0),
  429. allowDepress: false,
  430. toggleGroup: 'gopa_gopa',
  431. toggleHandler: function( bt, state ){
  432. if( state ) {
  433. autoRiseEvent = true;
  434. changeContent(0,0,'');
  435. updateUserContent();
  436. showContent();
  437. };
  438. }
  439. },{
  440. xtype: 'spacer',
  441. width: 10
  442. },{
  443. xtype: 'button',
  444. text: '<?=$Labels->GetLabel('_REPO_HISTORY_');?>',
  445. id: 'tbtn_1',
  446. iconCls: 'rep',
  447. scale: 'large',
  448. enableToggle: true,
  449. //pressed: (Math.floor(initView/100)==1),
  450. allowDepress: false,
  451. toggleGroup: 'gopa_gopa',
  452. toggleHandler: function( bt, state ){
  453. if( state ){
  454. changeContent(0,1,'');
  455. updateUserContent();
  456. showContent();
  457. };
  458. }
  459. },{
  460. xtype: 'spacer',
  461. width: 10
  462. },{
  463. xtype: 'button',
  464. text: '<?=$Labels->GetLabel('_SETTINGS_');?>',
  465. id: 'tbtn_2',
  466. iconCls: 'cog',
  467. scale: 'large',
  468. enableToggle: true,
  469. allowDepress: false,
  470. toggleGroup: 'gopa_gopa',
  471. toggleHandler: function( bt, state ){
  472. if( state ) {
  473. changeContent(0,2,'');
  474. updateUserContent();
  475. showContent();
  476. };
  477. }
  478. },{
  479. xtype: 'spacer',
  480. width: 10
  481. },{
  482. xtype: 'panel',
  483. baseCls: 'x-plain',
  484. frame: false,
  485. border: false,
  486. margins: {top:5, right:0, bottom:0, left:0},
  487. width: PanelW - <?=($AP_DATA['type'] == 1)?'700':'800';?>,
  488. html: '<p style="font-family: \'Ubuntu\', \'Arial\';font-size: 24px;">'+ap_title+'</p>'
  489. },{
  490. xtype: 'spacer',
  491. width: 10
  492. },<?php
  493. if( $AP_DATA['type'] == 1 ){
  494. ?>{
  495. xtype: 'button',
  496. id: 'logout_btn',
  497. text: 'Logout',
  498. iconCls: 'lout',
  499. scale: 'large',
  500. style:'text-align: right;',
  501. handler: doLogout
  502. }<?php
  503. } else {
  504. ?>{
  505. xtype: 'button',
  506. id: 'snd_mode_btn',
  507. text: '<?=$Labels->GetLabel('_SOUND_');?>',
  508. iconCls: 'snd'+SoundMode,
  509. scale: 'large',
  510. style:'text-align: right;',
  511. handler: function(){
  512. if( SoundMode == 0 ){
  513. SoundMode = 3;
  514. SoundEnable = true;
  515. } else {
  516. SoundMode --;
  517. if( SoundMode == 0 ) SoundEnable = false;
  518. };
  519. Ext.getCmp('snd_mode_btn').setIconClass( 'snd'+SoundMode );
  520. playSound();
  521. doApplicationOperation( 6, SoundMode );
  522. }
  523. },{
  524. xtype: 'spacer',
  525. width: 10
  526. },{
  527. xtype: 'button',
  528. id: 'logout_btn',
  529. text: '<?=$Labels->GetLabel('_LOGOUT_');?>',
  530. iconCls: 'lout',
  531. scale: 'large',
  532. style:'text-align: right;',
  533. handler: doLogout
  534. }<?php
  535. };
  536. ?>
  537. ]
  538. }]
  539. },{
  540. xtype: 'panel',
  541. id:'left_side_menu',
  542. region:'west',
  543. bsaseCls:'x-plain',
  544. layout: 'fit',
  545. collapsible: true,
  546. split: true,
  547. width: 180,
  548. minWidth: 180,
  549. maxWidth: 180,
  550. hidden: ( contentView.l[1].v == 0 ),
  551. margins: '5 0 5 5',
  552. cmargins:'5 5 5 5',
  553. items: []
  554. },{
  555. xtype: 'panel',
  556. region:'center',
  557. margins: '5 5 5 0',
  558. id: 'main_content',
  559. //title: '<?=$Labels->GetLabel('_SYS_DASHBOARD_');?>',
  560. items:[{
  561. xtype: 'portal',
  562. id: 'main_portal',
  563. frame: false,
  564. border: false,
  565. items:{
  566. html: ''
  567. }//,
  568. //listeners:{
  569. // drop: function( a ){
  570. // updateDashBoardItemLayout( a.panel.id, a.columnIndex, a.position );
  571. // }
  572. //}
  573. }]
  574. },{
  575. xtype: 'panel',
  576. region:'east',
  577. id:'right_side_menu',
  578. //title: '',
  579. margins: '5 5 5 0',
  580. //id: 'help_content',
  581. frame: false,
  582. border: false,
  583. collapsible: false,
  584. split:true,
  585. width:200,
  586. minWidth: 150,
  587. maxWidth: 200,
  588. items:[]
  589. }]
  590. });
  591. showContent( true );
  592. });