mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-12-24 01:48:50 +00:00
Created system object
This commit is contained in:
parent
ba3f2fb246
commit
42cd5dcd1c
@ -14,6 +14,13 @@ var ComunicWeb = {
|
||||
* Common functions
|
||||
*/
|
||||
common:{
|
||||
/**
|
||||
* Application system functions
|
||||
*/
|
||||
system:{
|
||||
//TODO: implement
|
||||
},
|
||||
|
||||
/**
|
||||
* API functions
|
||||
*/
|
||||
|
57
assets/js/common/system.js
Normal file
57
assets/js/common/system.js
Normal file
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Application background system functions
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
ComunicWeb.common.system = {
|
||||
/**
|
||||
* Initializate the application
|
||||
*
|
||||
* @return {Boolean} True for a success
|
||||
*/
|
||||
init: function(){
|
||||
//Start init
|
||||
ComunicWeb.debug.logMessage("Start initialization...");
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
//Sucess
|
||||
return true;
|
||||
},
|
||||
};
|
@ -29,4 +29,16 @@ function createElem(nodeType, appendTo){
|
||||
*/
|
||||
function byId(nodeName){
|
||||
return document.getElementById(nodeName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a quick language access function shorcut
|
||||
*/
|
||||
function lang(stringName, stringParams){
|
||||
//Check if any params has been specified
|
||||
if(!stringParams)
|
||||
var stringParams = [];
|
||||
|
||||
//Call translate function
|
||||
return ComunicWeb.common.langs.getTranslatedText(stringName, stringParams);
|
||||
}
|
@ -6,54 +6,6 @@
|
||||
|
||||
//Anonymous function
|
||||
(function(){
|
||||
|
||||
//Start init
|
||||
ComunicWeb.debug.logMessage("Start initialization...");
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get login state
|
||||
*/
|
||||
ComunicWeb.user.userLogin.refreshLoginState(afterLoginRefresh);
|
||||
|
||||
//End of init
|
||||
ComunicWeb.debug.logMessage("Application is ready !");
|
||||
})();
|
||||
|
||||
//Create a quick language access function shorcut
|
||||
function lang(stringName, stringParams){
|
||||
//Check if any params has been specified
|
||||
if(!stringParams)
|
||||
var stringParams = [];
|
||||
|
||||
//Call function
|
||||
return ComunicWeb.common.langs.getTranslatedText(stringName, stringParams);
|
||||
}
|
||||
//Launch app
|
||||
ComunicWeb.common.system.init();
|
||||
})();
|
@ -70,5 +70,7 @@ ComunicWeb.pages.menuBar = {
|
||||
ComunicWeb.common.page.openPage("home");
|
||||
});
|
||||
|
||||
//Now we need to know if user is logged in or not
|
||||
|
||||
},
|
||||
};
|
@ -50,6 +50,7 @@ $config['JSfiles'] = array(
|
||||
"%PATH_ASSETS%js/common/page.js",
|
||||
"%PATH_ASSETS%js/common/notifications.js",
|
||||
"%PATH_ASSETS%js/common/formChecker.js",
|
||||
"%PATH_ASSETS%js/common/system.js",
|
||||
|
||||
//User scripts
|
||||
"%PATH_ASSETS%js/user/loginTokens.js",
|
||||
|
Loading…
Reference in New Issue
Block a user