mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-03 19:54:14 +00:00 
			
		
		
		
	Created a shortcut functions file
This commit is contained in:
		@@ -93,6 +93,7 @@ ComunicWeb.common.page = {
 | 
				
			|||||||
     * 
 | 
					     * 
 | 
				
			||||||
     * @param {String} pageURI The URI to the page
 | 
					     * @param {String} pageURI The URI to the page
 | 
				
			||||||
     * @param {Object} additionnalData Additionnal data to pass to the new page
 | 
					     * @param {Object} additionnalData Additionnal data to pass to the new page
 | 
				
			||||||
 | 
					     * @return {Boolean} True for a success
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    openPage: function(pageURI, additionnalData){
 | 
					    openPage: function(pageURI, additionnalData){
 | 
				
			||||||
        //Log message
 | 
					        //Log message
 | 
				
			||||||
@@ -186,6 +187,8 @@ ComunicWeb.common.page = {
 | 
				
			|||||||
        //Call the method related to the page
 | 
					        //Call the method related to the page
 | 
				
			||||||
        eval(pageInfos.methodHandler + ("(additionnalData, pageTarget);"));
 | 
					        eval(pageInfos.methodHandler + ("(additionnalData, pageTarget);"));
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
					        //Success
 | 
				
			||||||
 | 
					        return true;
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,3 +3,30 @@
 | 
				
			|||||||
 * 
 | 
					 * 
 | 
				
			||||||
 * @author Pierre HUBERT
 | 
					 * @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);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -61,15 +61,3 @@ function emptyElem(container){
 | 
				
			|||||||
function checkMail(emailAddress){
 | 
					function checkMail(emailAddress){
 | 
				
			||||||
	return (emailAddress.match(/^[a-zA-Z0-9_.]+@[a-zA-Z0-9-]{1,}[.][a-zA-Z]{2,5}$/) === null ? false : true);
 | 
						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);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -74,6 +74,9 @@ $config['JSfiles'] = array(
 | 
				
			|||||||
    "%PATH_ASSETS%js/pages/login.js",
 | 
					    "%PATH_ASSETS%js/pages/login.js",
 | 
				
			||||||
    "%PATH_ASSETS%js/pages/logout.js",
 | 
					    "%PATH_ASSETS%js/pages/logout.js",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //Create shortcuts for common functions
 | 
				
			||||||
 | 
					    "%PATH_ASSETS%js/common/shorcuts.js",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //Init script
 | 
					    //Init script
 | 
				
			||||||
    "%PATH_ASSETS%js/init.js",
 | 
					    "%PATH_ASSETS%js/init.js",
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user