Subversion Repositories ALCASAR

Rev

Blame | Last modification | View Log

function getErrorTranslation(statusCode) {
        if(typeof translation == 'undefined') {
                return;
        }

        var language = (window.navigator.userLanguage || window.navigator.language).toLowerCase().split('-')[0];

        var title = translation['error'][language] + ' ' + statusCode;

        if(!translation.hasOwnProperty(statusCode)) {
                // Setting unknown error
                statusCode = 0;
                title = translation['unknown'][language];
        }

        if(!translation[statusCode].hasOwnProperty(language)) {
                if(translation[statusCode].hasOwnProperty('en')) {
                        // Default language : english
                        language = 'en';
                } else {
                        return;
                }
        }

        return {
                'title': title,
                'message': translation[statusCode][language]
        }
}

function setErrorMessage(data) {
        if(typeof data['title'] == 'undefined' || typeof data['message'] == 'undefined') {
                return;
        }

        var acces_controle = document.getElementById('acces_controle');
        var contenu_error = document.getElementById('contenu_error');

        document.title += " " + data['title'];
        acces_controle.innerHTML = data['title'];
        contenu_error.innerHTML = data['message'];
}

Generated by GNU Enscript 1.6.6.