From 9d0572cfa7dec20bfd0e0e3b47c3d496d0195bd4 Mon Sep 17 00:00:00 2001 From: Pierre Date: Mon, 22 May 2017 18:06:17 +0200 Subject: [PATCH] Created components section --- assets/js/common/functionsSchema.js | 616 +++++++++++---------- assets/js/common/page.js | 2 +- assets/js/{pages => components}/menuBar.js | 2 +- corePage/config/dev.config.php | 4 +- 4 files changed, 317 insertions(+), 307 deletions(-) rename assets/js/{pages => components}/menuBar.js (98%) diff --git a/assets/js/common/functionsSchema.js b/assets/js/common/functionsSchema.js index 2967e4a0..d8cc1b4a 100644 --- a/assets/js/common/functionsSchema.js +++ b/assets/js/common/functionsSchema.js @@ -5,363 +5,371 @@ */ var ComunicWeb = { - /** - * Configuration inclusion - */ - __config: ComunicConfig, + /** + * Configuration inclusion + */ + __config: ComunicConfig, - /** - * Common functions - */ - common:{ - /** - * Application system functions - */ - system:{ - //TODO: implement - }, + /** + * Common functions + */ + common:{ + /** + * Application system functions + */ + system:{ + //TODO: implement + }, - /** - * API functions - */ - api: { - /** - * Make an API request - */ - makeAPIrequest: function(apiURI, params, requireLoginTokens, nextAction){}, - }, + /** + * API functions + */ + api: { + /** + * Make an API request + */ + makeAPIrequest: function(apiURI, params, requireLoginTokens, nextAction){}, + }, - /** - * Langs functions - */ - langs: { - /** - * Return current language - */ - getCurrentLanguage: function(){}, + /** + * Langs functions + */ + langs: { + /** + * Return current language + */ + getCurrentLanguage: function(){}, - /** - * Include and install specified language - */ - installLanguage: function(languageID){}, + /** + * Include and install specified language + */ + installLanguage: function(languageID){}, - /** - * Initializate languages - */ - initLanguages: function(){}, + /** + * Initializate languages + */ + initLanguages: function(){}, - /** - * Return a string in correct language - */ - getTranslatedText: function(stringName, stringParams){}, - }, + /** + * Return a string in correct language + */ + getTranslatedText: function(stringName, stringParams){}, + }, - /** - * Messages functions - */ - messages: { + /** + * Messages functions + */ + messages: { - /** - * Create and return a callout element - */ - createCalloutElem: function(calloutTitle, calloutMessage, calloutType){}, - }, + /** + * Create and return a callout element + */ + createCalloutElem: function(calloutTitle, calloutMessage, calloutType){}, + }, - /** - * Error functions - */ - error:{ - /** - * Submit an error - */ - submitError: function(errorLevel, errorMessage, errorCode, errorData){}, + /** + * Error functions + */ + error:{ + /** + * Submit an error + */ + submitError: function(errorLevel, errorMessage, errorCode, errorData){}, - /** - * Handle and show a fatal error - */ - fatalError: function(errorMessage, errorCode, errorData){}, + /** + * Handle and show a fatal error + */ + fatalError: function(errorMessage, errorCode, errorData){}, - /** - * Handle a 404 not found error - */ - pageNotFound: function(additionnalData, targetElement){}, - }, + /** + * Handle a 404 not found error + */ + pageNotFound: function(additionnalData, targetElement){}, + }, - /** - * URL functions - */ - url:{ - /** - * Return current URL opened on the website - */ - getCurrentWebsiteURL: function(){}, + /** + * URL functions + */ + url:{ + /** + * Return current URL opened on the website + */ + getCurrentWebsiteURL: function(){}, - /** - * Change the current website URI - */ - changeURI: function(newTitle, newURI){}, - }, + /** + * Change the current website URI + */ + changeURI: function(newTitle, newURI){}, + }, - /** - * Page functions - */ - page: { - /** - * Empty current page - */ - emptyPage: function(createWrapper){}, + /** + * Page functions + */ + page: { + /** + * Empty current page + */ + emptyPage: function(createWrapper){}, - /** - * Show a full wait splash screen - * - * @param {String} message A message to explain the reason of the splash screen (optionnal) - */ - showWaitSplashScreen: function(message){}, + /** + * Show a full wait splash screen + * + * @param {String} message A message to explain the reason of the splash screen (optionnal) + */ + showWaitSplashScreen: function(message){}, - /** - * Show a transparent wait splash screen - */ - showTransparentWaitSplashScreen: function(){}, + /** + * Show a transparent wait splash screen + */ + showTransparentWaitSplashScreen: function(){}, - /** - * Open a page - */ - openPage: function(pageURI, additionnalData){}, + /** + * Open a page + */ + openPage: function(pageURI, additionnalData){}, - /** - * Prepare a template load by specifying datas - */ - prepareLoadTemplate: function(){}, + /** + * Prepare a template load by specifying datas + */ + prepareLoadTemplate: function(){}, - /** - * Load, parse and show an HTML template - */ - getAndShowTemplate: function(targetElem, dataTemplate, templateURI, nextAction, cleanContener){}, + /** + * Load, parse and show an HTML template + */ + getAndShowTemplate: function(targetElem, dataTemplate, templateURI, nextAction, cleanContener){}, - /** - * Convert a JSON object into html elements - */ - convertJSONobjectTOhtmlElement: function(parentNodeChilds, values){}, + /** + * Convert a JSON object into html elements + */ + convertJSONobjectTOhtmlElement: function(parentNodeChilds, values){}, - /** - * Get and show a JSON template - */ - getAndShowJSONtemplate: function(targetElem, templateURI, additionalData, afterParsingJSONtemplate, cleanContener){}, - }, + /** + * Get and show a JSON template + */ + getAndShowJSONtemplate: function(targetElem, templateURI, additionalData, afterParsingJSONtemplate, cleanContener){}, + }, - /** - * Functions to check data input in forms - */ - formChecker: { - //TODO : implement - }, + /** + * Functions to check data input in forms + */ + formChecker: { + //TODO : implement + }, - /** - * Notification system - */ - notificationSystem: { - - /** - * Display a notification - */ - showNotification: function(message, notifType, notifDuration, notifTitle){}, + /** + * Notification system + */ + notificationSystem: { + + /** + * Display a notification + */ + showNotification: function(message, notifType, notifDuration, notifTitle){}, - }, + }, - /** - * Network common requests - */ - network: { + /** + * Network common requests + */ + network: { - /** - * @var {object} Cache contener - */ - cache: {}, - - /** - * Make a get request - */ - getRequest: function(url, cache, GETnextAction){}, - }, + /** + * @var {object} Cache contener + */ + cache: {}, + + /** + * Make a get request + */ + getRequest: function(url, cache, GETnextAction){}, + }, - /** - * Operations on JS files - */ - jsFiles:{ + /** + * Operations on JS files + */ + jsFiles:{ - /** - * Include a Javascript file - */ - includeFile: function(fileURL){}, + /** + * Include a Javascript file + */ + includeFile: function(fileURL){}, - /** - * Execute some source code contained in a variable - */ - executeJSsource: function(source){}, - }, - }, + /** + * Execute some source code contained in a variable + */ + executeJSsource: function(source){}, + }, + }, - /** - * Debug functions - */ - debug:{ - /** - * @var {Object} Internal log variable - */ - __log: {}, + /** + * Debug functions + */ + debug:{ + /** + * @var {Object} Internal log variable + */ + __log: {}, - /** - * Display message on browser console - */ - logMessage: function(message){}, + /** + * Display message on browser console + */ + logMessage: function(message){}, - /** - * Save a new log message - */ - saveLogMessage: function(message){}, + /** + * Save a new log message + */ + saveLogMessage: function(message){}, - /** - * Get log content in a string - */ - getLogContent: function(){}, - }, + /** + * Get log content in a string + */ + getLogContent: function(){}, + }, - /** - * User functions - */ - user:{ - /** - * Login tokens storage controller - */ - loginTokens: { - /** - * Set User tokens - */ - setUserTokens: function(tokens, storageType){}, + /** + * User functions + */ + user:{ + /** + * Login tokens storage controller + */ + loginTokens: { + /** + * Set User tokens + */ + setUserTokens: function(tokens, storageType){}, - /** - * Check if there is any login tokens available - */ - checkLoginTokens: function(){}, + /** + * Check if there is any login tokens available + */ + checkLoginTokens: function(){}, - /** - * Get login tokens - */ - getLoginTokens: function(){}, + /** + * Get login tokens + */ + getLoginTokens: function(){}, - /** - * Perform user logout - */ - deleteLoginTokens: function(){}, - }, + /** + * Perform user logout + */ + deleteLoginTokens: function(){}, + }, - /** - * Manage user login - */ - userLogin: { - /** - * @var {Boolean} Store user login state (true by default) - */ - __userLogin: true, + /** + * Manage user login + */ + userLogin: { + /** + * @var {Boolean} Store user login state (true by default) + */ + __userLogin: true, - /** - * @var {Integer} Store the current user ID - */ - __userID: 0, + /** + * @var {Integer} Store the current user ID + */ + __userID: 0, - /** - * Tell if user is logged in or not - */ - getUserLoginState: function(){}, + /** + * Tell if user is logged in or not + */ + getUserLoginState: function(){}, - /** - * Get user ID (if logged in) - */ - getUserID: function(){}, + /** + * Get user ID (if logged in) + */ + getUserID: function(){}, - /** - * Try to get and store current user ID - */ - getCurrentUserId: function(afterGetCurrentUserID){}, + /** + * Try to get and store current user ID + */ + getCurrentUserId: function(afterGetCurrentUserID){}, - /** - * Refresh the user login state - */ - refreshLoginState: function(afterLogin){}, + /** + * Refresh the user login state + */ + refreshLoginState: function(afterLogin){}, - /** - * Try to login user - */ - loginUser: function(usermail, userpassword, permanentLogin, afterLogin){}, + /** + * Try to login user + */ + loginUser: function(usermail, userpassword, permanentLogin, afterLogin){}, - /** - * Logout user - */ - logoutUser: function(afterLogout){}, - }, - - /** - * Get user infos - */ - userInfos: { - //TODO: implement - }, - }, + /** + * Logout user + */ + logoutUser: function(afterLogout){}, + }, + + /** + * Get user infos + */ + userInfos: { + //TODO: implement + }, + }, - /** - * Pages controllers - */ - pages:{ + /** + * Application components + */ + components: { - /** - * Menubar - */ - menuBar: { - //TODO: implement - }, + /** + * Menubar + */ + menuBar: { + //TODO: implement + }, - /** - * Home page - */ - home: { - /** - * Common homes functions - */ - home:{ - /** - * Open home page - */ - openHomePage: function(additionnalData, targetElement){}, + }, + + /** + * Pages controllers + */ + pages:{ - }, - }, + /** + * Home page + */ + home: { + /** + * Common homes functions + */ + home:{ + /** + * Open home page + */ + openHomePage: function(additionnalData, targetElement){}, - /** - * Login controller - */ - login:{ - /** - * Open login page - */ - openLoginPage: function(additionnalData, targetElement){}, - /** - * Perform user login - */ - loginSubmit: function(){}, - }, + }, + }, - /** - * Logout controller - */ - logout: { - /** - * Open logout page and perform logout - */ - openLogoutPage: function(additionnalData, targetElement){}, - }, + /** + * Login controller + */ + login:{ + /** + * Open login page + */ + openLoginPage: function(additionnalData, targetElement){}, - }, + /** + * Perform user login + */ + loginSubmit: function(){}, + }, + + /** + * Logout controller + */ + logout: { + /** + * Open logout page and perform logout + */ + openLogoutPage: function(additionnalData, targetElement){}, + }, + + }, } \ No newline at end of file diff --git a/assets/js/common/page.js b/assets/js/common/page.js index d65c7b56..7132cfd0 100644 --- a/assets/js/common/page.js +++ b/assets/js/common/page.js @@ -172,7 +172,7 @@ ComunicWeb.common.page = { document.body.className="hold-transition skin-blue layout-top-nav"; //We load the menubar - ComunicWeb.pages.menuBar.display(); + ComunicWeb.components.menuBar.display(); } //Check if some additionnal data was specified diff --git a/assets/js/pages/menuBar.js b/assets/js/components/menuBar.js similarity index 98% rename from assets/js/pages/menuBar.js rename to assets/js/components/menuBar.js index c1867807..f6d896e5 100644 --- a/assets/js/pages/menuBar.js +++ b/assets/js/components/menuBar.js @@ -4,7 +4,7 @@ * @author Pierre HUBERT */ -ComunicWeb.pages.menuBar = { +ComunicWeb.components.menuBar = { /** * Display menu bar * diff --git a/corePage/config/dev.config.php b/corePage/config/dev.config.php index c4a60055..a59b39f9 100644 --- a/corePage/config/dev.config.php +++ b/corePage/config/dev.config.php @@ -52,13 +52,15 @@ $config['JSfiles'] = array( "%PATH_ASSETS%js/common/formChecker.js", "%PATH_ASSETS%js/common/system.js", + //Components + "%PATH_ASSETS%js/components/menuBar.js", + //User scripts "%PATH_ASSETS%js/user/loginTokens.js", "%PATH_ASSETS%js/user/userLogin.js", "%PATH_ASSETS%js/user/userInfos.js", //Pages scripts - "%PATH_ASSETS%js/pages/menuBar.js", "%PATH_ASSETS%js/pages/home/home.js", "%PATH_ASSETS%js/pages/login.js", "%PATH_ASSETS%js/pages/logout.js",