From: Greg Burri Date: Tue, 27 Jan 2009 16:43:04 +0000 (+0000) Subject: MOD French -> English (1) X-Git-Url: http://git.euphorik.ch/?p=euphorik.git;a=commitdiff_plain;h=27c4a5ac9000ca933f28abfedbf9607f73619615 MOD French -> English (1) --- diff --git a/js/client.js b/js/client.js index 9ea6ea0..5324f96 100644 --- a/js/client.js +++ b/js/client.js @@ -307,7 +307,7 @@ euphorik.Client.prototype.connexion = function(action, messageJson) { thisClient.chargerDonnees(data); }, function(data) { - thisClient.util.messageDialogue(data.error_message); + thisClient.util.messageDialog(data.error_message); thisClient.delCookie(); // suppression du cookie actuel, cas où le cookie du client ne permet pas une authentification }, false @@ -380,7 +380,7 @@ euphorik.Client.prototype.flush = function(async) { thisClient.majBulle(); }, function(data) { - thisClient.util.messageDialogue(data.error_message); + thisClient.util.messageDialog(data.error_message); ok = false; }, async diff --git a/js/euphorik.js b/js/euphorik.js index 4706eb8..107a5c0 100755 --- a/js/euphorik.js +++ b/js/euphorik.js @@ -17,18 +17,18 @@ // along with Euphorik. If not, see . /*jslint laxbreak:true */ - -// tout euphorik est contenu dans cet objet + +// all euphorik is contained in this object var euphorik = {}; // le main $(document).ready( function() { var fragment = new Fragment(); - var formateur = new euphorik.Formater(); + var formater = new euphorik.Formater(); var util = new euphorik.Util(formater); var communication = new euphorik.Communication( - function(data) { util.messageDialogue(data.error_message); }, + function(data) { util.messageDialog(data.error_message); }, function() { util.showWaitBar(); }, function() { util.hideWaitBar(); } ); @@ -40,37 +40,39 @@ $(document).ready( $("#menuCss").change(function() { client.setCss("styles/" + $("option:selected", this).attr("value") + "/euphorik.css"); }); - // FIXME : ne fonctionne pas sous opera + // FIXME : doesn't work under Opera // voir : http://dev.jquery.com/ticket/2892#preview $(window).unload(function() { client.flush(); }); - $("#menu .minichat").click(function() { pages.afficherPage("minichat"); }); - $("#menu .admin").click(function() { pages.afficherPage("admin"); }); - $("#menu .profile").click(function() { pages.afficherPage("profile"); }); + $("#menu .minichat").click(function() { pages.displayPage("minichat"); }); + $("#menu .admin").click(function() { pages.displayPage("admin"); }); + $("#menu .profile").click(function() { pages.displayPage("profile"); }); $("#menu .logout").click(function() { - util.messageDialogue("Êtes-vous sur de vouloir vous délogger ?", euphorik.Util.messageType.question, + util.messageDialog("Are you sure you want to log out?", euphorik.Util.messageType.question, { - "Oui" : function() { + "Yes" : function() { client.deconnexion(); - pages.afficherPage("minichat", true); + pages.displayPage("minichat", true); }, - "Non" : function() {} + "No" : function() {} } ); }); - $("#menu .register").click(function(){ pages.afficherPage("register"); }); - $("#menu .about").click(function(){ pages.afficherPage("about"); }); + $("#menu .register").click(function(){ pages.displayPage("register"); }); + $("#menu .about").click(function(){ pages.displayPage("about"); }); - // TODO : simplifier et pouvoir créer des liens par exemple : Conditions d'utilisation - $("#footer .conditions").click(function(){ pages.afficherPage("conditions_utilisation"); }); + // TODO : simplification : such link[1] should be created and automatically open the right page without + // explicitly add a page. + // [1] : Conditions d'utilisation + $("#footer .conditions").click(function(){ pages.displayPage("conditions_utilisation"); }); - pages.ajouterPage(new euphorik.PageMinichat(client, formater, util, communication), true); - pages.ajouterPage(new euphorik.PageAdmin(client, formater, util, communication)); - pages.ajouterPage(new euphorik.PageProfile(client, formater, util)); - pages.ajouterPage(new euphorik.PageRegister(client, formater, util)); - pages.ajouterPage(new euphorik.PageAbout(client, formater, util, communication)); - pages.ajouterPage("conditions_utilisation"); + pages.addPage(new euphorik.PageMinichat(client, formater, util, communication), true); + pages.addPage(new euphorik.PageAdmin(client, formater, util, communication)); + pages.addPage(new euphorik.PageProfile(client, formater, util)); + pages.addPage(new euphorik.PageRegister(client, formater, util)); + pages.addPage(new euphorik.PageAbout(client, formater, util, communication)); + pages.addPage("conditions_utilisation"); - pages.afficherPage(); + pages.displayPage(); // display the default page } ); diff --git a/js/pageAbout.js b/js/pageAbout.js index 7fde6f7..7da55a2 100644 --- a/js/pageAbout.js +++ b/js/pageAbout.js @@ -20,7 +20,7 @@ euphorik.PageAbout = function(client, formater, util, communication) { this.nom = "about"; this.client = client; - this.formateur = formater; + this.formater = formater; this.util = util; this.communication = communication; }; diff --git a/js/pageAdmin.js b/js/pageAdmin.js index 9ce1620..87c2ee9 100644 --- a/js/pageAdmin.js +++ b/js/pageAdmin.js @@ -25,7 +25,7 @@ euphorik.PageAdmin = function(client, formater, util, communication) { this.nom = "admin"; this.client = client; - this.formater = formateur; + this.formater = formater; this.util = util; this.communication = communication; @@ -99,7 +99,7 @@ euphorik.PageAdmin.prototype.posterTroll = function() { content = content.trim(); if (content === "") { - this.util.messageDialogue("Le troll est vide"); + this.util.messageDialog("Le troll est vide"); return; } @@ -150,7 +150,7 @@ euphorik.PageAdmin.prototype.majIPs = function() { var ip = $(".ip", this).html(); $(".deban", this).click( function() { - thisPageAdmin.util.messageDialogue("Êtes-vous sur de vouloir débannir l'IP ''" + ip + "'' ?", euphorik.Util.messageType.question, + thisPageAdmin.util.messageDialog("Êtes-vous sur de vouloir débannir l'IP ''" + ip + "'' ?", euphorik.Util.messageType.question, {"Oui" : function() { thisPageAdmin.deban(ip); }, @@ -195,7 +195,7 @@ euphorik.PageAdmin.prototype.waitEvent = function() { "banned_ips_refresh" : function(data){ thisPageAdmin.majIPs(); }, "error" : function(data) { - thisTrolls.util.messageDialogue(data.error_message); + thisTrolls.util.messageDialog(data.error_message); } } ); @@ -257,7 +257,7 @@ euphorik.Trolls.prototype.ajouterTrollEvent = function(data) { $(".delTroll", this).click( function() { - thisTrolls.util.messageDialogue( + thisTrolls.util.messageDialog( "Êtes-vous sur de vouloir supprimer le troll \"" + thisTrolls.trolls[id].content + "\" ?", euphorik.Util.messageType.question, { diff --git a/js/pageMinichat/commandes.js b/js/pageMinichat/commandes.js index a8ee986..dbcc76a 100644 --- a/js/pageMinichat/commandes.js +++ b/js/pageMinichat/commandes.js @@ -102,7 +102,7 @@ euphorik.Commandes.prototype.exec = function(chaine) { } // commandes spéciales pour afficher l'aide : "?", "h", "help", "aide" if (nomCommande === "?" || nomCommande === "h" || nomCommande === "help" || nomCommande === "aide") { - this.util.messageDialogue( + this.util.messageDialog( this.texteAide, euphorik.Util.messageType.informatif, {"fermer" : function(){}}, diff --git a/js/pageMinichat/conversations.js b/js/pageMinichat/conversations.js index a63dcb9..03a93a9 100644 --- a/js/pageMinichat/conversations.js +++ b/js/pageMinichat/conversations.js @@ -112,7 +112,7 @@ euphorik.Conversations.prototype.ajouterMessageRepond = function(mess) { } if (mess2 && mess2.racineId !== mess.racineId) { - this.util.messageDialogue("Impossible de répondre à deux messages ne faisant pas partie de la même conversation"); + this.util.messageDialog("Impossible de répondre à deux messages ne faisant pas partie de la même conversation"); return; } @@ -346,7 +346,7 @@ euphorik.Conversations.prototype.ouvrirConversation = function(racine) { if (this.client.ajouterConversation(racine)) { this.rafraichirMessages(true); } else { - this.util.messageDialogue("Cette conversation est déjà ouverte"); + this.util.messageDialog("Cette conversation est déjà ouverte"); } }; @@ -398,7 +398,7 @@ euphorik.Conversations.prototype.rafraichirMessages = function(vider) { // ajoute les messages reçus à leur conversation respective data.conversations.each(function(numConv, conv) { if (!thisConversations.ajouterMessages(conv, numConv)) { - thisConversations.util.messageDialogue("La conversation {" + thisConversations.client.conversations[numConv - 1].root.toString(36) + "} n'existe pas"); + thisConversations.util.messageDialog("La conversation {" + thisConversations.client.conversations[numConv - 1].root.toString(36) + "} n'existe pas"); thisConversations.client.supprimerConversation(numConv - 1); } }); diff --git a/js/pageMinichat/pageMinichat.js b/js/pageMinichat/pageMinichat.js index c1276c7..fd7e3bc 100755 --- a/js/pageMinichat/pageMinichat.js +++ b/js/pageMinichat/pageMinichat.js @@ -163,7 +163,7 @@ euphorik.PageMinichat.prototype.charger = function() { thisPage.envoyerMessage(message); break; case euphorik.Commandes.statut.erreur_commande : - thisPage.util.messageDialogue(retCommandes[1], euphorik.Util.messageType.erreur); + thisPage.util.messageDialog(retCommandes[1], euphorik.Util.messageType.erreur); break; case euphorik.Commandes.statut.ok : $("form#posterMessage input.message").val(""); @@ -232,13 +232,13 @@ euphorik.PageMinichat.prototype.envoyerMessage = function(message) { pseudo = this.formater.filtrerInputPseudo(pseudo); if (pseudo === euphorik.conf.pseudoDefaut) { - this.util.messageDialogue("Le pseudo ne peut pas être " + euphorik.conf.pseudoDefaut); + this.util.messageDialog("Le pseudo ne peut pas être " + euphorik.conf.pseudoDefaut); return; } message = message.trim(); if (!message) { - this.util.messageDialogue("Le message est vide"); + this.util.messageDialog("Le message est vide"); return; } @@ -246,14 +246,14 @@ euphorik.PageMinichat.prototype.envoyerMessage = function(message) { if (!this.client.authentifie()) { if (!this.client.enregistrement()) { - this.util.messageDialogue("login impossible"); + this.util.messageDialog("login impossible"); return; } } // évite le double post if (this.envoieMessageEnCours) { - this.util.messageDialogue("Message en cours d'envoie..."); + this.util.messageDialog("Message en cours d'envoie..."); return; } this.envoieMessageEnCours = true; @@ -267,7 +267,7 @@ euphorik.PageMinichat.prototype.envoyerMessage = function(message) { thisPageMinichat.envoieMessageEnCours = false; }, function(data) { - thisPageMinichat.util.messageDialogue(data.error_message); + thisPageMinichat.util.messageDialog(data.error_message); thisPageMinichat.envoieMessageEnCours = false; }, true, diff --git a/js/pageProfile.js b/js/pageProfile.js index 7f3a64b..41e9fd5 100755 --- a/js/pageProfile.js +++ b/js/pageProfile.js @@ -20,7 +20,7 @@ euphorik.PageProfile = function(client, formater, util) { this.nom = "profile"; this.client = client; - this.formateur = formater; + this.formater = formater; this.util = util; }; @@ -78,17 +78,17 @@ euphorik.PageProfile.prototype.chargerProfile = function() { var passwordRe = $("form#profile input.passwordRe").val(); if (password !== "" || passwordRe !== "") { if (password !== passwordRe) { - thisPage.util.messageDialogue("Les mots de passes ne correspondent pas"); + thisPage.util.messageDialog("Les mots de passes ne correspondent pas"); return; } thisPage.client.password = thisPage.util.md5(password); } if(!thisPage.client.flush()) { - thisPage.util.messageDialogue("Impossible de mettre à jour votre profile, causes inconnues", euphorik.Util.messageType.erreur); + thisPage.util.messageDialog("Impossible de mettre à jour votre profile, causes inconnues", euphorik.Util.messageType.erreur); } else { - thisPage.util.messageDialogue("Votre profile a été mis à jour"); - thisPage.pages.afficherPage("minichat"); + thisPage.util.messageDialog("Votre profile a été mis à jour"); + thisPage.pages.displayPage("minichat"); } } ); @@ -101,7 +101,7 @@ euphorik.PageProfile.prototype.chargerLogin = function() { function() { if(thisPage.client.connexionLogin($("form#profile input.login").val(), thisPage.util.md5($("form#profile input.password").val()))) { // TODO afficher un message "ok" - thisPage.pages.afficherPage("minichat"); + thisPage.pages.displayPage("minichat"); } } ); diff --git a/js/pageRegister.js b/js/pageRegister.js index 0179573..0d17f34 100755 --- a/js/pageRegister.js +++ b/js/pageRegister.js @@ -64,14 +64,14 @@ euphorik.PageRegister.prototype.charger = function() { var passwordRe = $("#page form#register input.passwordRe").val(); if (login === "") { - thisPage.util.messageDialogue("Le login ne doit pas être vide"); + thisPage.util.messageDialog("Le login ne doit pas être vide"); } else if (password === "" && passwordRe === "") { - thisPage.util.messageDialogue("Un mot de passe est obligatoire"); + thisPage.util.messageDialog("Un mot de passe est obligatoire"); } else if (password !== passwordRe) { - thisPage.util.messageDialogue("Les mots de passes ne correspondent pas"); + thisPage.util.messageDialog("Les mots de passes ne correspondent pas"); } else if (thisPage.client.enregistrement(login, thisPage.util.md5(password))) { - thisPage.util.messageDialogue("Enregistrement réussi"); - thisPage.pages.afficherPage("minichat"); + thisPage.util.messageDialog("Enregistrement réussi"); + thisPage.pages.displayPage("minichat"); } } ); diff --git a/js/pages.js b/js/pages.js index 2f0abfc..ea13def 100644 --- a/js/pages.js +++ b/js/pages.js @@ -20,7 +20,7 @@ /** - * Gestion des pages. + * Pages manager. */ euphorik.Pages = function(fragment, communication) { this.fragment = fragment; @@ -31,11 +31,14 @@ euphorik.Pages = function(fragment, communication) { }; /** - * Accepte soit un objet soit un string. - * un string correspond au nom de la page, par exemple : "page" -> "page.html" - * @defaut si vrai alors la page est la page par défaut + * Add a new page, must be done one time per page after the website is loaded. + * Accept a string or a Page object. + * If a string is given then a static object page is automatically created. + * A string is the name of the page without the 'html' extension, for example + * "page" -> "page.html" + * @defaultPage If true then the page will be flaged as 'default'. It must be only one default page. */ -euphorik.Pages.prototype.ajouterPage = function(page, defaut) { +euphorik.Pages.prototype.addPage = function(page, defaultPage) { if (typeof page === "string") { page = new euphorik.PageStatique(page, this.communication); } @@ -45,25 +48,31 @@ euphorik.Pages.prototype.ajouterPage = function(page, defaut) { this.pages[page.nom] = page; - if (defaut) { + if (defaultPage) { this.pageDefaut = page; } }; -euphorik.Pages.prototype.afficherPage = function(nomPage, forcerChargement) { - forcerChargement = forcerChargement || false; +/** + * Display a given page. + * If no page name given the the default page will be loaded. + * @pageName [optional] The page name to load. + * @forceToLoad [optional] If true then the page will be reloaded even it already displayed. + */ +euphorik.Pages.prototype.displayPage = function(pageName, forceToLoad) { + forceToLoad = forceToLoad || false; // si le nom de la page n'est pas donné on le prend du fragment - if (!nomPage) { - nomPage = this.fragment.getVal("page"); + if (!pageName) { + pageName = this.fragment.getVal("page"); } - var page = this.pages[nomPage]; + var page = this.pages[pageName]; if (!page) { page = this.pageDefaut; } - if (!page || (!forcerChargement && page === this.pageCourante)) { + if (!page || (!forceToLoad && page === this.pageCourante)) { return; } @@ -79,7 +88,8 @@ euphorik.Pages.prototype.afficherPage = function(nomPage, forcerChargement) { $("#page").html(contenu).removeClass().addClass( this.pageCourante.nom + - (this.pageCourante.classes ? " " + this.pageCourante.classes() : "") // l'objet peut fournire des classes css supplémentaires sous la forme d'un string + // A page can bring some additionnals CSS classes + (this.pageCourante.classes ? " " + this.pageCourante.classes() : "") ); if (this.pageCourante.charger) { diff --git a/js/util.js b/js/util.js index 80d1b54..4a86faf 100644 --- a/js/util.js +++ b/js/util.js @@ -23,7 +23,7 @@ * - afficher une boite de message * - afficher une bulle d'aide lié à un élément * - manipuler le curseur et réaliser des sélections sur des zones de saisie () - * @formateur permet de formater les messages affichés à l'aide de messageDialogue (facultatif), voir "formater.js". + * @formater permet de formater les messages affichés à l'aide de messageDialog (facultatif), voir "formater.js". */ euphorik.Util = function (formater) { $("#info .fermer").click(function() { @@ -32,7 +32,7 @@ euphorik.Util = function (formater) { $("body").append('
').append('

