Created a shortcut functions file

This commit is contained in:
Pierre 2017-05-25 13:55:49 +02:00
parent cf4ff4675d
commit 3a6c782ba1
4 changed files with 33 additions and 12 deletions

View File

@ -93,6 +93,7 @@ ComunicWeb.common.page = {
*
* @param {String} pageURI The URI to the page
* @param {Object} additionnalData Additionnal data to pass to the new page
* @return {Boolean} True for a success
*/
openPage: function(pageURI, additionnalData){
//Log message
@ -186,6 +187,8 @@ ComunicWeb.common.page = {
//Call the method related to the page
eval(pageInfos.methodHandler + ("(additionnalData, pageTarget);"));
//Success
return true;
},
/**

View File

@ -3,3 +3,30 @@
*
* @author Pierre HUBERT
*/
/**
* Create a quick language access function shorcut
*
* @param {String} stringName The name of the string to show
* @param {Array} stringParams The optionnal parametres to include with the string
* @return {String} The string ready to show
*/
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);
}
/**
* Function to change currently opened page
*
* @param {String} pageURI The URI to the page
* @param {Object} additionnalData Additionnal data to pass to the new page
* @return {Boolean} True for a success
*/
function openPage(pageURI, additionnalData){
return ComunicWeb.common.page.openPage(pageURI, additionnalData);
}

View File

@ -60,16 +60,4 @@ function emptyElem(container){
*/
function checkMail(emailAddress){
return (emailAddress.match(/^[a-zA-Z0-9_.]+@[a-zA-Z0-9-]{1,}[.][a-zA-Z]{2,5}$/) === null ? false : true);
}
/**
* 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);
}

View File

@ -74,6 +74,9 @@ $config['JSfiles'] = array(
"%PATH_ASSETS%js/pages/login.js",
"%PATH_ASSETS%js/pages/logout.js",
//Create shortcuts for common functions
"%PATH_ASSETS%js/common/shorcuts.js",
//Init script
"%PATH_ASSETS%js/init.js",
);