summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2007-07-29 10:39:34 -0700
committerArun Persaud <arun@nubati.net>2007-07-29 10:39:34 -0700
commitd7c42361bda4c64a0594a8640156a504fc334f11 (patch)
tree855c6fc4bb14be6d4fa984d0f17f039eeb092fac
parent9d32a1343ce662c3d0536b45098e4da524d8ac2f (diff)
downloade-DoKo-d7c42361bda4c64a0594a8640156a504fc334f11.tar.gz
e-DoKo-d7c42361bda4c64a0594a8640156a504fc334f11.tar.bz2
e-DoKo-d7c42361bda4c64a0594a8640156a504fc334f11.zip
LAYOUT: final score is displayed on the table; played card is displayed in trick
added another trick as trick13 that displays the final score. Also moved the played card to show up as a normal card and not in the middle of the table anymore.
-rw-r--r--css/standard.css78
-rw-r--r--index.php125
-rw-r--r--output.php6
3 files changed, 118 insertions, 91 deletions
diff --git a/css/standard.css b/css/standard.css
index c2cb6f7..9eb54e7 100644
--- a/css/standard.css
+++ b/css/standard.css
@@ -27,7 +27,7 @@
font-size: smaller;
}
-.joingame,.sickness,.poverty {
+.joingame,.sickness,.poverty,.total {
position: absolute;
width: 18em;
@@ -152,16 +152,16 @@ ul.tricks li div div.card0 {
margin:0;
padding:0;
/*border: 1px solid red;*/
- top: 9em;
- right:27em;
+ top: 7em;
+ right:22em;
}
ul.tricks li div div.card1 {
position:absolute;
margin:0;
padding:0;
/*border: 1px solid red;*/
- top: -3em;
- left:-3em;
+ top: 1em;
+ left:-7em;
width:28em;
text-align:center;
}
@@ -170,16 +170,16 @@ ul.tricks li div div.card2 {
margin:0;
padding:0;
/*border: 1px solid red;*/
- top: 9em;
- right:-2em;
+ top: 7em;
+ left: 15em;
}
ul.tricks li div div.card3 {
position:absolute;
margin:0;
padding:0;
/*border: 1px solid red;*/
- top: 20em;
- left:-3em;
+ top: 15em;
+ left:-7em;
width:28em;
text-align:center;
}
@@ -191,24 +191,6 @@ ul.tricks li div div img {
padding:0;
}
-ul.tricks li div div.card0 img {
- top: -2em;
- left:5em;
-}
-ul.tricks li div div.card1 img {
- top: 3em;
- left:10em;
-}
-ul.tricks li div div.card2 img {
- top: -2em;
- left:-6em;
-}
-ul.tricks li div div.card3 img {
- top: -6em;
- left:10em;
-}
-
-
ul.tricks li div div span.comment {
position:absolute;
background-color:white;
@@ -218,27 +200,53 @@ ul.tricks li div div span.comment {
border: 1px solid yellow;
z-index:-11;
}
+
+ul.tricks li div div span.score {
+ position:absolute;
+ width:5em;
+ background-color: #fff;
+}
+ul.tricks li div div.card0 span.score {
+ top: 1em;
+ left: 2em;
+}
+ul.tricks li div div.card1 span.score {
+ top: -1em;
+ left: 14em;
+}
+ul.tricks li div div.card2 span.score {
+ top: 1em;
+ left: -1em;
+}
+ul.tricks li div div.card3 span.score {
+ top: 2em;
+ left: 14em;
+}
+
ul.tricks li div div span.comment:hover {
z-index:11;
}
+ul.tricks li div div span.comment {
+ z-index:-11;
+}
ul.tricks li div div.card0 span.comment{
- top:4em;
- left:-10em;
+ top:6em;
+ left:-15em;
border: 3px solid green;
}
ul.tricks li div div.card1 span.comment{
- top:-2em;
- left:1em;
+ top:-5em;
+ left:-4em;
border: 3px solid green;
}
ul.tricks li div div.card2 span.comment{
- top:-2em;
- left:0em;
+ top:-8em;
+ left:6em;
border: 3px solid green;
}
ul.tricks li div div.card3 span.comment{
- top:2em;
- left:20em;
+ top:5em;
+ left:27em;
border: 3px solid green;
}
ul.tricks li div div span.comment span{
diff --git a/index.php b/index.php
index 4f69522..c8c8804 100644
--- a/index.php
+++ b/index.php
@@ -303,6 +303,33 @@ else if(myisset("me"))
echo "<input type=\"submit\" value=\"submit\" />\n";
+
+ if($mystatus=='gameover' && DB_get_game_status_by_gameid($gameid)=='gameover' )
+ {
+ echo "<hr />\n";
+
+ $session = DB_get_session_by_gameid($gameid);
+ $result = mysql_query("SELECT id,create_date FROM Game".
+ " WHERE session=$session".
+ " ORDER BY create_date DESC".
+ " LIMIT 1");
+ $r = -1;
+ if($result)
+ $r = mysql_fetch_array($result,MYSQL_NUM);
+
+ if(!$session || $gameid==$r[0])
+ {
+ /* suggest a new game with the same people in it, just rotated once (unless last game was solo) */
+ $names = DB_get_all_names_by_gameid($gameid);
+ $type = DB_get_gametype_by_gameid($gameid);
+
+ if($type=="solo")
+ output_ask_for_new_game($names[0],$names[1],$names[2],$names[3],$gameid);
+ else
+ output_ask_for_new_game($names[1],$names[2],$names[3],$names[0],$gameid);
+ }
+ }
+
echo "</div>\n";
/* output game */
@@ -1132,15 +1159,10 @@ else if(myisset("me"))
if($seq==4)
{
$trickNR++;
- echo " </div>\n </li>\n"; /* end div table, end li table */
+ echo " </div>\n </li>\n"; /* end div trick, end li trick */
}
}
-
- if($seq!=4 && $trickNR>1)
- echo " </div>\n </li>\n"; /* end div table, end li table */
-
- echo "</ul>\n";
-
+
/* whos turn is it? */
if($seq==4)
{
@@ -1282,13 +1304,20 @@ else if(myisset("me"))
};
/* display played card */
- echo "<div class=\"card\">";
- echo " you played <br />";
+ $pos = DB_get_pos_by_hash($me);
+ if($sequence==1)
+ {
+ echo " <li onclick=\"hl('".($tricknr)."');\" class=\"current\"><a href=\"#\">Trick ".($tricknr)."</a>\n".
+ " <div class=\"trick\" id=\"trick".($tricknr)."\">\n".
+ " <img class=\"arrow\" src=\"pics/arrow".($pos-1).".png\" alt=\"table\" />\n";
+ }
+
+ echo "<div class=\"card".($pos-1)."\">";
/* display comments */
display_card($card,$PREF["cardset"]);
if($comment!="")
- echo " <br /> Your comment:<br /><span class=\"comment\">".$comment."</span>\n";
- echo "</div>\n";
+ echo " <span class=\"comment\"> ".$comment."</span>\n";
+ echo "</div></div></li>\n";
/*check if we still have cards left, else set status to gameover */
if(sizeof(DB_get_hand($me))==0)
@@ -1381,6 +1410,36 @@ else if(myisset("me"))
{
echo "please wait until it's your turn! <br />\n";
}
+
+ if($seq!=4 && $trickNR>1)
+ echo " </div>\n </li>\n"; /* end div trick, end li trick */
+
+ /* display points in case game is over */
+ if($mystatus=='gameover' && DB_get_game_status_by_gameid($gameid)=='gameover' )
+ {
+ echo " <li onclick=\"hl('13');\" class=\"current\"><a href=\"#\">Score</a>\n".
+ " <div class=\"trick\" id=\"trick13\">\n";
+ /* add pic for re/contra
+ " <img class=\"arrow\" src=\"pics/arrow".($pos-1).".png\" alt=\"table\" />\n";*/
+
+ $result = mysql_query("SELECT User.fullname, IFNULL(SUM(Card.points),0), Hand.party,Hand.position FROM Hand".
+ " LEFT JOIN Trick ON Trick.winner=Hand.position AND Trick.game_id=Hand.game_id".
+ " LEFT JOIN User ON User.id=Hand.user_id".
+ " LEFT JOIN Play ON Trick.id=Play.trick_id".
+ " LEFT JOIN Hand_Card ON Hand_Card.id=Play.hand_card_id".
+ " LEFT JOIN Card ON Card.id=Hand_Card.card_id".
+ " WHERE Hand.game_id='$gameid'".
+ " GROUP BY User.fullname" );
+ while( $r = mysql_fetch_array($result,MYSQL_NUM))
+ echo " <div class=\"card".($r[3]-1)."\">\n".
+ " <span class=\"score\">".$r[2]."<br /> ".$r[1]."</span>\n".
+ " </div>\n";
+
+ echo " </div>\n </li>\n"; /* end div trick, end li trick */
+ }
+
+
+ echo "</ul>\n"; /* end ul tricks*/
$mycards = DB_get_hand($me);
$mycards = mysort($mycards,$gametype);
@@ -1462,23 +1521,6 @@ else if(myisset("me"))
}
else
{
- echo "the game is over now...<br />\n";
-
- $result = mysql_query("SELECT User.fullname, IFNULL(SUM(Card.points),0), Hand.party FROM Hand".
- " LEFT JOIN Trick ON Trick.winner=Hand.position AND Trick.game_id=Hand.game_id".
- " LEFT JOIN User ON User.id=Hand.user_id".
- " LEFT JOIN Play ON Trick.id=Play.trick_id".
- " LEFT JOIN Hand_Card ON Hand_Card.id=Play.hand_card_id".
- " LEFT JOIN Card ON Card.id=Hand_Card.card_id".
- " WHERE Hand.game_id='$gameid'".
- " GROUP BY User.fullname" );
- echo "Final Score:<br />\n".
- " <table>\n";;
- while( $r = mysql_fetch_array($result,MYSQL_NUM))
- echo " <tr><td> ".$r[0]."</td><td>(".$r[2].")</td><td> ".$r[1]."</td></tr>";
- echo "</table>\n";
-
-
$result = mysql_query("SELECT Hand.party, IFNULL(SUM(Card.points),0) FROM Hand".
" LEFT JOIN Trick ON Trick.winner=Hand.position AND Trick.game_id=Hand.game_id".
" LEFT JOIN User ON User.id=Hand.user_id".
@@ -1487,32 +1529,11 @@ else if(myisset("me"))
" LEFT JOIN Card ON Card.id=Hand_Card.card_id".
" WHERE Hand.game_id='$gameid'".
" GROUP BY Hand.party" );
- echo "Totals:<br />\n".
- " <table> \n";
+ echo "<div class=\"total\"> Totals:<br />\n";
while( $r = mysql_fetch_array($result,MYSQL_NUM))
- echo " <tr><td>".$r[0]."</td><td> ".$r[1]."</td></tr>\n";
- echo "</table>\n";
-
- $session = DB_get_session_by_gameid($gameid);
- $result = mysql_query("SELECT id,create_date FROM Game".
- " WHERE session=$session".
- " ORDER BY create_date DESC".
- " LIMIT 1");
- $r = -1;
- if($result)
- $r = mysql_fetch_array($result,MYSQL_NUM);
+ echo " ".$r[0]." ".$r[1]."<br />\n";
+ echo "</div>\n";
- if(!$session || $gameid==$r[0])
- {
- /* suggest a new game with the same people in it, just rotated once (unless last game was solo) */
- $names = DB_get_all_names_by_gameid($gameid);
- $type = DB_get_gametype_by_gameid($gameid);
-
- if($type=="solo")
- output_ask_for_new_game($names[0],$names[1],$names[2],$names[3],$gameid);
- else
- output_ask_for_new_game($names[1],$names[2],$names[3],$names[0],$gameid);
- }
}
break;
default:
diff --git a/output.php b/output.php
index 6d84128..ddea3b8 100644
--- a/output.php
+++ b/output.php
@@ -25,7 +25,6 @@ function output_ask_for_new_game($playerA,$playerB,$playerC,$playerD,$oldgameid)
global $RULES;
echo "Do you want to continue playing?(This will start a new game, with the next person as dealer.)\n";
- echo "<form action=\"index.php\" method=\"post\">\n";
echo " <input type=\"hidden\" name=\"PlayerA\" value=\"$playerA\" />\n";
echo " <input type=\"hidden\" name=\"PlayerB\" value=\"$playerB\" />\n";
echo " <input type=\"hidden\" name=\"PlayerC\" value=\"$playerC\" />\n";
@@ -35,7 +34,6 @@ function output_ask_for_new_game($playerA,$playerB,$playerC,$playerD,$oldgameid)
echo " <input type=\"hidden\" name=\"call\" value=\"".$RULES["call"]."\" />\n";
echo " <input type=\"hidden\" name=\"followup\" value=\"$oldgameid\" />\n";
echo " <input type=\"submit\" value=\"keep playing\" />\n";
- echo "</form>\n";
return;
}
@@ -296,7 +294,7 @@ function output_header()
function hl(num) {
if(document.getElementById){
var i;
- for(i=1;i<13;i++){
+ for(i=1;i<14;i++){
if(document.getElementById("trick"+i))
document.getElementById("trick"+i).style.display = 'none';
}
@@ -306,7 +304,7 @@ function output_header()
function high_last(){
if(document.getElementById){
var i;
- for(i=12;i>0;i--) {
+ for(i=13;i>0;i--) {
if(document.getElementById("trick"+i))
{
hl(i);