Web UI for ARGUS server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

417 lines
10 KiB

6 years ago
​
​
5 years ago
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
5 years ago
​
​
5 years ago
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
6 years ago
6 years ago
​
6 years ago
6 years ago
​
​
​
​
​
6 years ago
6 years ago
​
​
​
6 years ago
6 years ago
6 years ago
6 years ago
​
​
​
6 years ago
6 years ago
6 years ago
​
​
6 years ago
​
6 years ago
​
​
​
4 years ago
6 years ago
​
​
​
6 years ago
​
​
​
4 years ago
5 years ago
​
​
​
​
4 years ago
6 years ago
​
​
​
​
6 years ago
​
6 years ago
​
​
​
4 years ago
6 years ago
​
​
​
4 years ago
6 years ago
​
​
​
4 years ago
6 years ago
​
​
​
4 years ago
6 years ago
​
6 years ago
​
​
​
​
​
​
5 years ago
​
​
​
​
5 years ago
​
​
​
​
​
5 years ago
​
6 years ago
​
​
​
​
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
6 years ago
​
​
​
4 years ago
​
​
​
​
6 years ago
  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. ssSetupTimer();
  218. $(window).focus(function() {
  219. ssResetTimer();
  220. });
  221. $(window).blur(function() {
  222. ssStopTimer();
  223. });
  224. var viewport = new Ext.Viewport({
  225. id: 'main_viewport',
  226. layout:'border',
  227. items: [{
  228. xtype: 'panel',
  229. region: 'north',
  230. baseCls: 'x-plain',
  231. height: 50,
  232. items:[{
  233. xtype: 'panel',
  234. id:'top',
  235. baseCls: 'x-plain',
  236. html: '<p style="padding:10px;zcolor:#556677;font-size:24px;"><img src="/style/img/logo32.png">&nbsp;<?=$Labels->GetLabel('_APP_TITLE_');?></p>'
  237. }]
  238. },{
  239. xtype: 'panel',
  240. id:'btns',
  241. region:'west',
  242. bsaseCls:'x-plain',
  243. title: '<?=$Labels->GetLabel('_SEC_SYSTEM_');?>',
  244. collapsible: true,
  245. split:true,
  246. width:150,
  247. minWidth: 100,
  248. maxWidth: 250,
  249. layout:'accordion',
  250. margins: '5 0 5 5',
  251. cmargins:'5 5 5 5',
  252. layoutConfig:{
  253. animate: true//,
  254. //activeOnTop: true
  255. },
  256. items: [{
  257. title: '<?=$Labels->GetLabel('_DASHBOARD_');?>',
  258. layout: 'vbox',
  259. height: 120,
  260. pack: 'center',
  261. align : 'strech',
  262. collapsed: <?=($CUser->Data['last_content_view']<3)?'false':'true';?>,
  263. items:[{
  264. xtype: 'button',
  265. width: '100%',
  266. id:'go_home',
  267. text: '<?=$Labels->GetLabel('_GO_HOME_');?>',
  268. toggled: (initView == 0 ),
  269. handler: loadDashBoard
  270. },{
  271. xtype: 'button',
  272. width: '100%',
  273. id:'go_monitor',
  274. text: '<?=$Labels->GetLabel('_EVT_MONITOR_');?>',
  275. toggled: (initView == 1 ),
  276. handler: loadMonitoring
  277. },{
  278. xtype: 'button',
  279. width: '100%',
  280. id:'go_archive',
  281. text: '<?=$Labels->GetLabel('_EVT_ARCHIVE_');?>',
  282. toggled: (initView == 2 ),
  283. handler: loadArchive
  284. },{
  285. xtype: 'button',
  286. width: '100%',
  287. id:'go_out',
  288. text: '<?=$Labels->GetLabel('_LOGOUT_');?>',
  289. handler: doLogout
  290. }]
  291. },{
  292. title: '<?=$Labels->GetLabel('_SYS_SETTINGS_');?>',
  293. layout: 'vbox',
  294. height: 120,
  295. pack: 'center',
  296. align : 'strech',
  297. collapsed: <?=($CUser->Data['last_content_view']>2)?'false':'true';?>,
  298. items:[{
  299. xtype: 'button',
  300. width: '100%',
  301. id:'sys_edit',
  302. text: '<?=$Labels->GetLabel('_EDT_CONNECTIONS_');?>',
  303. toggled: (initView == 3 ),
  304. handler: loadSystemEditor
  305. },{
  306. xtype: 'button',
  307. width: '100%',
  308. id:'map_edit',
  309. text: '<?=$Labels->GetLabel('_EDT_LOCATIONS_');?>',
  310. toggled: (initView == 4 ),
  311. handler: loadLocationEditor
  312. },{
  313. xtype: 'button',
  314. width: '100%',
  315. id:'soft_update',
  316. text: '<?=$Labels->GetLabel('_UPGRADE_MNGMNT_');?>',
  317. toggled: (initView == 5 ),
  318. handler: loadUpgradeManagmenet
  319. }]
  320. },{
  321. title: '<?=$Labels->GetLabel('_PROF_SETTINGS_');?>',
  322. html: '<p>Panel content!</p>'
  323. }
  324. <?php
  325. if( $CUser->Data['access'] > 5 ){
  326. ?>,{
  327. title: '<?=$Labels->GetLabel('_ADM_SETTINGS_');?>',
  328. items:[{
  329. xtype: 'button',
  330. width: '100%',
  331. id:'adm_acc',
  332. text: '<?=$Labels->GetLabel('_USERS_MNGMT_');?>',
  333. handler: function( b, e ){
  334. loadUserEditor();
  335. }
  336. },{
  337. xtype: 'button',
  338. width: '100%',
  339. id:'adm_acclog',
  340. text: '<?=$Labels->GetLabel('_ACC_LOG_');?>',
  341. handler: function( b, e ){
  342. loadAccessLog();
  343. }
  344. },{
  345. xtype: 'button',
  346. width: '100%',
  347. id:'adm_servlog',
  348. text: '<?=$Labels->GetLabel('_SERV_LOG_');?>',
  349. handler: function( b, e ){
  350. loadServerLog();
  351. }
  352. }]
  353. }
  354. <?php
  355. };
  356. ?>
  357. ]
  358. },{
  359. xtype: 'panel',
  360. region:'center',
  361. margins: '5 5 5 0',
  362. id: 'main_content',
  363. title: '<?=$Labels->GetLabel('_SYS_DASHBOARD_');?>',
  364. items:[{
  365. xtype: 'portal',
  366. id: 'main_portal',
  367. frame: false,
  368. border: false,
  369. items:{
  370. html: ''
  371. },
  372. listeners:{
  373. drop: function( a ){
  374. updateDashBoardItemLayout( a.panel.id, a.columnIndex, a.position );
  375. }
  376. }
  377. }]
  378. }]
  379. });
  380. switch( <?=intval($CUser->Data['last_content_view']);?> ){
  381. case 0: loadDashBoard(); break;
  382. case 1: loadMonitoring(); break;
  383. case 2: loadArchive(); break;
  384. case 3: loadSystemEditor(); break;
  385. case 4: loadLocationEditor(); break;
  386. case 5: loadUpgradeManagmenet(); break;
  387. default:
  388. loadDashBoard();
  389. };
  390. });