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
|
|
|
|
*/
|
2017-01-29 14:49:21 +00:00
|
|
|
makeAPIrequest: function(apiURI, params, requireLoginTokens, nextAction){},
|
2017-01-08 14:54:25 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
/**
|
2017-02-21 11:37:26 +00:00
|
|
|
* Load, parse and show an HTML template
|
2017-01-22 17:46:06 +00:00
|
|
|
*/
|
2017-01-25 15:52:22 +00:00
|
|
|
getAndShowTemplate: function(targetElem, dataTemplate, templateURI, nextAction, cleanContener){},
|
2017-02-21 11:37:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert a JSON object into html elements
|
|
|
|
*/
|
|
|
|
convertJSONobjectTOhtmlElement: function(parentNodeChilds, values){},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get and show a JSON template
|
|
|
|
*/
|
|
|
|
getAndShowJSONtemplate: function(targetElem, templateURI, additionalData, afterParsingJSONtemplate, cleanContener){},
|
2017-01-25 15:52:22 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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-29 14:49:21 +00:00
|
|
|
/**
|
|
|
|
* @var {Boolean} Store user login state (true by default)
|
|
|
|
*/
|
|
|
|
__userLogin: true,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var {Integer} Store the current user ID
|
|
|
|
*/
|
|
|
|
__userID: 0,
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tell if user is logged in or not
|
|
|
|
*/
|
|
|
|
getUserLoginState: function(){},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get user ID (if logged in)
|
|
|
|
*/
|
|
|
|
getUserID: function(){},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Try to get and store current user ID
|
|
|
|
*/
|
|
|
|
getCurrentUserId: function(afterGetCurrentUserID){},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Refresh the user login state
|
|
|
|
*/
|
2017-02-18 17:26:30 +00:00
|
|
|
refreshLoginState: function(afterLogin){},
|
2017-01-29 14:49:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Try to login user
|
|
|
|
*/
|
|
|
|
loginUser: function(usermail, userpassword, permanentLogin, afterLogin){},
|
2017-02-18 17:37:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Logout user
|
|
|
|
*/
|
|
|
|
logoutUser: function(afterLogout){},
|
2017-02-18 17:26:30 +00:00
|
|
|
},
|
|
|
|
|
2017-01-29 14:49:21 +00:00
|
|
|
/**
|
|
|
|
* Get user infos
|
|
|
|
*/
|
|
|
|
userInfos: {
|
2017-01-28 13:07:18 +00:00
|
|
|
//TODO: implement
|
2017-02-18 17:26:30 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pages functions
|
|
|
|
*/
|
|
|
|
pages:{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Home page
|
|
|
|
*/
|
|
|
|
home: {
|
|
|
|
/**
|
|
|
|
* Common homes functions
|
|
|
|
*/
|
|
|
|
home:{
|
|
|
|
/**
|
|
|
|
* Open home page
|
|
|
|
*/
|
|
|
|
openHomePage: function(additionnalData, targetElement){},
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2017-02-18 17:37:36 +00:00
|
|
|
/**
|
|
|
|
* Login controller
|
|
|
|
*/
|
|
|
|
login:{
|
|
|
|
/**
|
|
|
|
* Open login page
|
|
|
|
*/
|
|
|
|
openLoginPage: function(additionnalData, targetElement){},
|
|
|
|
}
|
|
|
|
|
2017-01-28 13:07:18 +00:00
|
|
|
},
|
2017-01-08 14:54:25 +00:00
|
|
|
}
|