commit 78c81014a3f6c896f4a1c43ccb5e49b74e09d7eb
parent 02d04c3421d160a55a451d0fd788de805d30366f
Author: Georges Dupéron <jahvascriptmaniac+github@free.fr>
Date: Sun, 17 Apr 2011 20:26:12 +0200
Merge branch 'unstable' of github:jsmaniac/2011-m1s2-ter into unstable
Diffstat:
5 files changed, 175 insertions(+), 487 deletions(-)
diff --git a/code/serveur/php/createGame.php b/code/serveur/php/createGame.php
@@ -1,271 +1,158 @@
<?php
require_once("ressources/strings.inc");
require_once("relations.php");
-require_once("pticlic.php");
+require_once("server.php");
session_start();
-$state = 0;
-$err = false;
-$msg = "";
-$rels = array();
-
-function getWords($nbwords)
-{
- global $msg;
- global $err;
- $words = array();
-
- for($i = 0; $i < $nbwords; $i++)
- if(!isset($_POST['word'.$i]) || empty($_POST['word'.$i])) {
- $err = true;
- $msg = $strings['err_creategame_fill_all'];
- return -1;
- }
- else
- $words[$i] = $_POST['word'.$i];
-
- return $words;
-}
-
-function getWordsAndResponses($nbwords)
-{
- global $err;
- global $msg;
- $words = array();
- $respwords = array();
+if(!isset($_SESSION['userId']))
+ header("location:login.php?return=createGame&showmsg=oth_login_createGame_nauth");
- $words = getWords($nbwords);
-
- if($words == -1)
- return -1;
+?>
- foreach($words as $key=>$w) {
- if(isset($_POST['rd'.$key])) {
- $respwords[$key] = array();
- $respwords[$key][0] = $words[$key];
- $respwords[$key][1] = $_POST['rd'.$key];
- }
- else
- return -1;
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
+ <head>
+ <title>PtiClic Android - Création de partie</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <link rel="stylesheet" href="ressources/simple.css" />
+ <script type="text/javascript" src="ressources/jquery-1.5.1.min.js" /></script>
+ <script type="text/javascript" src="ressources/createGame.js" /></script>
+<style type="text/css">
+ #wordLines input{
+ border : 2px solid grey;
}
-
- return $respwords;
-}
-
-function checked($name, $value) {
- if(isset($_POST[$name]) && $_POST[$name] == $value)
- return 'checked';
-}
-
-function probaOf($relation, $relation2) {
- if (($relation == "r1" && $relation2 == 0)
- || ($relation == "r2" && $relation2 == 1)
- || ($relation == "r0" && $relation2 == 2)
- || ($relation == "trash" && $relation2 == 3))
- return 1;
-
- return 0;
-}
-
-if(isset($_POST['nbcloudwords'])) {
- $nbwords = $_POST['nbcloudwords'];
-
- if(!is_numeric($nbwords) || $nbwords <= 0) {
- $err = true;
- $msg = $strings['err_creategame_nbwords_value'];
+ .status {
+ visibility: hidden;
+ }
+ .valid .status, #center.valid .status {
+ color: green;
+ visibility: visible;
}
- else {
- $state = 1;
- $relations = get_game_relations();
+ .invalid .status, #center.invalid .status, #center .status {
+ color: red;
+ visibility: visible;
}
- if($state == 1 && isset($_POST['centralword']) && !empty($_POST['centralword'])) {
- if($_POST['relation1'] != $_POST['relation2']) {
- $centralword = $_POST['centralword'];
- $rels[0] = $stringRelations[$_POST['relation1']];
- $rels[1] = $stringRelations[$_POST['relation2']];
- $rels[2] = $stringRelations[0];
- $rels[3] = $stringRelations[-1];
-
- $words = getWords($nbwords);
-
- if($err != true)
- $state = 2;
- else {
- $err = true;
- $msg = $strings['err_creategame_cloud_fill_all'];
- }
-
- }
- else {
- $err = true;
- $msg = $strings['err_creategame_eq_relations'];
- }
+ .wordLinesTable {
+ min-height : 20px;
+ min-width : 20px;
+ border-collapse : collapse;
+ border-spacing : 0px;
+ margin-left : 30px;
}
- elseif (isset($_POST['centralword']) && empty($_POST['centralword'])) {
- $err = true;
- $msg = $strings['err_creategame_cloud_fill_all'];
+
+ .wordLinesTable td {
+ padding : 6px;
+ padding-left : 10px;
}
- if($state == 2) {
- $respwords = getWordsAndResponses($nbwords);
- $r1 = $_POST['relation1'];
- $r2 = $_POST['relation2'];
- $cloud = array();
- $totalDifficulty = 0;
- $addedWords = 0;
-
- if($respwords != -1 && isset($_POST['tDifficulty'])) {
- if(is_numeric($totalDifficulty = $_POST['tDifficulty'])) {
-
- if(insertNode($centralword))
- $addedWords++;
-
- $centralword = getNodeEid($centralword);
-
- foreach($respwords as $key=>$rw) {
- $difficulty = $totalDifficulty / count($respwords);
-
- if(insertNode($respwords[$key][0]))
- $addedWords++;
-
- $cloud[$key] = array('pos'=>$key, 'd'=> $difficulty, 'eid'=>getNodeEid($respwords[$key][0]),
- 'probaR1'=> probaOf("r1", $rw[1]),
- 'probaR2'=> probaOf('r2', $rw[1]),
- 'probaR0'=> probaOf('r0', $rw[1]),
- 'probaTrash'=> probaOf('trash', $rw[1]));
- }
- }
- else {
- $err = true;
- $msg = $strings['err_creategame_isNumeric_tDifficulty'];
- }
+ .wordLinesTable .lightLine {
+ background-color : #F0F0D0;
+ }
- $state = 3;
- $msg = $strings['ok_creategame_game_create'];
- }
- cgInsert($centralword, $cloud, $r1, $r2, $totalDifficulty);
+ #center {
+ margin-left : 100px;
+ margin-top : 20px;
+ margin-bottom : 30px;
}
- elseif($state == 2) {
- $err = true;
- $msg = $strings['err_creategame_fill_all'];
+
+ #center label {
+ border-bottom : 1px solid grey;
+ border-left : 1px solid grey;
+ -moz-border-radius : 100%;
+ padding-left : 10px;
}
-}
-else
- $err = true;
-
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
- <head>
- <title>PtiClic Android - Création de partie</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <link rel="stylesheet" href="ressources/simple.css" />
+
+ #relations {
+ margin-bottom : 20px;
+ margin-top : 10px;
+ }
+
+ #relations label {
+ margin-left : 40px;
+ border-bottom : 1px solid grey;
+ border-left : 1px solid grey;
+ -moz-border-radius : 100%;
+ padding-left : 10px;
+ padding-right : 10px;
+ }
+
+ #button {
+ margin-top : 30px;
+ margin-left : 50px;
+ margin-bottom : 40px;
+ }
+
+ #button input {
+ margin-left : 10px;
+ margin-right : 40px;
+ padding : 4px;
+ padding-left : 8px;
+ padding-right : 8px;
+ font-weight : bold;
+ }
+
+</style>
</head>
<body>
<?php include("ressources/menu.inc"); ?>
<div class="content creategame">
<h2>Création de parties</h2>
- <?php
- if(isset($_POST['nbcloudwords']) && $_POST['nbcloudwords'] > 0)
- echo '<p>Remplissez le mot central ainsi que les différents mots du nuage pour réaliser un partie personalisée.<br />
- Une fois satisfait de votre partie cliquez sur "Enregistrer la partie"';
- else
- echo '<p>Cette page vous permet de créer des parties personalisées en indiquant les mots qui seront affiché pour un mot central.<br /><br />
- Veuillez entrer le nombre de mots composant le nuage dans le formulaire ci-dessous avant de continuer.</p><br />';
- ?>
- <form action="createGame.php" method="POST">
- <?php
- if($err == true && $msg != "")
- echo '<span class="message warning">'.$msg.'</span>';
- else if ($msg != "")
- echo '<span class="message success">'.$msg.'</span>';
-
- if($state == 0) {
- echo '<table>';
- echo '<tr><td><label for="nbcloudwords"> Nombre de mots du nuage : </label></td>';
- echo '<td><input type="text" name="nbcloudwords" /></td></tr>';
- echo '<tr><td></td><td><input type="submit" value="suivant" /></td></tr>';
- }
- elseif($state == 1) {
- echo '<table class="wordsform">';
- echo '<tr><td><label for="relation1">Relation 1 : </label></td>';
- echo '<td class="inputcell"><select name="relation1">';
- foreach($relations as $key=>$r)
- echo '<option value="'.$r.'">'.$stringRelations[$r].'</option>';
- echo '</select></td>';
- echo '<td><label for="relation2">Relation 2 : </label></td>';
- echo '<td class="inputcell"><select name="relation2">';
- foreach($relations as $key=>$r)
- echo '<option value="'.$r.'">'.$stringRelations[$r].'</option>';
- echo '</select></td>';
- echo '<input type="hidden" name="nbcloudwords" value="'.$nbwords.'" />';
- echo '<tr><td colspan="2"><br /><label for="centralword">Mot central : </label><br /><br /></td>';
- echo '<td colspan="2" class="inputcell"><br /><input type="text" name="centralword" value="';
- if(isset($_POST['centralword'])) echo $_POST['centralword'];
- echo '"/><br /><br /></td>';
-
- for($i = 0; $i < $nbwords; $i++) {
- if($i % 2 == 0)
- echo '</tr><tr>';
-
- echo '<td><label for="word'.$i.'">Mot '.($i+1).' : </label></td>';
- echo '<td class="inputcell"><input type="text" name="word'.$i.'" value="';
- if(isset($_POST['word'.$i])) echo $_POST['word'.$i];
- echo '" /></td>';
- }
+ <p>Cette page vous permet de créer des parties personalisées en indiquant les mots qui seront affiché pour un mot central.<br /><br />
+ <div id="errorDiv" class="message warning" style="display:none;"></div>
+
+ <div id="center">
+ <label for="centralWord"> Le mot central : </label>
+ <input type="text" id="centralWord" name="centralWord" />
+ <span class="status">●</span>
+ </div>
+ <div id="relations">
+ <label for="relation1">Relation 1</label>
+ <select name="relation1" id="relation1">
+ </select>
+ <label for="relation2">Relation 2</label>
+ <select name="relation2" id="relation2">
+ </select>
+ </div>
+ <div id="wordLines">
+ <div id="templates" style="display:none">
+ <table>
+ <thead> </thead>
+ <tbody>
+ <tr class="wordLine">
+ <td>
+ <label for="word-"></label>
+ </td>
+ <td>
+ <input type="text" id="word-"/>
+ <span class="status">●</span>
+ </td>
+ <td>
+ <input type="checkbox" id="r1-"/><label class="r1" for="r1-">Blabla</label>
+ </td>
+ <td>
+ <input type="checkbox" id="r2-"/><label class="r2" for="r2-">Blabla</label>
+ </td>
+ <td>
+ <input type="checkbox" id="r3-"/><label class="r3" for="r3-">Blabla</label>
+ </td>
+ <td>
+ <input type="checkbox" id="r4-"/><label class="r4" for="r4-">Blabla</label>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
- if($nbwords % 2 != 0)
- echo '<td></td>';
-
- echo '</tr><tr><td colspan="2"></td><td colspan="2" class="td2"><input type="submit" value="Enregistrer la partie" /></td></tr>';
- }
- elseif($state == 2) {
- echo 'Mot central : ';
- echo $centralword;
- echo '<input type="hidden" name="centralword" value="'.$centralword.'" />';
- echo '<input type="hidden" name="nbcloudwords" value="'.$nbwords.'" />';
- echo '<input type="hidden" name="relation1" value="'.$_POST['relation1'].'" />';
- echo '<input type="hidden" name="relation2" value="'.$_POST['relation2'].'" />';
- echo '<table class="wordsform">';
- echo '<tr>';
-
- foreach($words as $key=>$w) {
- echo '<td>'.$w.'</td><td class="inputcell">';
- echo '<input type="hidden" name="word'.$key.'" value="'.$w.'" />';
- echo '<input type="radio" name="rd'.$key.'" id="'.$key.'_r1" value="0" '.checked("rd".$key,0).'>';
- echo '<label for="'.$key.'_r1">'.$rels[0].'</label><br />';
- echo '<input type="radio" name="rd'.$key.'" id="'.$key.'_r2" value="1" '.checked("rd".$key,1).'>';
- echo '<label for="'.$key.'_r2">'.$rels[1].'</label><br />';
- echo '<input type="radio" name="rd'.$key.'" id="'.$key.'_r3" value="2" '.checked("rd".$key,2).'>';
- echo '<label for="'.$key.'_r3">'.$rels[2].'</label><br />';
- echo '<input type="radio" name="rd'.$key.'" id="'.$key.'_r4" value="3" '.checked("rd".$key,3).'>';
- echo '<label for="'.$key.'_r4">'.$rels[3].'</label></td>';
-
- if($key%2 != 0)
- echo '</tr><tr>';
- }
-
- if(count($words)%2 != 0)
- echo '<td colspan="2"></td>';
-
- echo '</tr>';
- echo '<tr><td colspan="2"><label for="tDifficulty">Difficulté de la partie</label></td>';
- echo '<td class="inputcell" colspan="2"><select name="tDifficulty">';
- for($i = 1; $i < 11; $i++)
- echo '<option value="'.$i.'">'.$i.'</option>';
- echo '</select></td></tr>';
-
- echo '<tr><td colspan="4"><input type="submit" value="Enregistrer" /></td></tr>';
- }
- elseif($state == 3) {
- echo '<p>nombre de mots ajoutés dans la base de données : '.$addedWords;
- }
- ?>
+ <table class="wordLinesTable">
+ <tr><td></td></tr>
</table>
- </form>
+ </div>
+ <div id="button"></div>
+ </div>
+ <div id="templates" style="display:none">
</div>
<?php include("ressources/footer.inc"); ?>
</body>
diff --git a/code/serveur/php/createGamejs.php b/code/serveur/php/createGamejs.php
@@ -1,224 +0,0 @@
-<?php
-require_once("ressources/strings.inc");
-require_once("relations.php");
-require_once("server.php");
-session_start();
-
-$state = 0;
-$err = false;
-$msg = "";
-$rels = array();
-
-function getWords($nbwords)
-{
- global $msg;
- global $err;
- $words = array();
-
- for($i = 0; $i < $nbwords; $i++)
- if(!isset($_POST['word'.$i]) || empty($_POST['word'.$i])) {
- $err = true;
- $msg = $strings['err_creategame_fill_all'];
- return -1;
- }
- else
- $words[$i] = $_POST['word'.$i];
-
- return $words;
-}
-
-function getWordsAndResponses($nbwords)
-{
- global $err;
- global $msg;
- $words = array();
- $respwords = array();
-
- $words = getWords($nbwords);
-
- if($words == -1)
- return -1;
-
- foreach($words as $key=>$w) {
- if(isset($_POST['rd'.$key])) {
- $respwords[$key] = array();
- $respwords[$key][0] = $words[$key];
- $respwords[$key][1] = $_POST['rd'.$key];
- }
- else
- return -1;
- }
-
- return $respwords;
-}
-
-function checked($name, $value) {
- if(isset($_POST[$name]) && $_POST[$name] == $value)
- return 'checked';
-}
-
-function probaOf($relation, $relation2) {
- if (($relation == "r1" && $relation2 == 0)
- || ($relation == "r2" && $relation2 == 1)
- || ($relation == "r0" && $relation2 == 2)
- || ($relation == "trash" && $relation2 == 3))
- return 1;
-
- return 0;
-}
-
-if(isset($_POST['nbcloudwords'])) {
- $nbwords = $_POST['nbcloudwords'];
-
- if(!is_numeric($nbwords) || $nbwords <= 0) {
- $err = true;
- $msg = $strings['err_creategame_nbwords_value'];
- }
- else {
- $state = 1;
- $relations = get_game_relations();
- }
-
- if($state == 1 && isset($_POST['centralword']) && !empty($_POST['centralword'])) {
- if($_POST['relation1'] != $_POST['relation2']) {
- $centralword = $_POST['centralword'];
- $rels[0] = $stringRelations[$_POST['relation1']];
- $rels[1] = $stringRelations[$_POST['relation2']];
- $rels[2] = $stringRelations[0];
- $rels[3] = $stringRelations[-1];
-
- $words = getWords($nbwords);
-
- if($err != true)
- $state = 2;
- else {
- $err = true;
- $msg = $strings['err_creategame_cloud_fill_all'];
- }
-
- }
- else {
- $err = true;
- $msg = $strings['err_creategame_eq_relations'];
- }
- }
- elseif (isset($_POST['centralword']) && empty($_POST['centralword'])) {
- $err = true;
- $msg = $strings['err_creategame_cloud_fill_all'];
- }
-
- if($state == 2) {
- $respwords = getWordsAndResponses($nbwords);
- $r1 = $_POST['relation1'];
- $r2 = $_POST['relation2'];
- $cloud = array();
- $totalDifficulty = 0;
- $addedWords = 0;
-
- if($respwords != -1 && isset($_POST['tDifficulty'])) {
- if(is_numeric($totalDifficulty = $_POST['tDifficulty'])) {
-
- if(insertNode($centralword))
- $addedWords++;
-
- $centralword = getNodeEid($centralword);
-
- foreach($respwords as $key=>$rw) {
- $difficulty = $totalDifficulty / count($respwords);
-
- if(insertNode($respwords[$key][0]))
- $addedWords++;
-
- $cloud[$key] = array('pos'=>$key, 'd'=> $difficulty, 'eid'=>getNodeEid($respwords[$key][0]),
- 'probaR1'=> probaOf("r1", $rw[1]),
- 'probaR2'=> probaOf('r2', $rw[1]),
- 'probaR0'=> probaOf('r0', $rw[1]),
- 'probaTrash'=> probaOf('trash', $rw[1]));
- }
- }
- else {
- $err = true;
- $msg = $strings['err_creategame_isNumeric_tDifficulty'];
- }
-
- $state = 3;
- $msg = $strings['ok_creategame_game_create'];
- }
-
- cgInsert($centralword, $cloud, $r1, $r2, $totalDifficulty);
- }
- elseif($state == 2) {
- $err = true;
- $msg = $strings['err_creategame_fill_all'];
- }
-}
-else
- $err = true;
-
-?>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
- <head>
- <title>PtiClic Android - Création de partie</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <link rel="stylesheet" href="ressources/simple.css" />
- <script type="text/javascript" src="ressources/jquery-1.5.1.min.js" /></script>
- <script type="text/javascript" src="ressources/createGame.js" /></script>
-<style type="text/css">
- #wordLines input{
- border : 2px solid grey;
- }
- .wordLine .status {
- visibility: hidden;
- }
- .wordLine.valid .status, #center.valid .status {
- color: green;
- visibility: visible;
- }
- .wordLine.invalid .status, #center.invalid .status, #center .status {
- color: red;
- visibility: visible;
- }
-</style>
- </head>
- <body>
- <?php include("ressources/menu.inc"); ?>
- <div class="content creategame">
- <h2>Création de parties</h2>
- <p>Cette page vous permet de créer des parties personalisées en indiquant les mots qui seront affiché pour un mot central.<br /><br />
- <div id="errorDiv" class="message warning" style="display:none;"></div>
-
- <div id="center">
- <label for="centralWord"> Le mot central : </label>
- <input type="text" id="centralWord" name="centralWord" />
- <span class="status">●</span>
- </div>
- <div id="relations">
- <label for="relation1">Relation 1</label>
- <select name="relation1" id="relation1">
- </select>
- <label for="relation2">Relation 2</label>
- <select name="relation2" id="relation2">
- </select>
- </div>
- <div id="wordLines">
- <div id="templates" style="display:none">
- <div class="wordLine" class="wordLine">
- <label for="word-"></label>
- <input type="text" id="word-"/>
- <span class="status">●</span>
- <input type="checkbox" id="r1-"/><label class="r1" for="r1-">Blabla</label>
- <input type="checkbox" id="r2-"/><label class="r2" for="r2-">Blabla</label>
- <input type="checkbox" id="r3-"/><label class="r3" for="r3-">Blabla</label>
- <input type="checkbox" id="r4-"/><label class="r4" for="r4-">Blabla</label>
- </div>
- </div>
- </div>
- <div id="button"></div>
- </div>
- <div id="templates" style="display:none">
- </div>
- <?php include("ressources/footer.inc"); ?>
- </body>
-</html>
diff --git a/code/serveur/php/ressources/createGame.js b/code/serveur/php/ressources/createGame.js
@@ -15,7 +15,7 @@ $(function() {
var user = "foo";
var passwd = "bar";
var relations = data;
- var nbWordMin = 10;
+ var nbWordMin = 3;
var wordsOK = new Array();
var centerOK = false;
@@ -26,9 +26,10 @@ $(function() {
$("#templates .wordLine")
.clone()
.changeId(i)
+ .addClass(i%2==0 ? "lightLine" : "")
// .find("label").attr("for", "word"+i).text(i).end()
// .find("input").attr("id", "word"+i).end()
- .appendTo("#wordLines");
+ .appendTo(".wordLinesTable tbody");
(function (i) {
$("#word-"+i).focusout(checkWord);
@@ -79,7 +80,7 @@ $(function() {
var input = $(this);
var word = input.val();
- input.parent(".wordLine, #center").removeClass("valid invalid");
+ input.parent("td, #center").removeClass("valid invalid");
if (word != "") {
$.ajax({
@@ -87,7 +88,7 @@ $(function() {
url: "server.php?",
data: "action=4&word="+word+"&user="+user+"&passwd="+passwd,
success: function(msg){
- input.parent(".wordLine, #center").addClass((msg == false) ? "invalid" : "valid");
+ input.parent("td, #center").addClass((msg == false) ? "invalid" : "valid");
wordsOK[input.attr("id")] = !(msg == false);
}});
}
@@ -95,19 +96,21 @@ $(function() {
var formOK = function() {
displayError("");
-
- console.log(wordsOK);
- if ($("#relation1").val() == $("#relation2").val())
- displayError("Les deux relation doivent être différents");
- else if ($("#centralWord").val() == "")
- displayError("Le mot central doit être renseigné.");
- else if (badWord())
- 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");
+ if ($("#relation1").val() == $("#relation2").val())
+ displayError("Les deux relation doivent être différents");
+ else if ($("#centralWord").val() == "")
+ displayError("Le mot central doit être renseigné.");
+ else if (badWord())
+ 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");
+ else
+ sendGame();
+
+ return false;
};
var nbWordOK = function() {
@@ -121,24 +124,44 @@ $(function() {
};
var badWord = function() {
+ console.log(wordsOK);
for (word in wordsOK)
- if (wordsOK[word] == false)
+ if ($("#"+word).val() != "" && wordsOK[word] == false)
return true;
return false;
}
var relationsOK = function() {
- for(i = 0; i < numWord; i++)
+ console.log(wordsOK);
+ for(i = 1; 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"))
+ if(!$("#r1-"+i).is(":checked") && !$("#r2-"+i).is(":checked") && !$("#r3-"+i).is(":checked") && !$("#r4-"+i).is(":checked"))
return false;
}
+ }
return true;
}
+
+ var sendGame = function() {
+ var exit;
+ var cloud = "";
+
+ exit = {center:$("#centralWord").val(),
+ relations:[$("#relation1").val(),$("#relation2").val(),0,-1],
+ cloud:[]};
+
+ for(i=1;i<numWord;i++) {
+ if(i != 1)
+ cloud += ",";
+
+ exit.cloud.push({name:$("#word-"+i).val(),relations:[$("#r1-"+i).is(":checked"),$("#r2-"+i).is(":checked"),$("#r3-"+i).is(":checked"),$("#r4-"+i).is(":checked")]});
+ }
+
+ console.log(exit);
+ }
var displayError = function(message) {
if (message != "")
@@ -148,7 +171,7 @@ $(function() {
};
displayCentralWordAndRelations();
- displayNWordLines(10);
+ displayNWordLines(nbWordMin);
displayButtons();
});
});
diff --git a/code/serveur/php/ressources/locations.inc b/code/serveur/php/ressources/locations.inc
@@ -6,6 +6,7 @@ $location_list['contact'] = "contact.php";
$location_list['createGame'] = "createGame.php";
$location_list['login'] = "login.php";
$location_list['signup'] = "signup.php";
+$location_list['createGame'] = 'createGame.php';
function return_to($location, $params = "") {
global $location_list;
diff --git a/code/serveur/php/ressources/strings.inc b/code/serveur/php/ressources/strings.inc
@@ -26,6 +26,7 @@ $strings['err_login_bad_user_pass'] = "Mauvais nom d'utilisateur ou mot de passe
$strings['err_login_fill_all'] = "Veuillez remplir tous les champs.";
$strings['err_login_dbopen'] = "Erreur lors de l'ouverture de la base de données SQLite3. Merci de nous signaler le problème.";
$strings['oth_login_download_nauth'] = "Afin d'accéder à la page de téléchargement et obtenir l'application vous devez être authentifié.";
+$strings['oth_login_createGame_nauth'] = "Afin de pouvoir créer des parties vous devez être authentifié.";
$strings['err_signup_dbopen'] = "Erreur lors de l'ouverture de la base de données SQLite3. Merci de nous signaler le problème.";
$strings['err_signup_fill_mail'] = "Veuillez renseigner le champ 'Saisissez votre adresse mail'.";