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.
520 lines
13 KiB
520 lines
13 KiB
//<?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 = null;
|
|
var sndExcl = null;
|
|
|
|
function playSound( t ){
|
|
if( SoundEnable ){
|
|
switch( t ){
|
|
case 1:{
|
|
if( sndBeep == null ) 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!');
|
|
}
|
|
});
|
|
sndBeep.volume( SoundMode / 3 );
|
|
if( !sndBeep.playing() ) sndBeep.play();
|
|
break;
|
|
};
|
|
default:{
|
|
if( sndExcl == null ) sndExcl = new Howl({
|
|
src: [
|
|
'/style/assets/audio/button-42.mp3',
|
|
'/style/assets/audio/button-42.wav'
|
|
],
|
|
loop: false,
|
|
volume: 0.99
|
|
});
|
|
sndExcl.volume( SoundMode / 3 );
|
|
if( !sndExcl.playing() ) sndExcl.play();
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
function doRefresh(){
|
|
window.location="/?t=" + crypto.randomUUID();
|
|
};
|
|
|
|
function doLogout(){
|
|
window.location = '/login.php?login=guest';//'/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
|
|
},
|
|
success: function(){
|
|
content_lvl0 = Math.floor( initView / 1000 );
|
|
content_lvl1 = Math.floor( ( initView % 1000 )/ 100 );
|
|
content_lvl2 = Math.floor( ( initView % 100 )/ 10 );
|
|
content_lvl3 = initView % 10;
|
|
},
|
|
failure: failureAJAXFunction
|
|
});
|
|
};
|
|
|
|
function updateUserContent(){
|
|
cid = content_lvl3 + content_lvl2 * 10 + content_lvl1*100 + content_lvl0*1000;
|
|
if( initView != cid ) {
|
|
setUserContent( cid );
|
|
return true;
|
|
};
|
|
return false;
|
|
};
|
|
|
|
var gSessionValidatorInterval = null;
|
|
|
|
function sessionValidator(){
|
|
var cTS = (new Date())/1000;
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/validateUserSession.php',
|
|
params: {
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>',
|
|
CTS: cTS
|
|
},
|
|
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 ){
|
|
var lvl0 = Math.floor( cid / 1000 );
|
|
var lvl1 = Math.floor( ( cid % 1000 )/ 100 );
|
|
var lvl2 = Math.floor( ( cid % 100 )/ 10 );
|
|
var lvl3 = cid % 10;
|
|
var refresh = ( lvl0 != content_lvl0 );
|
|
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; };
|
|
updateUserContent();
|
|
if( refresh ){
|
|
switch( content_lvl0 ){
|
|
case 0:{
|
|
var tt = Ext.getCmp('tbtn_0');
|
|
tt.toggle( true, true );
|
|
tt = Ext.getCmp('tbtn_1');
|
|
tt.toggle( false, true );
|
|
tt = Ext.getCmp('tbtn_2');
|
|
tt.toggle( false, true );
|
|
var tP = Ext.getCmp('left_side_menu');
|
|
tP.setVisible( false );
|
|
var tZ = Ext.getCmp('right_side_menu');
|
|
tZ.setVisible( false );
|
|
//initMonitoring();
|
|
Ext.getCmp('main_viewport').doLayout();
|
|
break;
|
|
};
|
|
case 1:{
|
|
var tt = Ext.getCmp('tbtn_0');
|
|
tt.toggle( false, true );
|
|
tt = Ext.getCmp('tbtn_1');
|
|
tt.toggle( true, true );
|
|
tt = Ext.getCmp('tbtn_2');
|
|
tt.toggle( false, true );
|
|
var tP = Ext.getCmp('left_side_menu');
|
|
tP.setVisible( true );
|
|
var tZ = Ext.getCmp('right_side_menu');
|
|
tZ.setVisible( false );
|
|
//initReportsView();
|
|
Ext.getCmp('main_viewport').doLayout();
|
|
break;
|
|
};
|
|
case 2:{
|
|
var tt = Ext.getCmp('tbtn_0');
|
|
tt.toggle( false, true );
|
|
tt = Ext.getCmp('tbtn_1');
|
|
tt.toggle( false, true );
|
|
tt = Ext.getCmp('tbtn_2');
|
|
tt.toggle( true, true );
|
|
var tP = Ext.getCmp('left_side_menu');
|
|
tP.setVisible( true );
|
|
var tZ = Ext.getCmp('right_side_menu');
|
|
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();
|
|
//loadSystemDevices();
|
|
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: 13
|
|
},
|
|
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 ) showContent( 1000 );
|
|
}
|
|
},{
|
|
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 - <?=($AP_DATA['type'] == 1)?'700':'800';?>,
|
|
html: '<p style="font-family: \'Ubuntu\', \'Arial\';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: '<?=$Labels->GetLabel('_SOUND_');?>',
|
|
iconCls: 'snd'+SoundMode,
|
|
scale: 'large',
|
|
style:'text-align: right;',
|
|
handler: function(){
|
|
if( SoundMode == 0 ){
|
|
SoundMode = 3;
|
|
SoundEnable = true;
|
|
} else {
|
|
SoundMode --;
|
|
if( SoundMode == 0 ) SoundEnable = false;
|
|
};
|
|
Ext.getCmp('snd_mode_btn').setIconClass( 'snd'+SoundMode );
|
|
playSound();
|
|
doApplicationOperation( 6, SoundMode );
|
|
}
|
|
},{
|
|
xtype: 'spacer',
|
|
width: 10
|
|
},{
|
|
xtype: 'button',
|
|
id: 'logout_btn',
|
|
text: '<?=$Labels->GetLabel('_LOGOUT_');?>',
|
|
iconCls: 'lout',
|
|
scale: 'large',
|
|
style:'text-align: right;',
|
|
handler: doLogout
|
|
}<?php
|
|
};
|
|
?>
|
|
]
|
|
}]
|
|
},{
|
|
xtype: 'panel',
|
|
id:'left_side_menu',
|
|
region:'west',
|
|
bsaseCls:'x-plain',
|
|
layout: 'fit',
|
|
collapsible: true,
|
|
split: true,
|
|
width: 180,
|
|
minWidth: 180,
|
|
maxWidth: 180,
|
|
hidden: (Math.floor(initView/100)==0),
|
|
margins: '5 0 5 5',
|
|
cmargins:'5 5 5 5',
|
|
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 );
|
|
});
|