|
|
//<?php require_once('../../js_asm.php'); ?>
var winW = <?=intval($CUser->Data['width']);?>;var winH = <?=intval($CUser->Data['height']);?>;var initView = <?=intval($CUser->Data['last_content_view']);?>;var PanelW = winW;var PanelH = winH-90;var SelectedSite = <?=$SiteID;?>;var SettingsLidar3D = null;var SelectedNodeID = 0;var StatusTS = -1;var LoadTS = <?=time();?>;var SoundEnable = <?=intval($CUser->Data['sound_enable']);?>;var nodeDashboardStatuses = new Array();var nodeTHREEviewers = new Array();var nodeTHREEanimationId = 0;var ssTimer = null;var ssTimeOut = 60000; //1min
var ssIsActive = false;var ssInterval = null;
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 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 ){ Ext.Ajax.request({ url: '/lib/controller/updateUserSettings.php', params: { UID: <?=$UserID;?>, SID: '<?=$Session;?>', SSS: 26, CID: c_id }, failure: failureAJAXFunction });};
var gSessionValidatorInterval = null;
function sessionValidator(){ Ext.Ajax.request({ url: '/lib/controller/updateUserSssion.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); });}
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(); ssSetupTimer(); $(window).focus(function() { ssResetTimer(); }); $(window).blur(function() { ssStopTimer(); }); var viewport = new Ext.Viewport({ id: 'main_viewport', layout:'border', items: [{ xtype: 'panel', region: 'north', baseCls: 'x-plain', height: 50, items:[{ xtype: 'panel', id:'top', baseCls: 'x-plain', html: '<p style="padding:10px;zcolor:#556677;font-size:24px;"><img src="/style/img/logo32.png"> <?=$Labels->GetLabel('_APP_TITLE_');?></p>' }] },{ xtype: 'panel', id:'btns', region:'west', bsaseCls:'x-plain', title: '<?=$Labels->GetLabel('_SEC_SYSTEM_');?>', collapsible: true, split:true, width:150, minWidth: 100, maxWidth: 250, layout:'accordion', margins: '5 0 5 5', cmargins:'5 5 5 5', layoutConfig:{ animate: true//,
//activeOnTop: true
}, items: [{ title: '<?=$Labels->GetLabel('_DASHBOARD_');?>', layout: 'vbox', height: 120, pack: 'center', align : 'strech', collapsed: <?=($CUser->Data['last_content_view']<3)?'false':'true';?>, items:[{ xtype: 'button', width: '100%', id:'go_home', text: '<?=$Labels->GetLabel('_GO_HOME_');?>', toggled: (initView == 0 ), handler: loadDashBoard },{ xtype: 'button', width: '100%', id:'go_monitor', text: '<?=$Labels->GetLabel('_EVT_MONITOR_');?>', toggled: (initView == 1 ), handler: loadMonitoring },{ xtype: 'button', width: '100%', id:'go_archive', text: '<?=$Labels->GetLabel('_EVT_ARCHIVE_');?>', toggled: (initView == 2 ), handler: loadArchive },{ xtype: 'button', width: '100%', id:'go_out', text: '<?=$Labels->GetLabel('_LOGOUT_');?>', handler: doLogout }] },{ title: '<?=$Labels->GetLabel('_SYS_SETTINGS_');?>', layout: 'vbox', height: 120, pack: 'center', align : 'strech', collapsed: <?=($CUser->Data['last_content_view']>2)?'false':'true';?>, items:[{ xtype: 'button', width: '100%', id:'sys_edit', text: '<?=$Labels->GetLabel('_EDT_CONNECTIONS_');?>', toggled: (initView == 3 ), handler: loadSystemEditor },{ xtype: 'button', width: '100%', id:'map_edit', text: '<?=$Labels->GetLabel('_EDT_LOCATIONS_');?>', toggled: (initView == 4 ), handler: loadLocationEditor },{ xtype: 'button', width: '100%', id:'soft_update', text: '<?=$Labels->GetLabel('_UPGRADE_MNGMNT_');?>', toggled: (initView == 5 ), handler: loadUpgradeManagmenet }] },{ title: '<?=$Labels->GetLabel('_PROF_SETTINGS_');?>', html: '<p>Panel content!</p>' }<?php if( $CUser->Data['access'] > 5 ){?>,{ title: '<?=$Labels->GetLabel('_ADM_SETTINGS_');?>', items:[{ xtype: 'button', width: '100%', id:'adm_acc', text: '<?=$Labels->GetLabel('_USERS_MNGMT_');?>', handler: function( b, e ){ loadUserEditor(); } },{ xtype: 'button', width: '100%', id:'adm_acclog', text: '<?=$Labels->GetLabel('_ACC_LOG_');?>', handler: function( b, e ){ loadAccessLog(); } },{ xtype: 'button', width: '100%', id:'adm_servlog', text: '<?=$Labels->GetLabel('_SERV_LOG_');?>', handler: function( b, e ){ loadServerLog(); } }]}<?php };?> ] },{ 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 ); } } }] }] }); switch( <?=intval($CUser->Data['last_content_view']);?> ){ case 0: loadDashBoard(); break; case 1: loadMonitoring(); break; case 2: loadArchive(); break; case 3: loadSystemEditor(); break; case 4: loadLocationEditor(); break; case 5: loadUpgradeManagmenet(); break; default: loadDashBoard(); };});
|