'); - this.formateur = formater; + this.formater = formater; this.bulleActive = true; }; @@ -48,20 +48,20 @@ euphorik.Util.messageType = {informatif: 0, question: 1, erreur: 2}; * @param formate faut-il formaté le message ? true par défaut * @param temps le temps d'affichage du message en seconde, -1 pour une durée infinie */ -euphorik.Util.prototype.messageDialogue = function(message, type, boutons, formate, temps) { +euphorik.Util.prototype.messageDialog = function(message, type, boutons, formate, temps) { var thisUtil = this; type = type || euphorik.Util.messageType.informatif; formate = formate === undefined ? true : formate; - if (this.timeoutMessageDialogue) { - clearTimeout(this.timeoutMessageDialogue); + if (this.timeoutMessageDialog) { + clearTimeout(this.timeoutMessageDialog); } var fermer = function() { $("#info").slideUp(100); }; fermer(); - $("#info .message").html(!thisUtil.formater || !formate ? message : thisUtil.formateur.traitementComplet(message)); + $("#info .message").html(!thisUtil.formater || !formate ? message : thisUtil.formater.traitementComplet(message)); switch(type) { case euphorik.Util.messageType.informatif : $("#info #icone").attr("class", "information"); break; @@ -76,7 +76,7 @@ euphorik.Util.prototype.messageDialogue = function(message, type, boutons, forma $("#info").slideDown(200); if (temps !== -1) { - this.timeoutMessageDialogue = setTimeout(fermer, temps || euphorik.conf.tempsAffichageMessageDialogue); + this.timeoutMessageDialog = setTimeout(fermer, temps || euphorik.conf.tempsAffichageMessageDialogue); } };