2017-05-21 16:18:29 +00:00
|
|
|
/**
|
|
|
|
* Application background system functions
|
|
|
|
*
|
|
|
|
* @author Pierre HUBERT
|
|
|
|
*/
|
|
|
|
|
|
|
|
ComunicWeb.common.system = {
|
|
|
|
/**
|
|
|
|
* Initializate the application
|
|
|
|
*
|
|
|
|
* @return {Boolean} True for a success
|
|
|
|
*/
|
|
|
|
init: function(){
|
2017-06-07 13:53:39 +00:00
|
|
|
|
|
|
|
//Display Comunic logo
|
|
|
|
ComunicWeb.debug.displayComunicLogo();
|
|
|
|
|
2017-05-21 16:18:29 +00:00
|
|
|
//Start init
|
|
|
|
ComunicWeb.debug.logMessage("Start initialization...");
|
|
|
|
|
2017-06-05 14:29:28 +00:00
|
|
|
//Disable tooltips
|
|
|
|
$(function () {
|
|
|
|
$(document.body).tooltip("disable");
|
|
|
|
});
|
|
|
|
|
2017-05-21 16:18:29 +00:00
|
|
|
/**
|
|
|
|
* Prepare login
|
|
|
|
*/
|
|
|
|
//Clean current page content
|
|
|
|
ComunicWeb.common.page.emptyPage();
|
|
|
|
|
|
|
|
//Show a wait splash screen
|
|
|
|
ComunicWeb.common.page.showWaitSplashScreen();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Language initator
|
|
|
|
*/
|
|
|
|
ComunicWeb.common.langs.initLanguages();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* What to do after login refresh
|
|
|
|
*/
|
|
|
|
var afterLoginRefresh = function(){
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Open a page
|
|
|
|
*/
|
|
|
|
//Get current page URI
|
|
|
|
var currentPage = ComunicWeb.common.url.getCurrentWebsiteURL();
|
|
|
|
|
|
|
|
//Open a page
|
|
|
|
ComunicWeb.common.page.openPage(currentPage);
|
|
|
|
|
|
|
|
//End of init
|
|
|
|
ComunicWeb.debug.logMessage("Application is ready !");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get login state
|
|
|
|
*/
|
|
|
|
ComunicWeb.user.userLogin.refreshLoginState(afterLoginRefresh);
|
|
|
|
|
2017-06-03 12:37:59 +00:00
|
|
|
/**
|
|
|
|
* Automaticaly refresh login state
|
|
|
|
*/
|
|
|
|
var autoRefresh = setInterval((function(){
|
|
|
|
ComunicWeb.user.userLogin.refreshLoginState();
|
2017-06-03 13:41:04 +00:00
|
|
|
}), 20000);
|
2017-06-03 12:37:59 +00:00
|
|
|
|
2017-05-21 16:18:29 +00:00
|
|
|
//Sucess
|
|
|
|
return true;
|
|
|
|
},
|
2017-05-21 16:26:18 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Restart the application
|
|
|
|
*
|
|
|
|
* @return {Boolean} True for a success
|
|
|
|
*/
|
|
|
|
restart: function(){
|
|
|
|
//Show a wait splashscreen message
|
|
|
|
ComunicWeb.common.page.showWaitSplashScreen("Restarting...");
|
|
|
|
|
|
|
|
//Reload the page
|
|
|
|
location.href = document.location;
|
|
|
|
}
|
2017-05-21 16:18:29 +00:00
|
|
|
};
|