From: Arun Persaud Date: Sat, 28 Jul 2007 19:23:20 +0000 (-0700) Subject: LAYOUT: started work on new layout X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=commitdiff_plain;h=9d32a1343ce662c3d0536b45098e4da524d8ac2f LAYOUT: started work on new layout table is also shown during setup of the game user menu on the left, game menu on the right user menu shows games in which you have to move --- diff --git a/css/standard.css b/css/standard.css index b2157a8..c2cb6f7 100644 --- a/css/standard.css +++ b/css/standard.css @@ -1,25 +1,44 @@ .header { - background-color:white; - text-align:center; - border-bottom:3px solid gray; + background-color: white; + text-align: center; + height: 4em; + border-bottom: 3px solid gray; } + +.main { + min-height: 40em; +} + .footer { - margin:0; - margin-top:0.3em; - padding:0; - border-top: 2px solid #444; - font-size:smaller; - clear:both; - } + margin:0; + margin-top:0.3em; + padding:0; + border-top: 2px solid #444; + font-size:smaller; + clear:both; +} .footer .right{ float:right; } .footer .left{ float:left; } .status { - position:absolute; - right:1em; - top:0.1em; - font-size: smaller; - } + position:absolute; + right:1em; + top:0.1em; + font-size: smaller; +} + +.joingame,.sickness,.poverty { + position: absolute; + width: 18em; + + top:21em; + left:22em; + + text-align: center; +} + + + .card { position:absolute; @@ -52,6 +71,11 @@ div.table span { position:absolute; width:13em; } +div.table span span{ + /*background-color:green;*/ + position:relative; +} + div.table span.table0 { top:9em; left:-15em; @@ -225,7 +249,6 @@ ul.tricks li div div span.comment span{ } .mycards { - clear:both; margin:0; margin-top:33em; padding:0; @@ -261,21 +284,37 @@ ul.tricks li div div span.comment span{ text-align:center; } -.ruleset { +.gameinfo { position:absolute; - top:10.5em; - border:2px solid gray; + top:9em; + right:0em; + + width:12em; + + border-top: 2px solid gray; + border-left: 2px solid gray; + border-bottom: 2px solid gray; + padding:0.3em; + + background-color: #eee; } -.bug { +.usermenu { position:absolute; - top:17.5em; - width:10em; - border:2px solid gray; - padding-top:0.5em; - clear:left; + top:9em; + left:0em; + + width: 12em; + + border-top: 2px solid gray; + border-right: 2px solid gray; + border-bottom: 2px solid gray; + + padding:0.3em; + + background-color: #eee; } .over { diff --git a/functions.php b/functions.php index c6a4a09..d738b00 100644 --- a/functions.php +++ b/functions.php @@ -658,4 +658,173 @@ function can_call($what,$hash) return 0; } +function display_table () +{ + global $gameid, $GT, $debug,$host; + + $result = mysql_query("SELECT User.fullname as name,". + " Hand.position as position, ". + " User.id, ". + " Hand.party as party, ". + " Hand.sickness as sickness, ". + " Hand.point_call, ". + " User.last_login, ". + " Hand.hash ". + "FROM Hand ". + "LEFT JOIN User ON User.id=Hand.user_id ". + "WHERE Hand.game_id='".$gameid."' ". + "ORDER BY position ASC"); + + echo "
\n". + " \"table\"\n"; + while($r = mysql_fetch_array($result,MYSQL_NUM)) + { + $name = $r[0]; + $pos = $r[1]; + $user = $r[2]; + $party = $r[3]; + $sickness = $r[4]; + $call = $r[5]; + $lastlogin = strtotime($r[6]); + $hash = $r[7]; + + $offset = DB_get_user_timezone($user); + $zone = return_timezone($offset); + date_default_timezone_set($zone); + + echo " \n"; + if(!$debug) + echo " $name \n"; + else + echo "$name\n"; + + /* add hints for poverty, wedding, solo, etc */ + if($GT=="poverty" && $party=="re") + if($sickness=="poverty") + { + $userhash = DB_get_hash_from_gameid_and_userid($gameid,$user); + $cards = DB_get_all_hand($userhash); + $trumpNR = count_trump($cards); + if($trumpNR) + echo "\"poverty"; + else + echo "\"poverty"; + } + else + echo "\"poverty\" />"; + + if($GT=="dpoverty") + if($party=="re") + if($sickness=="poverty") + { + $userhash = DB_get_hash_from_gameid_and_userid($gameid,$user); + $cards = DB_get_all_hand($userhash); + $trumpNR = count_trump($cards); + if($trumpNR) + echo "\"poverty"; + else + echo "\"poverty"; + } + else + echo "\"poverty\" />"; + else + if($sickness=="poverty") + { + $userhash = DB_get_hash_from_gameid_and_userid($gameid,$user); + $cards = DB_get_all_hand($userhash); + $trumpNR = count_trump($cards); + if($trumpNR) + echo "\"poverty2"; + else + echo "\"poverty2"; + } + else + echo "\"poverty2\" />"; + + if($GT=="wedding" && $party=="re") + if($sickness=="wedding") + echo "\"wedding\""; + else + echo "\"wedding"; + + if(ereg("solo",$GT) && $party=="re") + { + if(ereg("queen",$GT)) + echo "\"$GT\""; + else if(ereg("jack",$GT)) + echo "\"$GT\""; + else if(ereg("club",$GT)) + echo "\"$GT\""; + else if(ereg("spade",$GT)) + echo "\"$GT\""; + else if(ereg("heart",$GT)) + echo "\"$GT\""; + else if(ereg("trumpless",$GT)) + echo "\"$GT\""; + else if(ereg("trump",$GT)) + echo "\"$GT\""; + } + + /* add point calls */ + if($call!=NULL) + { + if($party=="re") + echo "\"re\""; + else + echo "\"contra\""; + switch($call) + { + case "0": + echo "\"0\""; + break; + case "30": + echo "\"30\""; + break; + case "60": + echo "\"60\""; + break; + case "90": + echo "\"90\""; + break; + } + } + + echo "
\n"; + echo " local time"; + echo " last login"; + echo "
\n"; + + } + echo "
\n"; /* end output table */ + + + return; +} + + +function display_user_menu() +{ + global $wiki,$myid,$host; + echo "
\n". + " go to my user page "; + + $result = mysql_query("SELECT Hand.hash,Hand.game_id,Game.player from Hand". + " LEFT JOIN Game On Hand.game_id=Game.id". + " WHERE Hand.user_id='$myid'". + " AND Game.player='$myid'". + " AND Game.status<>'gameover'" ); + if(mysql_num_rows($result)) + echo "
It's your turn in these games:
\n"; + + while( $r = mysql_fetch_array($result,MYSQL_NUM)) + { + echo "game #".$r[1]."
\n"; + } + + echo + "
Report bugs in the wiki\n"; + echo "
\n"; + return; +} + ?> diff --git a/index.php b/index.php index 40708f8..4f69522 100644 --- a/index.php +++ b/index.php @@ -239,7 +239,6 @@ else if(myisset("me")) DB_get_PREF($myid); /* end set pref */ - /* get rule set for this game */ $result = mysql_query("SELECT * FROM Rulesets". " LEFT JOIN Game ON Game.ruleset=Rulesets.id ". @@ -250,7 +249,6 @@ else if(myisset("me")) $RULES["schweinchen"] = $r[3]; $RULES["call"] = $r[4]; - /* get some infos about the game */ $gametype = DB_get_gametype_by_gameid($gameid); $gamestatus = DB_get_game_status_by_gameid($gameid); @@ -260,9 +258,31 @@ else if(myisset("me")) $gametype = DB_get_solo_by_gameid($gameid); $GT = $gametype." ".$GT; } + + /* does anyone have both foxes */ + $GAME["schweinchen"]=0; + for($i=1;$i<5;$i++) + { + $hash = DB_get_hash_from_game_and_pos($gameid,$i); + $cards = DB_get_all_hand($hash); + if( in_array("19",$cards) && in_array("20",$cards) ) + { + $GAME["schweinchen"]=1; + $GAME["schweinchen-who"]=$hash; + } + }; + + /* put everyting in a form */ + echo "
\n"; + + /* output left menu */ + + display_user_menu(); + + /* output right menu */ - /* display rule set for this game */ - echo "
\n"; + /* display rule set for this game */ + echo "
\n"; if($gamestatus != 'pre') echo " Gametype: $GT
\n"; @@ -271,8 +291,22 @@ else if(myisset("me")) echo "10ofhearts : ".$RULES["dullen"] ."
\n"; echo "schweinchen: ".$RULES["schweinchen"] ."
\n"; echo "call: ".$RULES["call"] ."
\n"; + + echo "
\n"; + if($mystatus == 'play' ) + { + output_form_calls($me); + + echo "
\nA short comment:\n"; + echo "
"; + } + + echo "\n"; + echo "
\n"; + /* output game */ + /* output extra division in case this game is part of a session */ if($session) { @@ -290,20 +324,9 @@ else if(myisset("me")) } echo "
\n"; } - - - /* does anyone have both foxes */ - $GAME["schweinchen"]=0; - for($i=1;$i<5;$i++) - { - $hash = DB_get_hash_from_game_and_pos($gameid,$i); - $cards = DB_get_all_hand($hash); - if( in_array("19",$cards) && in_array("20",$cards) ) - { - $GAME["schweinchen"]=1; - $GAME["schweinchen-who"]=$hash; - } - }; + + /* display the table and the names */ + display_table(); /* mystatus gets the player through the different stages of a game. * start: yes/no @@ -357,17 +380,16 @@ else if(myisset("me")) } else { - echo "Thanks for joining the game..."; - $mycards = DB_get_hand($me); sort($mycards); - echo "

your cards are:
\n"; + + output_check_for_sickness($me,$mycards); + + echo "

your cards are:
\n"; foreach($mycards as $card) display_card($card,$PREF["cardset"]); echo "

\n"; - output_check_for_sickness($me,$mycards); - /* move on to the next stage*/ DB_set_hand_status_by_hash($me,'check'); } @@ -755,12 +777,11 @@ else if(myisset("me")) $result = mysql_query("UPDATE Hand_Card SET hand_id='$myhand' WHERE hand_id='$userhand' AND card_id<'27'" ); /* add hidden button with trump in it to get to the next point */ - echo "\n"; + echo "
\n"; echo " \n"; echo " \n"; - echo " \n"; echo " \n"; - echo "\n"; + echo "
\n"; } else if(myisset("trump","exchange") && $_REQUEST["trump"]>0 && ($who==$mypos || $who==$mypos*10)) { @@ -861,24 +882,24 @@ else if(myisset("me")) else { /* else show all trump, have lowest card pre-selected, have hidden setting for */ - echo "you need to get rid of a few cards
\n"; + echo "
you need to get rid of a few cards
\n"; set_gametype($gametype); /* this sets the $CARDS variable */ $mycards = DB_get_hand($me); $mycards = mysort($mycards,$gametype); - echo "
\n"; $type="exchange"; + echo "
Your cards are:
\n"; foreach($mycards as $card) display_link_card($card,$PREF["cardset"],$type); echo " \n"; - echo " \n"; echo " \n"; - echo "\n"; + echo "
\n"; } } else if($who == $mypos || $who == $mypos*10) { + echo "
\n"; foreach($userids as $user) { $name = DB_get_name_by_userid($user); @@ -892,15 +913,16 @@ else if(myisset("me")) /* count trump */ if($nrtrump<4) echo "Player $name has $nrtrump trump. Do you want to take them?". - "yes
"; + "yes
\n"; } } - echo "No,way I take those trump...
"; - + echo "No,way I take those trump...
\n"; + echo "
\n"; + echo "Your cards are:
\n"; $mycards = DB_get_hand($me); sort($mycards); - echo "

your cards are:
\n"; + echo "

your cards are:
\n"; foreach($mycards as $card) display_card($card,$PREF["cardset"]); echo "

\n"; @@ -999,16 +1021,6 @@ else if(myisset("me")) /* get some infos about the game */ $gamestatus = DB_get_game_status_by_gameid($gameid); - /* display useful things in divs */ - - /* display links to the users status page */ - $result = mysql_query("SELECT email,password from User WHERE id='$myid'" ); - $r = mysql_fetch_array($result,MYSQL_NUM); - - display_links($r[0],$r[1]); - - /* end display useful things*/ - /* has the game started? No, then just wait here...*/ if($gamestatus == 'pre') { @@ -1017,143 +1029,6 @@ else if(myisset("me")) break; /* not sure this works... the idea is that you can * only play a card after everyone is ready to play */ } - - /* display the table and the names */ - $result = mysql_query("SELECT User.fullname as name,". - " Hand.position as position, ". - " User.id, ". - " Hand.party as party, ". - " Hand.sickness as sickness, ". - " Hand.point_call, ". - " User.last_login, ". - " Hand.hash ". - "FROM Hand ". - "LEFT JOIN User ON User.id=Hand.user_id ". - "WHERE Hand.game_id='".$gameid."' ". - "ORDER BY position ASC"); - - echo "
\n". - " \"table\"\n"; - while($r = mysql_fetch_array($result,MYSQL_NUM)) - { - $name = $r[0]; - $pos = $r[1]; - $user = $r[2]; - $party = $r[3]; - $sickness = $r[4]; - $call = $r[5]; - $lastlogin = strtotime($r[6]); - $hash = $r[7]; - - $offset = DB_get_user_timezone($user); - $zone = return_timezone($offset); - date_default_timezone_set($zone); - - echo " \n"; - if(!$debug) - echo " $name \n"; - else - { - echo "$name\n"; - } - /* add hints for poverty, wedding, solo, etc */ - if($GT=="poverty" && $party=="re") - if($sickness=="poverty") - { - $userhash = DB_get_hash_from_gameid_and_userid($gameid,$user); - $cards = DB_get_all_hand($userhash); - $trumpNR = count_trump($cards); - if($trumpNR) - echo "\"poverty"; - else - echo "\"poverty"; - } - else - echo "\"poverty\" />"; - - if($GT=="dpoverty") - if($party=="re") - if($sickness=="poverty") - { - $userhash = DB_get_hash_from_gameid_and_userid($gameid,$user); - $cards = DB_get_all_hand($userhash); - $trumpNR = count_trump($cards); - if($trumpNR) - echo "\"poverty"; - else - echo "\"poverty"; - } - else - echo "\"poverty\" />"; - else - if($sickness=="poverty") - { - $userhash = DB_get_hash_from_gameid_and_userid($gameid,$user); - $cards = DB_get_all_hand($userhash); - $trumpNR = count_trump($cards); - if($trumpNR) - echo "\"poverty2"; - else - echo "\"poverty2"; - } - else - echo "\"poverty2\" />"; - - if($GT=="wedding" && $party=="re") - if($sickness=="wedding") - echo "\"wedding\""; - else - echo "\"wedding"; - - if(ereg("solo",$GT) && $party=="re") - { - if(ereg("queen",$GT)) - echo "\"$GT\""; - else if(ereg("jack",$GT)) - echo "\"$GT\""; - else if(ereg("club",$GT)) - echo "\"$GT\""; - else if(ereg("spade",$GT)) - echo "\"$GT\""; - else if(ereg("heart",$GT)) - echo "\"$GT\""; - else if(ereg("trumpless",$GT)) - echo "\"$GT\""; - else if(ereg("trump",$GT)) - echo "\"$GT\""; - } - - /* add point calls */ - if($call!=NULL) - { - if($party=="re") - echo "\"re\""; - else - echo "\"contra\""; - switch($call) - { - case "0": - echo "\"0\""; - break; - case "30": - echo "\"30\""; - break; - case "60": - echo "\"60\""; - break; - case "90": - echo "\"90\""; - break; - } - } - - echo "
\n"; - echo " local time: ".date("Y-m-d H:i:s")."
\n"; - echo " last login: ".date("Y-m-d H:i:s",$lastlogin)."
\n"; - echo "
\n"; - - } - echo "
\n"; /* get time from the last action of the game */ $result = mysql_query("SELECT mod_date from Game WHERE id='$gameid' " ); @@ -1515,7 +1390,6 @@ else if(myisset("me")) { echo "Hello ".$myname.", it's your turn!
\n"; echo "Your cards are:
\n"; - echo "
\n"; /* do we have to follow suite? */ $followsuit = 0; @@ -1529,27 +1403,12 @@ else if(myisset("me")) else display_link_card($card,$PREF["cardset"]); } - - output_form_calls($me); - - echo "
\nA short comment:\n"; - echo "\n"; - echo "\n"; - echo "
\n"; } else if($mystatus=='play' ) { echo "Your cards are:
\n"; foreach($mycards as $card) display_card($card,$PREF["cardset"]); - - echo "
\n"; - output_form_calls($me); - echo "
\nA short comment:\n"; - echo "\n"; - echo "\n"; - echo "
\n"; - } else if($mystatus=='gameover') { @@ -1560,11 +1419,9 @@ else if(myisset("me")) if( $gameend < 60*60*24*7 ) { - echo "
\n"; echo "
\nA short comment:\n"; echo "\n"; echo "\n"; - echo "
\n"; } $oldcards = DB_get_all_hand($me); @@ -1661,6 +1518,7 @@ else if(myisset("me")) default: myerror("error in testing the status"); } + echo "\n"; output_footer(); DB_close(); exit(); diff --git a/output.php b/output.php index 8452815..6d84128 100644 --- a/output.php +++ b/output.php @@ -2,23 +2,6 @@ /* functions which only ouput html */ -function display_links($email,$password) -{ - global $wiki; - echo "
\n". - "Report bugs in the wiki.
\n"; - output_link_to_user_page($email,$password); - echo "
\n"; - return; -} - -function output_link_to_user_page($email,$password) -{ - echo " go to my user page "; - - return; -} - function output_user_settings($email,$password) { global $PREF; @@ -145,7 +128,7 @@ function display_link_card($card,$dir="english",$type="card") function output_check_for_sickness($me,$mycards) { ?> -
+
Thanks for joining the game...
do you want to play solo? \n"; echo "\n"; - echo "\n"; + echo "
\n"; return; } @@ -213,30 +196,30 @@ function output_form_calls($me) "
"; if( can_call(60,$me) ) echo " 60:". - " "; + "
"; if( can_call(30,$me) ) echo " 30:". - " "; + "
"; if( can_call(0,$me) ) echo " 0:". - " ". + "
". " no call:". - " "; + "
"; } function output_check_want_to_play($me) { ?> -
- Do you want to play a game of DoKo? +
+ Do you want to play a game of DoKo?
yes no
\n"; echo "\n"; - echo "\n"; - echo " \n"; + echo "\n"; + echo "
\n"; return; } @@ -338,7 +321,7 @@ function output_header()

Welcome to E-Doko (beta)

- +
"; echo "
\n"; echo "

copyright 2006-2007 Arun Persaud
\n". "Verwendung der [deutschen] Kartenbilder mit Genehmigung
der Spielkartenfabrik Altenburg GmbH,(c) ASS Altenburger
".