Created components section

This commit is contained in:
Pierre 2017-05-22 18:06:17 +02:00
parent c33809cb3a
commit 9d0572cfa7
4 changed files with 317 additions and 307 deletions

View File

@ -5,363 +5,371 @@
*/ */
var ComunicWeb = { var ComunicWeb = {
/** /**
* Configuration inclusion * Configuration inclusion
*/ */
__config: ComunicConfig, __config: ComunicConfig,
/** /**
* Common functions * Common functions
*/ */
common:{ common:{
/** /**
* Application system functions * Application system functions
*/ */
system:{ system:{
//TODO: implement //TODO: implement
}, },
/** /**
* API functions * API functions
*/ */
api: { api: {
/** /**
* Make an API request * Make an API request
*/ */
makeAPIrequest: function(apiURI, params, requireLoginTokens, nextAction){}, makeAPIrequest: function(apiURI, params, requireLoginTokens, nextAction){},
}, },
/** /**
* Langs functions * Langs functions
*/ */
langs: { langs: {
/** /**
* Return current language * Return current language
*/ */
getCurrentLanguage: function(){}, getCurrentLanguage: function(){},
/** /**
* Include and install specified language * Include and install specified language
*/ */
installLanguage: function(languageID){}, installLanguage: function(languageID){},
/** /**
* Initializate languages * Initializate languages
*/ */
initLanguages: function(){}, initLanguages: function(){},
/** /**
* Return a string in correct language * Return a string in correct language
*/ */
getTranslatedText: function(stringName, stringParams){}, getTranslatedText: function(stringName, stringParams){},
}, },
/** /**
* Messages functions * Messages functions
*/ */
messages: { messages: {
/** /**
* Create and return a callout element * Create and return a callout element
*/ */
createCalloutElem: function(calloutTitle, calloutMessage, calloutType){}, createCalloutElem: function(calloutTitle, calloutMessage, calloutType){},
}, },
/** /**
* Error functions * Error functions
*/ */
error:{ error:{
/** /**
* Submit an error * Submit an error
*/ */
submitError: function(errorLevel, errorMessage, errorCode, errorData){}, submitError: function(errorLevel, errorMessage, errorCode, errorData){},
/** /**
* Handle and show a fatal error * Handle and show a fatal error
*/ */
fatalError: function(errorMessage, errorCode, errorData){}, fatalError: function(errorMessage, errorCode, errorData){},
/** /**
* Handle a 404 not found error * Handle a 404 not found error
*/ */
pageNotFound: function(additionnalData, targetElement){}, pageNotFound: function(additionnalData, targetElement){},
}, },
/** /**
* URL functions * URL functions
*/ */
url:{ url:{
/** /**
* Return current URL opened on the website * Return current URL opened on the website
*/ */
getCurrentWebsiteURL: function(){}, getCurrentWebsiteURL: function(){},
/** /**
* Change the current website URI * Change the current website URI
*/ */
changeURI: function(newTitle, newURI){}, changeURI: function(newTitle, newURI){},
}, },
/** /**
* Page functions * Page functions
*/ */
page: { page: {
/** /**
* Empty current page * Empty current page
*/ */
emptyPage: function(createWrapper){}, emptyPage: function(createWrapper){},
/** /**
* Show a full wait splash screen * Show a full wait splash screen
* *
* @param {String} message A message to explain the reason of the splash screen (optionnal) * @param {String} message A message to explain the reason of the splash screen (optionnal)
*/ */
showWaitSplashScreen: function(message){}, showWaitSplashScreen: function(message){},
/** /**
* Show a transparent wait splash screen * Show a transparent wait splash screen
*/ */
showTransparentWaitSplashScreen: function(){}, showTransparentWaitSplashScreen: function(){},
/** /**
* Open a page * Open a page
*/ */
openPage: function(pageURI, additionnalData){}, openPage: function(pageURI, additionnalData){},
/** /**
* Prepare a template load by specifying datas * Prepare a template load by specifying datas
*/ */
prepareLoadTemplate: function(){}, prepareLoadTemplate: function(){},
/** /**
* Load, parse and show an HTML template * Load, parse and show an HTML template
*/ */
getAndShowTemplate: function(targetElem, dataTemplate, templateURI, nextAction, cleanContener){}, getAndShowTemplate: function(targetElem, dataTemplate, templateURI, nextAction, cleanContener){},
/** /**
* Convert a JSON object into html elements * Convert a JSON object into html elements
*/ */
convertJSONobjectTOhtmlElement: function(parentNodeChilds, values){}, convertJSONobjectTOhtmlElement: function(parentNodeChilds, values){},
/** /**
* Get and show a JSON template * Get and show a JSON template
*/ */
getAndShowJSONtemplate: function(targetElem, templateURI, additionalData, afterParsingJSONtemplate, cleanContener){}, getAndShowJSONtemplate: function(targetElem, templateURI, additionalData, afterParsingJSONtemplate, cleanContener){},
}, },
/** /**
* Functions to check data input in forms * Functions to check data input in forms
*/ */
formChecker: { formChecker: {
//TODO : implement //TODO : implement
}, },
/** /**
* Notification system * Notification system
*/ */
notificationSystem: { notificationSystem: {
/** /**
* Display a notification * Display a notification
*/ */
showNotification: function(message, notifType, notifDuration, notifTitle){}, showNotification: function(message, notifType, notifDuration, notifTitle){},
}, },
/** /**
* Network common requests * Network common requests
*/ */
network: { network: {
/** /**
* @var {object} Cache contener * @var {object} Cache contener
*/ */
cache: {}, cache: {},
/** /**
* Make a get request * Make a get request
*/ */
getRequest: function(url, cache, GETnextAction){}, getRequest: function(url, cache, GETnextAction){},
}, },
/** /**
* Operations on JS files * Operations on JS files
*/ */
jsFiles:{ jsFiles:{
/** /**
* Include a Javascript file * Include a Javascript file
*/ */
includeFile: function(fileURL){}, includeFile: function(fileURL){},
/** /**
* Execute some source code contained in a variable * Execute some source code contained in a variable
*/ */
executeJSsource: function(source){}, executeJSsource: function(source){},
}, },
}, },
/** /**
* Debug functions * Debug functions
*/ */
debug:{ debug:{
/** /**
* @var {Object} Internal log variable * @var {Object} Internal log variable
*/ */
__log: {}, __log: {},
/** /**
* Display message on browser console * Display message on browser console
*/ */
logMessage: function(message){}, logMessage: function(message){},
/** /**
* Save a new log message * Save a new log message
*/ */
saveLogMessage: function(message){}, saveLogMessage: function(message){},
/** /**
* Get log content in a string * Get log content in a string
*/ */
getLogContent: function(){}, getLogContent: function(){},
}, },
/** /**
* User functions * User functions
*/ */
user:{ user:{
/** /**
* Login tokens storage controller * Login tokens storage controller
*/ */
loginTokens: { loginTokens: {
/** /**
* Set User tokens * Set User tokens
*/ */
setUserTokens: function(tokens, storageType){}, setUserTokens: function(tokens, storageType){},
/** /**
* Check if there is any login tokens available * Check if there is any login tokens available
*/ */
checkLoginTokens: function(){}, checkLoginTokens: function(){},
/** /**
* Get login tokens * Get login tokens
*/ */
getLoginTokens: function(){}, getLoginTokens: function(){},
/** /**
* Perform user logout * Perform user logout
*/ */
deleteLoginTokens: function(){}, deleteLoginTokens: function(){},
}, },
/** /**
* Manage user login * Manage user login
*/ */
userLogin: { userLogin: {
/** /**
* @var {Boolean} Store user login state (true by default) * @var {Boolean} Store user login state (true by default)
*/ */
__userLogin: true, __userLogin: true,
/** /**
* @var {Integer} Store the current user ID * @var {Integer} Store the current user ID
*/ */
__userID: 0, __userID: 0,
/** /**
* Tell if user is logged in or not * Tell if user is logged in or not
*/ */
getUserLoginState: function(){}, getUserLoginState: function(){},
/** /**
* Get user ID (if logged in) * Get user ID (if logged in)
*/ */
getUserID: function(){}, getUserID: function(){},
/** /**
* Try to get and store current user ID * Try to get and store current user ID
*/ */
getCurrentUserId: function(afterGetCurrentUserID){}, getCurrentUserId: function(afterGetCurrentUserID){},
/** /**
* Refresh the user login state * Refresh the user login state
*/ */
refreshLoginState: function(afterLogin){}, refreshLoginState: function(afterLogin){},
/** /**
* Try to login user * Try to login user
*/ */
loginUser: function(usermail, userpassword, permanentLogin, afterLogin){}, loginUser: function(usermail, userpassword, permanentLogin, afterLogin){},
/** /**
* Logout user * Logout user
*/ */
logoutUser: function(afterLogout){}, logoutUser: function(afterLogout){},
}, },
/** /**
* Get user infos * Get user infos
*/ */
userInfos: { userInfos: {
//TODO: implement //TODO: implement
}, },
}, },
/** /**
* Pages controllers * Application components
*/ */
pages:{ components: {
/** /**
* Menubar * Menubar
*/ */
menuBar: { menuBar: {
//TODO: implement //TODO: implement
}, },
/** },
* Home page
*/ /**
home: { * Pages controllers
/** */
* Common homes functions pages:{
*/
home:{
/**
* Open home page
*/
openHomePage: function(additionnalData, targetElement){},
}, /**
}, * 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 * Login controller
*/ */
logout: { login:{
/** /**
* Open logout page and perform logout * Open login page
*/ */
openLogoutPage: function(additionnalData, targetElement){}, openLoginPage: function(additionnalData, targetElement){},
},
}, /**
* Perform user login
*/
loginSubmit: function(){},
},
/**
* Logout controller
*/
logout: {
/**
* Open logout page and perform logout
*/
openLogoutPage: function(additionnalData, targetElement){},
},
},
} }

View File

@ -172,7 +172,7 @@ ComunicWeb.common.page = {
document.body.className="hold-transition skin-blue layout-top-nav"; document.body.className="hold-transition skin-blue layout-top-nav";
//We load the menubar //We load the menubar
ComunicWeb.pages.menuBar.display(); ComunicWeb.components.menuBar.display();
} }
//Check if some additionnal data was specified //Check if some additionnal data was specified

