2017-01-08 14:54:25 +00:00
|
|
|
/**
|
|
|
|
* Comunic WebApp schema
|
|
|
|
*
|
|
|
|
* @author Pierre HUBERT
|
|
|
|
*/
|
|
|
|
var ComunicWeb = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Configuration inclusion
|
|
|
|
*/
|
|
|
|
__config: ComunicConfig,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Common functions
|
|
|
|
*/
|
|
|
|
common:{
|
|
|
|
/**
|
2017-01-25 15:52:22 +00:00
|
|
|
* API functions
|
2017-01-08 14:54:25 +00:00
|
|
|
*/
|
2017-01-25 15:52:22 +00:00
|
|
|
api: {
|
2017-01-08 14:54:25 +00:00
|
|
|
/**
|
|
|
|
* Make an API request
|
|
|
|
*/
|
|
|
|
makeAPIrequest: function(apiURI, params, nextAction){},
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Langs functions
|
|
|
|
*/
|
|
|
|
langs: {
|
|
|
|
/**
|
|
|
|
* Return current language
|
|
|
|
*/
|
|
|
|
getCurrentLanguage: function(){},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Include and install specified language
|
|
|
|
*/
|
|
|
|
installLanguage: function(languageID){},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializate languages
|
|
|
|
*/
|
|
|
|
initLanguages: function(){},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a string in correct language
|
|
|
|
*/
|
|
|
|
getTranslatedText: function(stringName, stringParams){},
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Messages functions
|
|
|
|
*/
|
|
|
|
messages: {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create and return a callout element
|
|
|
|
*/
|
|
|
|
createCalloutElem: function(calloutTitle, calloutMessage, calloutType){},
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Error functions
|
|
|
|
*/
|
|
|
|
error:{
|
2017-01-08 15:17:22 +00:00
|
|
|
/**
|
|
|
|
* Submit an error
|
|
|
|
*/
|
|
|
|
submitError: function(errorLevel, errorMessage, errorCode, errorData){},
|
2017-01-08 14:54:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle and show a fatal error
|
|
|
|
*/
|
2017-01-08 15:17:22 +00:00
|
|
|
fatalError: function(errorMessage, errorCode, errorData){},
|
2017-01-22 17:46:06 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle a 404 not found error
|
|
|
|
*/
|
2017-01-25 15:52:22 +00:00
|
|
|
pageNotFound: function(additionnalData, targetElement){},
|
2017-01-08 15:17:22 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* URL functions
|
|
|
|
*/
|
|
|
|
url:{
|
2017-01-25 15:52:22 +00:00
|
|
|
/**
|
|
|
|
* Return current URL opened on the website
|
|
|
|
*/
|
|
|
|
getCurrentWebsiteURL: function(){},
|
2017-01-08 14:54:25 +00:00
|
|
|
},
|
|
|
|
|
2017-01-21 18:30:27 +00:00
|
|
|
/**
|
|
|
|
* Page functions
|
|
|
|
*/
|
|
|
|
page: {
|
2017-01-22 17:46:06 +00:00
|
|
|
/**
|
|
|
|
* Empty current page
|
|
|
|
*/
|
|
|
|
emptyPage: function(createWrapper){},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show a full wait splash screen
|
|
|
|
*/
|
|
|
|
showWaitSplashScreen: function(){},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Open a page
|
|
|
|
*/
|
|
|
|
openPage: function(pageURI, additionnalData){},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Prepare a template load by specifying datas
|
|
|
|
*/
|
|
|
|
prepareLoadTemplate: function(){},
|
2017-01-21 18:30:27 +00:00
|
|
|
|
2017-01-22 17:46:06 +00:00
|
|
|
/**
|
|
|
|
* Load, parse and show a template
|
|
|
|
*/
|
2017-01-25 15:52:22 +00:00
|
|
|
getAndShowTemplate: function(targetElem, dataTemplate, templateURI, nextAction, cleanContener){},
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Network common requests
|
|
|
|
*/
|
|
|
|
network: {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var {object} Cache contener
|
|
|
|
*/
|
|
|
|
cache: {},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Make a get request
|
|
|
|
*/
|
|
|
|
getRequest: function(url, cache, GETnextAction){},
|
2017-01-21 18:30:27 +00:00
|
|
|
},
|
2017-01-08 15:17:22 +00:00
|
|
|
|
2017-01-08 14:54:25 +00:00
|
|
|
/**
|
|
|
|
* Operations on JS files
|
|
|
|
*/
|
|
|
|
jsFiles:{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Include a Javascript file
|
|
|
|
*/
|
|
|
|
includeFile: function(fileURL){},
|
2017-01-22 17:46:06 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute some source code contained in a variable
|
|
|
|
*/
|
|
|
|
executeJSsource: function(source){},
|
2017-01-08 14:54:25 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Debug functions
|
|
|
|
*/
|
|
|
|
debug:{
|
2017-01-22 17:46:06 +00:00
|
|
|
/**
|
|
|
|
* @var {Object} Internal log variable
|
|
|
|
*/
|
|
|
|
__log: {},
|
|
|
|
|
2017-01-08 14:54:25 +00:00
|
|
|
/**
|
|
|
|
* Display message on browser console
|
|
|
|
*/
|
|
|
|
logMessage: function(message){},
|
2017-01-22 17:46:06 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Save a new log message
|
|
|
|
*/
|
|
|
|
saveLogMessage: function(message){},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get log content in a string
|
|
|
|
*/
|
|
|
|
getLogContent: function(){},
|
2017-01-28 13:07:18 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* User functions
|
|
|
|
*/
|
|
|
|
user:{
|
|
|
|
/**
|
|
|
|
* Login tokens storage controller
|
|
|
|
*/
|
|
|
|
loginTokens: {
|
2017-01-28 17:43:30 +00:00
|
|
|
/**
|
|
|
|
* Set User tokens
|
|
|
|
*/
|
|
|
|
setUserTokens: function(tokens, storageType){},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if there is any login tokens available
|
|
|
|
*/
|
|
|
|
checkLoginTokens: function(){},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get login tokens
|
|
|
|
*/
|
|
|
|
getLoginTokens: function(){},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Perform user logout
|
|
|
|
*/
|
|
|
|
deleteLoginTokens: function(){},
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Manage user login
|
|
|
|
*/
|
|
|
|
userLogin: {
|
2017-01-28 13:07:18 +00:00
|
|
|
//TODO: implement
|
|
|
|
},
|
|
|
|
},
|
2017-01-08 14:54:25 +00:00
|
|
|
}
|