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.

433 lines
10 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //<?php require_once('../../js_asm.php'); ?>
  2. var winW = <?=intval($CUser->Data['width']);?>;
  3. var winH = <?=intval($CUser->Data['height']);?>;
  4. var initView = <?=intval($CUser->Data['last_content_view']);?>;
  5. var PanelW = winW;
  6. var PanelH = winH-90;
  7. var SelectedSite = <?=$SiteID;?>;
  8. var SettingsLidar3D = null;
  9. var SelectedNodeID = 0;
  10. var StatusTS = -1;
  11. var LoadTS = <?=time();?>;
  12. var SoundEnable = <?=intval($CUser->Data['sound_enable']);?>;
  13. var nodeDashboardStatuses = new Array();
  14. var nodeTHREEviewers = new Array();
  15. var nodeTHREEanimationId = 0;
  16. var ssTimer = null;
  17. var ssTimeOut = 60000; //1min
  18. var ssIsActive = false;
  19. var ssInterval = null;
  20. function ssShowSS() {
  21. ssStopTimer();
  22. document.removeEventListener( "mousemove", ssResetTimer );
  23. document.removeEventListener( "mousedown", ssResetTimer );
  24. document.removeEventListener( "keypress", ssResetTimer );
  25. document.removeEventListener( "touchmove", ssResetTimer );
  26. document.addEventListener( "mousemove", ssHideSS, false );
  27. document.addEventListener( "mousedown", ssHideSS, false );
  28. document.addEventListener( "keypress", ssHideSS, false );
  29. document.addEventListener( "touchmove", ssHideSS, false );
  30. document.getElementById('ss_bg').className='ss_bg_overlay';
  31. document.getElementById('ss_content').className='ss_overlay';
  32. ssShowTime();
  33. if( ssInterval == null ){
  34. ssInterval = window.setInterval( ssShowTime, 333 );
  35. };
  36. ssIsActive = true;
  37. };
  38. function ssShowTime(){
  39. document.getElementById('ss_content').style.fontSize = '240px';
  40. var currentdate = new Date();
  41. 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() );
  42. document.getElementById('ss_content').innerHTML= cTime;
  43. };
  44. function ssResetTimer() {
  45. ssStopTimer();
  46. ssStartTimer();
  47. };
  48. function ssStartTimer() {
  49. if( ssTimer == null ){
  50. ssTimer = window.setTimeout( ssShowSS, ssTimeOut );
  51. };
  52. };
  53. function ssStopTimer() {
  54. if( ssTimer ){
  55. window.clearTimeout( ssTimer );
  56. ssTimer = null;
  57. };
  58. };
  59. function ssSetupTimer() {
  60. document.addEventListener( "mousemove", ssResetTimer, false);
  61. document.addEventListener( "mousedown", ssResetTimer, false);
  62. document.addEventListener( "keypress", ssResetTimer, false);
  63. document.addEventListener( "touchmove", ssResetTimer, false);
  64. ssStartTimer();
  65. };
  66. function ssHideSS(){
  67. document.getElementById('ss_bg').className='ss_hidden';
  68. document.getElementById('ss_content').className='ss_hidden';
  69. document.removeEventListener( "mousemove", ssHideSS );
  70. document.removeEventListener( "mousedown", ssHideSS );
  71. document.removeEventListener( "keypress", ssHideSS );
  72. document.removeEventListener( "touchmove", ssHideSS );
  73. if( ssInterval != null ){
  74. window.clearInterval( ssInterval );
  75. ssInterval = null;
  76. };
  77. ssSetupTimer();
  78. ssIsActive = false;
  79. };
  80. var sndBeep = new Howl({
  81. src: [
  82. '/style/assets/audio/beep-07a.mp3',
  83. '/style/assets/audio/beep-07a.wav'
  84. ],
  85. loop: false,
  86. volume: 0.99,
  87. onend: function() {
  88. //console.log('Finished!');
  89. }
  90. });
  91. var sndExcl = new Howl({
  92. src: [
  93. '/style/assets/audio/button-42.mp3',
  94. '/style/assets/audio/button-42.wav'
  95. ],
  96. loop: false,
  97. volume: 0.99
  98. });
  99. function playSound( t ){
  100. if( SoundEnable ){
  101. switch( t ){
  102. case 1:{
  103. sndBeep.play();
  104. break;
  105. };
  106. default:{
  107. sndExcl.play();
  108. };
  109. };
  110. };
  111. };
  112. function doRefresh(){
  113. window.location="/?t="+123;
  114. };
  115. function doLogout(){
  116. window.location = '/login.php?UID=1';
  117. };
  118. function failureAJAXFunction( responce, opts ){
  119. if( tlInterval!= null ){
  120. window.clearInterval( tlInterval );
  121. tlInterval = null;
  122. };
  123. playSound();
  124. Ext.Msg.show({
  125. title:'<?=$Labels->GetLabel('_REQ_FAILURE_');?>',
  126. msg: '<?=$Labels->GetLabel('_AJX_REQFAILURE_');?>',
  127. buttons: Ext.Msg.OK,
  128. icon: Ext.MessageBox.INFO
  129. });
  130. doLogout();
  131. };
  132. function updateUserScreenResolution( x, y ){
  133. Ext.Ajax.request({
  134. url: '/lib/controller/updateUserSettings.php',
  135. params: {
  136. UID: <?=$UserID;?>,
  137. SID: '<?=$Session;?>',
  138. SSS: 15,
  139. WID: x,
  140. HEI: y
  141. },
  142. success: function( response, opts ){
  143. doRefresh();
  144. },
  145. failure: failureAJAXFunction
  146. });
  147. };
  148. function setUserContent( c_id ){
  149. Ext.Ajax.request({
  150. url: '/lib/controller/updateUserSettings.php',
  151. params: {
  152. UID: <?=$UserID;?>,
  153. SID: '<?=$Session;?>',
  154. SSS: 26,
  155. CID: c_id
  156. },
  157. failure: failureAJAXFunction
  158. });
  159. };
  160. var gSessionValidatorInterval = null;
  161. function sessionValidator(){
  162. Ext.Ajax.request({
  163. url: '/lib/controller/updateUserSssion.php',
  164. params: {
  165. UID: <?=$UserID;?>,
  166. SID: '<?=$Session;?>'
  167. },
  168. success: function( response, opts ){
  169. var data = Ext.decode(response.responseText);
  170. if( !data.sessionIsValid ){
  171. playSound();
  172. Ext.Msg.show({
  173. title:'<?=$Labels->GetLabel('_REQ_FAILURE_');?>',
  174. msg: '<?=$Labels->GetLabel('_AJX_REQFAILURE_');?>',
  175. buttons: Ext.Msg.OK,
  176. icon: Ext.MessageBox.INFO
  177. });
  178. doLogout();
  179. };
  180. },
  181. failure: failureAJAXFunction
  182. });
  183. };
  184. function doCheckWindowSize(){
  185. if (parseInt(navigator.appVersion)>3) {
  186. if (navigator.appName=="Netscape") {
  187. winW2 = window.innerWidth;
  188. winH2 = window.innerHeight;
  189. if ( winH2<700 ) winH2=700;
  190. };
  191. if (navigator.appName.indexOf("Microsoft")!=-1) {
  192. winW2 = document.body.offsetWidth;
  193. winH2 = document.body.offsetHeight;
  194. if ( winH2<700 ) winH2=700;
  195. };
  196. };
  197. if ( winW2 != winW || winH2!=winH ){
  198. updateUserScreenResolution( winW2, winH2 );
  199. };
  200. };
  201. var NotificationStack = null;
  202. function tryKeepScreenAlive(minutes) {
  203. navigator.wakeLock.request("screen").then(lock => {
  204. setTimeout(() => lock.release(), minutes * 60 * 1000);
  205. });
  206. }
  207. Ext.onReady(function(){
  208. if ('wakeLock' in navigator) {
  209. // Screen Wake Lock API supported
  210. tryKeepScreenAlive(10);
  211. };
  212. doCheckWindowSize();
  213. gSessionValidatorInterval = window.setInterval( sessionValidator, 1000 );
  214. NotificationStack = new PNotify.Stack({dir1: 'down', firstpos1: 25});
  215. //window.onresize = doCheckWindowSize;
  216. Ext.QuickTips.init();
  217. /*
  218. ssSetupTimer();
  219. $(window).focus(function() {
  220. ssResetTimer();
  221. });
  222. $(window).blur(function() {
  223. ssStopTimer();
  224. });
  225. */
  226. var viewport = new Ext.Viewport({
  227. id: 'main_viewport',
  228. layout:'border',
  229. items: [{
  230. xtype: 'panel',
  231. region: 'north',
  232. baseCls: 'x-plain',
  233. height: 50,
  234. items:[{
  235. xtype: 'panel',
  236. id:'top',
  237. baseCls: 'x-plain',
  238. html: '<p style="padding:10px;zcolor:#556677;font-size:24px;"><img src="/style/img/logo32.png">&nbsp;<?=$Labels->GetLabel('_APP_TITLE_');?></p>'
  239. }]
  240. },{
  241. xtype: 'panel',
  242. id:'btns',
  243. region:'west',
  244. bsaseCls:'x-plain',
  245. title: '<?=$Labels->GetLabel('_SEC_SYSTEM_');?>',
  246. collapsible: true,
  247. split:true,
  248. width:150,
  249. minWidth: 100,
  250. maxWidth: 250,
  251. layout:'accordion',
  252. margins: '5 0 5 5',
  253. cmargins:'5 5 5 5',
  254. layoutConfig:{
  255. animate: true//,
  256. //activeOnTop: true
  257. },
  258. items: [{
  259. title: '<?=$Labels->GetLabel('_DASHBOARD_');?>',
  260. layout: 'vbox',
  261. height: 120,
  262. pack: 'center',
  263. align : 'strech',
  264. collapsed: <?=($CUser->Data['last_content_view']<3)?'false':'true';?>,
  265. items:[{
  266. xtype: 'button',
  267. width: '100%',
  268. id:'go_home',
  269. text: '<?=$Labels->GetLabel('_GO_HOME_');?>',
  270. toggled: (initView == 0 ),
  271. handler: loadDashBoard
  272. },{
  273. xtype: 'button',
  274. width: '100%',
  275. id:'go_monitor',
  276. text: '<?=$Labels->GetLabel('_EVT_MONITOR_');?>',
  277. toggled: (initView == 1 ),
  278. handler: loadMonitoring
  279. },{
  280. xtype: 'button',
  281. width: '100%',
  282. id:'go_archive',
  283. text: '<?=$Labels->GetLabel('_EVT_ARCHIVE_');?>',
  284. toggled: (initView == 2 ),
  285. handler: loadArchive
  286. }<?php
  287. if( intval( $CUser->Data['sipi_enable'] ) ){
  288. ?>
  289. ,{
  290. xtype: 'button',
  291. width: '100%',
  292. id:'go_singleIpi',
  293. text: '<?=$Labels->GetLabel('_EVT_MONITOR_IPI_');?>',
  294. toggled: (initView == 3 ),
  295. handler: loadSingleIPI
  296. }
  297. <?php
  298. };
  299. ?>
  300. ,{
  301. xtype: 'button',
  302. width: '100%',
  303. id:'go_out',
  304. text: '<?=$Labels->GetLabel('_LOGOUT_');?>',
  305. handler: doLogout
  306. }]
  307. },{
  308. title: '<?=$Labels->GetLabel('_SYS_SETTINGS_');?>',
  309. layout: 'vbox',
  310. height: 120,
  311. pack: 'center',
  312. align : 'strech',
  313. collapsed: <?=($CUser->Data['last_content_view']>2)?'false':'true';?>,
  314. items:[{
  315. xtype: 'button',
  316. width: '100%',
  317. id:'sys_edit',
  318. text: '<?=$Labels->GetLabel('_EDT_CONNECTIONS_');?>',
  319. toggled: (initView == 11 ),
  320. handler: loadSystemEditor
  321. },{
  322. xtype: 'button',
  323. width: '100%',
  324. id:'map_edit',
  325. text: '<?=$Labels->GetLabel('_EDT_LOCATIONS_');?>',
  326. toggled: (initView == 12 ),
  327. handler: loadLocationEditor
  328. },{
  329. xtype: 'button',
  330. width: '100%',
  331. id:'soft_update',
  332. text: '<?=$Labels->GetLabel('_UPGRADE_MNGMNT_');?>',
  333. toggled: (initView == 13 ),
  334. handler: loadUpgradeManagmenet
  335. }]
  336. },{
  337. title: '<?=$Labels->GetLabel('_PROF_SETTINGS_');?>',
  338. items:[]
  339. }
  340. <?php
  341. if( $CUser->Data['access'] > 5 ){
  342. ?>,{
  343. title: '<?=$Labels->GetLabel('_ADM_SETTINGS_');?>',
  344. items:[{
  345. xtype: 'button',
  346. width: '100%',
  347. id:'adm_acc',
  348. text: '<?=$Labels->GetLabel('_USERS_MNGMT_');?>',
  349. handler: function( b, e ){
  350. loadUserEditor();
  351. }
  352. },{
  353. xtype: 'button',
  354. width: '100%',
  355. id:'adm_acclog',
  356. text: '<?=$Labels->GetLabel('_ACC_LOG_');?>',
  357. handler: function( b, e ){
  358. loadAccessLog();
  359. }
  360. },{
  361. xtype: 'button',
  362. width: '100%',
  363. id:'adm_servlog',
  364. text: '<?=$Labels->GetLabel('_SERV_LOG_');?>',
  365. handler: function( b, e ){
  366. loadServerLog();
  367. }
  368. }]
  369. }
  370. <?php
  371. };
  372. ?>
  373. ]
  374. },{
  375. xtype: 'panel',
  376. region:'center',
  377. margins: '5 5 5 0',
  378. id: 'main_content',
  379. title: '<?=$Labels->GetLabel('_SYS_DASHBOARD_');?>',
  380. items:[{
  381. xtype: 'portal',
  382. id: 'main_portal',
  383. frame: false,
  384. border: false,
  385. items:{
  386. html: ''
  387. },
  388. listeners:{
  389. drop: function( a ){
  390. updateDashBoardItemLayout( a.panel.id, a.columnIndex, a.position );
  391. }
  392. }
  393. }]
  394. }]
  395. });
  396. switch( <?=intval($CUser->Data['last_content_view']);?> ){
  397. case 0: loadDashBoard(); break;
  398. case 1: loadMonitoring(); break;
  399. case 2: loadArchive(); break;
  400. case 3: loadSystemEditor(); break;
  401. case 4: loadLocationEditor(); break;
  402. case 5: loadUpgradeManagmenet(); break;
  403. default:
  404. loadDashBoard();
  405. };
  406. });