|
|
//<?php require_once('../../js_asm.php'); ?>
function ssShowSS() { ssStopTimer(); document.removeEventListener( "mousemove", ssResetTimer ); document.removeEventListener( "mousedown", ssResetTimer ); document.removeEventListener( "keypress", ssResetTimer ); document.removeEventListener( "touchmove", ssResetTimer ); document.addEventListener( "mousemove", ssHideSS, false ); document.addEventListener( "mousedown", ssHideSS, false ); document.addEventListener( "keypress", ssHideSS, false ); document.addEventListener( "touchmove", ssHideSS, false ); document.getElementById('ss_bg').className='ss_bg_overlay'; document.getElementById('ss_content').className='ss_overlay'; ssShowTime(); if( ssInterval == null ){ ssInterval = window.setInterval( ssShowTime, 333 ); }; ssIsActive = true;};function ssShowTime(){ document.getElementById('ss_content').style.fontSize = '240px'; var currentdate = new Date(); 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() ); document.getElementById('ss_content').innerHTML= cTime; };function ssResetTimer() { ssStopTimer(); ssStartTimer();};
function ssStartTimer() { if( ssTimer == null ){ ssTimer = window.setTimeout( ssShowSS, ssTimeOut ); };};function ssStopTimer() { if( ssTimer ){ window.clearTimeout( ssTimer ); ssTimer = null; };};
function ssSetupTimer() { document.addEventListener( "mousemove", ssResetTimer, false); document.addEventListener( "mousedown", ssResetTimer, false); document.addEventListener( "keypress", ssResetTimer, false); document.addEventListener( "touchmove", ssResetTimer, false); ssStartTimer();};
function ssHideSS(){ document.getElementById('ss_bg').className='ss_hidden'; document.getElementById('ss_content').className='ss_hidden'; document.removeEventListener( "mousemove", ssHideSS ); document.removeEventListener( "mousedown", ssHideSS ); document.removeEventListener( "keypress", ssHideSS ); document.removeEventListener( "touchmove", ssHideSS ); if( ssInterval != null ){ window.clearInterval( ssInterval ); ssInterval = null; }; ssSetupTimer(); ssIsActive = false;};
var sndBeep = new Howl({ src: [ '/style/assets/audio/beep-07a.mp3', '/style/assets/audio/beep-07a.wav' ], loop: false, volume: 0.99, onend: function() { //console.log('Finished!');
} });var sndExcl = new Howl({ src: [ '/style/assets/audio/button-42.mp3', '/style/assets/audio/button-42.wav' ], loop: false, volume: 0.99});
function playSound( t ){ if( SoundEnable ){ switch( t ){ case 1:{ sndBeep.play(); break; }; default:{ sndExcl.play(); }; }; };};
function doRefresh(){ window.location="/?t="+123;};
function doLogout(){ window.location = '/login.php?UID=1';};
function stopStatusUpdater(){ if( tlInterval!= null ){ window.clearInterval( tlInterval ); tlInterval = null; };};
function failureAJAXFunction( responce, opts ){ if( tlInterval!= null ){ window.clearInterval( tlInterval ); tlInterval = null; }; playSound(); Ext.Msg.show({ title:'<?=$Labels->GetLabel('_REQ_FAILURE_');?>', msg: '<?=$Labels->GetLabel('_AJX_REQFAILURE_');?>', buttons: Ext.Msg.OK, icon: Ext.MessageBox.INFO }); doLogout();};
function updateUserScreenResolution( x, y ){ Ext.Ajax.request({ url: '/lib/controller/updateUserSettings.php', params: { UID: <?=$UserID;?>, SID: '<?=$Session;?>', SSS: 15, WID: x, HEI: y }, success: function( response, opts ){ doRefresh(); }, failure: failureAJAXFunction });};
function setUserContent( c_id ){ initView = c_id; Ext.Ajax.request({ url: '/lib/controller/updateUserSettings.php', params: { UID: <?=$UserID;?>, SID: '<?=$Session;?>', SSS: 26, CID: initView }, failure: failureAJAXFunction });};
function updateUserContent(){ cid = content_lvl3 + content_lvl2 * 10 + content_lvl1*100 + content_lvl0*1000; if( initView != cid ) setUserContent( cid );};
var gSessionValidatorInterval = null;
function sessionValidator(){ Ext.Ajax.request({ url: '/lib/controller/validateUserSession.php', params: { UID: <?=$UserID;?>, SID: '<?=$Session;?>' }, success: function( response, opts ){ var data = Ext.decode(response.responseText); if( !data.sessionIsValid ){ playSound(); Ext.Msg.show({ title:'<?=$Labels->GetLabel('_REQ_FAILURE_');?>', msg: '<?=$Labels->GetLabel('_AJX_REQFAILURE_');?>', buttons: Ext.Msg.OK, icon: Ext.MessageBox.INFO }); doLogout(); }; }, failure: failureAJAXFunction });};
function doCheckWindowSize(){ if (parseInt(navigator.appVersion)>3) { if (navigator.appName=="Netscape") { winW2 = window.innerWidth; winH2 = window.innerHeight; if ( winH2<700 ) winH2=700; }; if (navigator.appName.indexOf("Microsoft")!=-1) { winW2 = document.body.offsetWidth; winH2 = document.body.offsetHeight; if ( winH2<700 ) winH2=700; }; }; if ( winW2 != winW || winH2!=winH ){ updateUserScreenResolution( winW2, winH2 ); };};
var NotificationStack = null;
function tryKeepScreenAlive(minutes) { navigator.wakeLock.request("screen").then(lock => { setTimeout(() => lock.release(), minutes * 60 * 1000); });}
function showContent( cid ){ if( cid != initView ) setUserContent( cid ); var lvl0 = Math.floor( initView / 1000 ); var lvl1 = Math.floor( ( initView % 1000 )/ 100 ); var lvl2 = Math.floor( ( initView % 100 )/ 10 ); var lvl3 = initView % 10; if( lvl3 != content_lvl3 ){ content_lvl3 = lvl3; }; if( lvl2 != content_lvl2 ){ content_lvl2 = lvl2; }; if( lvl1 != content_lvl1 ){ content_lvl1 = lvl1; }; if( lvl0 != content_lvl0 ){ content_lvl0 = lvl0; switch( lvl0 ){ case 0:{ var tt = Ext.getCmp('tbtn_0'); tt.toggle( true, false ); var tP = Ext.getCmp('left_side_menu'); if( tP.isVisible() ) tP.setVisible( false ); initMonitoring(); Ext.getCmp('main_viewport').doLayout(); break; }; case 1:{ var tt = Ext.getCmp('tbtn_1'); tt.toggle( true, false ); var tP = Ext.getCmp('left_side_menu'); tP.setVisible( true ); Ext.getCmp('main_viewport').doLayout(); break; }; case 2:{ var tt = Ext.getCmp('tbtn_2'); tt.toggle( true, false ); var tP = Ext.getCmp('left_side_menu'); if( !tP.isVisible() ) tP.setVisible( true ); var tZ = Ext.getCmp('right_side_menu'); if( tZ.isVisible() ) tZ.setVisible( false ); initSettingsView(); Ext.getCmp('main_viewport').doLayout(); break; }; }; };};
Ext.onReady(function(){ if ('wakeLock' in navigator) { // Screen Wake Lock API supported
tryKeepScreenAlive(10); }; doCheckWindowSize(); gSessionValidatorInterval = window.setInterval( sessionValidator, 1000 ); NotificationStack = new PNotify.Stack({dir1: 'down', firstpos1: 25}); //window.onresize = doCheckWindowSize;
Ext.QuickTips.init(); if( ssEnabled ){ ssSetupTimer(); $(window).focus(function() { ssResetTimer(); }); $(window).blur(function() { ssStopTimer(); }); }; var viewport = new Ext.Viewport({ id: 'main_viewport', layout:'border', frame: false, border: false, items: [{ xtype: 'panel', region: 'north', baseCls: 'x-plain', height: 60, //layout: 'fit',
layout: 'hbox', frame: false, border: false, items:[{ xtype: 'panel', width: '100%', layout: 'table', baseCls: 'x-plain', layoutConfig: { columns: 11 }, frame: false, border: true, margins: {top:10, right:10, bottom:10, left:10}, items:[{ xtype: 'panel', baseCls: 'x-plain', frame: false, border: false, margins: {top:5, right:20, bottom:0, left:20}, html: '<img src="/style/assets/argus_logo_text.png" height="42px">' },{ xtype: 'spacer', width: 10 },{ xtype: 'button', text: '<?=$Labels->GetLabel('_MONITORING_');?>', id: 'tbtn_0', iconCls: 'mon', scale: 'large', enableToggle: true, //pressed: (Math.floor(initView/100)==0),
allowDepress: false, toggleGroup: 'gopa_gopa', toggleHandler: function( bt, state ){ if( state ) showContent( 0 ); } },{ xtype: 'spacer', width: 10 },{ xtype: 'button', text: '<?=$Labels->GetLabel('_REPO_HISTORY_');?>', id: 'tbtn_1', iconCls: 'rep', scale: 'large', enableToggle: true, //pressed: (Math.floor(initView/100)==1),
allowDepress: false, toggleGroup: 'gopa_gopa', toggleHandler: function( bt, state ){ if( state ) { content_lvl0 = 2000; updateUserContent(); }; } },{ xtype: 'spacer', width: 10 },{ xtype: 'button', text: '<?=$Labels->GetLabel('_SETTINGS_');?>', id: 'tbtn_2', iconCls: 'cog', scale: 'large', enableToggle: true, allowDepress: false, toggleGroup: 'gopa_gopa', toggleHandler: function( bt, state ){ if( state ) showContent( 2000 ); } },{ xtype: 'spacer', width: 10 },{ xtype: 'panel', baseCls: 'x-plain', frame: false, border: false, margins: {top:5, right:0, bottom:0, left:0}, width: PanelW-700, html: '<p style="font-family: \'Ubuntu\';font-size: 24px;">'+ap_title+'</p>' },{ xtype: 'spacer', width: 10 },<?php if( $AP_DATA['type'] == 1 ){ ?>{ xtype: 'button', id: 'logout_btn', text: 'Logout', iconCls: 'lout', scale: 'large', style:'text-align: right;', handler: doLogout }<?php } else { ?>{ xtype: 'button', id: 'snd_mode_btn', text: 'Sound', iconCls: 'snd'+SoundMode, scale: 'large', style:'text-align: right;', handler: function(){ if( SoundMode == 0 ){ SoundMode = 3; } else { SoundMode --; }; Ext.getCmp('snd_mode_btn').setIconClass( 'snd'+SoundMode ); } }<?php }; ?> ] }] },{ xtype: 'panel', id:'left_side_menu', region:'west', bsaseCls:'x-plain', //title: '<?=$Labels->GetLabel('_SEC_SYSTEM_');?>',
collapsible: true, split:true, width:180, minWidth: 180, maxWidth: 180, hidden: (Math.floor(initView/100)==0), layout:'accordion', margins: '5 0 5 5', cmargins:'5 5 5 5', layoutConfig:{ animate: true//,
//activeOnTop: true
}, items: [] },{ xtype: 'panel', region:'center', margins: '5 5 5 0', id: 'main_content', //title: '<?=$Labels->GetLabel('_SYS_DASHBOARD_');?>',
items:[{ xtype: 'portal', id: 'main_portal', frame: false, border: false, items:{ html: '' }//,
//listeners:{
// drop: function( a ){
// updateDashBoardItemLayout( a.panel.id, a.columnIndex, a.position );
// }
//}
}] },{ xtype: 'panel', region:'east', id:'right_side_menu', //title: '',
margins: '5 5 5 0', //id: 'help_content',
frame: false, border: false, collapsible: false, split:true, width:200, minWidth: 150, maxWidth: 200, items:[] }] }); showContent( initView );});
|