www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 89b9f2a355cf1eea5a3e2c2569d940278bd63bb2
parent ec1a7158a8f9f9f9cca29975028981d6577f7896
Author: Yoann <yoann.b87@voila.fr>
Date:   Thu, 14 Apr 2011 11:15:04 +0200

Corrections de bugs sur la page de créationde partie.

Diffstat:
Mcode/serveur/php/ressources/createGame.js | 21++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/code/serveur/php/ressources/createGame.js b/code/serveur/php/ressources/createGame.js @@ -32,7 +32,7 @@ $(function() { (function (i) { $("#word-"+i).focusout(checkWord); - wordsOK[i] = false; + wordsOK["word-"+i] = false; })(i); } @@ -88,7 +88,7 @@ $(function() { data: "action=4&word="+word+"&user="+user+"&passwd="+passwd, success: function(msg){ input.parent(".wordLine, #center").addClass((msg == false) ? "invalid" : "valid"); - wordsOK[input.val()] = !(msg == false); + wordsOK[input.attr("id")] = !(msg == false); }}); } }; @@ -106,13 +106,15 @@ $(function() { displayError("Il existe des mots incorrects"); else if (nbWordOK() < nbWordMin) displayError("Le nuage doit contenir au moins "+nbWordMin+" mots valides."); + else if (!relationsOK()) + displayError("Tout les mots ne sont pas liés à une relation"); }; var nbWordOK = function() { var count = 0; for (word in wordsOK) - if (word == true) + if (wordsOK[word] == true) count++; return count; @@ -120,13 +122,22 @@ $(function() { var badWord = function() { for (word in wordsOK) - if (word == false) + if (wordsOK[word] == false) return true; return false; } - + var relationsOK = function() { + for(i = 0; i < numWord; i++) + if(wordsOK["word-"+i]) { + console.log("mot ok"); + if(!$("r1-"+i).is(":checked") && !$("r2-"+i).is(":checked") && !$("r3-"+i).is(":checked") && !$("r4-"+i).is(":checked")) + return false; + } + + return true; + } var displayError = function(message) {