View File

@ -4,7 +4,7 @@
* @author Pierre HUBERT * @author Pierre HUBERT
*/ */
ComunicWeb.pages.menuBar = { ComunicWeb.components.menuBar = {
/** /**
* Display menu bar * Display menu bar
* *

View File

@ -52,13 +52,15 @@ $config['JSfiles'] = array(
"%PATH_ASSETS%js/common/formChecker.js", "%PATH_ASSETS%js/common/formChecker.js",
"%PATH_ASSETS%js/common/system.js", "%PATH_ASSETS%js/common/system.js",
//Components
"%PATH_ASSETS%js/components/menuBar.js",
//User scripts //User scripts
"%PATH_ASSETS%js/user/loginTokens.js", "%PATH_ASSETS%js/user/loginTokens.js",
"%PATH_ASSETS%js/user/userLogin.js", "%PATH_ASSETS%js/user/userLogin.js",
"%PATH_ASSETS%js/user/userInfos.js", "%PATH_ASSETS%js/user/userInfos.js",
//Pages scripts //Pages scripts
"%PATH_ASSETS%js/pages/menuBar.js",
"%PATH_ASSETS%js/pages/home/home.js", "%PATH_ASSETS%js/pages/home/home.js",
"%PATH_ASSETS%js/pages/login.js", "%PATH_ASSETS%js/pages/login.js",
"%PATH_ASSETS%js/pages/logout.js", "%PATH_ASSETS%js/pages/logout.js",