mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-04 12:14:12 +00:00 
			
		
		
		
	Created system object
This commit is contained in:
		@@ -14,6 +14,13 @@ var ComunicWeb = {
 | 
				
			|||||||
     * Common functions
 | 
					     * Common functions
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    common:{
 | 
					    common:{
 | 
				
			||||||
 | 
					        /**
 | 
				
			||||||
 | 
					         * Application system functions
 | 
				
			||||||
 | 
					         */
 | 
				
			||||||
 | 
					        system:{
 | 
				
			||||||
 | 
					            //TODO: implement
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /**
 | 
					        /**
 | 
				
			||||||
         * API functions
 | 
					         * 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;
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
@@ -30,3 +30,15 @@ function createElem(nodeType, appendTo){
 | 
				
			|||||||
function byId(nodeName){
 | 
					function byId(nodeName){
 | 
				
			||||||
	return document.getElementById(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
 | 
					//Anonymous function
 | 
				
			||||||
(function(){
 | 
					(function(){
 | 
				
			||||||
    
 | 
					    //Launch app
 | 
				
			||||||
    //Start init
 | 
					    ComunicWeb.common.system.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);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -70,5 +70,7 @@ ComunicWeb.pages.menuBar = {
 | 
				
			|||||||
				ComunicWeb.common.page.openPage("home");
 | 
									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/page.js",
 | 
				
			||||||
    "%PATH_ASSETS%js/common/notifications.js",
 | 
					    "%PATH_ASSETS%js/common/notifications.js",
 | 
				
			||||||
    "%PATH_ASSETS%js/common/formChecker.js",
 | 
					    "%PATH_ASSETS%js/common/formChecker.js",
 | 
				
			||||||
 | 
					    "%PATH_ASSETS%js/common/system.js",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //User scripts
 | 
					    //User scripts
 | 
				
			||||||
    "%PATH_ASSETS%js/user/loginTokens.js",
 | 
					    "%PATH_ASSETS%js/user/loginTokens.js",
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user