From e2d7a3291f85403b4faf6f8be7e30caeefb0c1a3 Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Tue, 2 Feb 2010 20:19:43 -0800 Subject: highlight the call if this is the last round where you can make this call also added some more comments --- css/standard022.css | 652 ------------------------------------------------- css/standard023.css | 656 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/functions.php | 85 ++++++- include/game.php | 19 +- include/output.php | 77 ++++-- index.php | 6 +- 6 files changed, 801 insertions(+), 694 deletions(-) delete mode 100644 css/standard022.css create mode 100644 css/standard023.css diff --git a/css/standard022.css b/css/standard022.css deleted file mode 100644 index 79dfeea..0000000 --- a/css/standard022.css +++ /dev/null @@ -1,652 +0,0 @@ -/* reset CSS (taken from blueprint and modified a bit) */ - -html, body, div, span, -h1, h2, h3, h4, h5, h6, p, -a,img, dl, dt, dd, ol, ul, li, -fieldset, form, label, legend, -table, tbody, tfoot, thead, tr, th, td { - margin: 0; - padding: 0; - border: 0; - vertical-align: baseline; -} -table { border-collapse: separate; border-spacing: 0; } -caption, th, td { text-align: left; font-weight: normal; } -table, td, th { vertical-align: middle; } - -/* end reset */ - -/* some general layout */ -h1, h2, h3, h4, h5, h6, p {margin: 2px; padding: 1px;} - -body { background-color: #ddd; } - - -/* the header, footer, etc */ -.header { - background-color: #fff; - text-align: center; - height: 4em; - padding-top: 1.5em; - margin-left: 3em; - margin-right: 3em; - border-bottom: 3px solid gray; -} - -.lastlogin { - position:absolute; - top:0; - left:3em; -} -.lastlogin span { font-size:smaller;} - -.main { - background-color: #fff; - margin-left: 3em; - margin-right: 3em; - min-height: 40em; -} - -.footer { - background-color: #fff; - margin-left: 3em; - margin-right: 3em; - padding:0; - border-top: 2px solid gray; - clear:both; - height: 8em; -} -.footer .right { float:right; font-size:smaller;} -.footer .left { float:left; font-size:smaller; } - -.status { - position:absolute; - right:4em; - top:0.1em; - font-size: smaller; -} - -/* sessions */ -.session { - width: 100%; - border-bottom: 1px solid #000; - text-align: center; -} -.session div.sessionrules { - width: 19em; - float: left; - text-align: left; -} -.session div.sessionrules div{ - display:none; - background-color: #fff; - border: 1px solid #000; - position:absolute; - z-index: 30; - padding:0.5em; -} -.session div.sessionrules:hover div{ display:block; } -.session div.sessionscore { - width: 19em; - float: right; - text-align: right; -} -.session div.sessionscore div{ - position:absolute; - width:12em; - right:3em; - display:none; - background-color: #fff; - border: 1px solid #000; - z-index: 30; -} -.session div.sessionscore:hover div{ display:block;} -.session img.rulesicon{ height: 1em; } - -.session .scoretable{ - height:20em; - overflow: auto; -} -.session table.score { - margin:0.5em; - width:10em; - border-collapse:collapse; -} - -/* all kind of message that should appear in the middle of the page/table */ -.joingame,.sickness,.poverty,.total,.message { - position: absolute; - background-color: #fff; - width: 20%; - top:19em; - left:40%; - right:40%; - text-align: center; - z-index:22 -} - -.total { - top:11em; - width: 14%; - left: 43%; -} -/* scoring */ -.total .re { - position: absolute; - left: -12em; - top:8em; - background-color: #eee; - z-index:15; -} -.total .contra { - position: absolute; - right: -14em; - top:8em; - background-color: #eee; - z-index:15; -} - -/* output possible rules for a new game */ -.rules { margin-top:24em;} - -/* playing cards*/ -.card { - position:absolute; - z-index:20; - top:18em; - left:28em; - text-align:center; - background-color:#fff; - border:2px solid gray; -} -.card img { width:8em; } - -/* display the table and the names */ -div.table { - position:absolute; - width:100%; - height:37em; - margin:0; - left:0; - padding:0; -/* border: 3px solid blue; */ - top: 9.2em; - text-align:center; -} - -div.table img.table { - position:absolute; - width:25%; - top:20%; - height:22em; - left:37.5%; - z-index:5; - display: block; - margin:0; - padding:0; -} -div.table div { - /*background-color:green;*/ - position:absolute; - width:12.5%; - text-align:center; - z-index:20; -} -div.table div img{ - /*background-color:green;*/ - width:20%; -} - -div.table div.table0 { - top:45%; - right:62.5%; -} -div.table div.table1 { - top:0%; - left:43.75%; -} -div.table div.table2 { - top:45%; - left:62.5%; -} -div.table div.table3 { - bottom:0%; - left: 43.75%; -} - -/* display the card tricks */ - -ul.tricks { - position:relative; - zoom:1; /* fixes an IE6 issue and hopefully doesn't mess up anything else */ - list-style:none; - margin:3px; - padding:0; - padding-bottom:3px; - text-align:center; - border-bottom:1px solid #444; -} -ul.tricks a { text-decoration:none; color:#000;} -ul.tricks li { - /*background-color:blue;*/ - padding:0.1em; - margin:0.2em 0.5em; - display:inline; -} -ul.tricks li.old { background-color:#fff; } -ul.tricks li:hover { background-color: #bbb;} -ul.tricks li.nohighlight:hover { background-color: #fff;} - -ul.tricks li div.trick { - position:absolute; - width:100%; - height:35em; - top:2.2em; - left: 0; - margin:0; - padding:0; -/* border: 2px solid red;*/ - display:block; -} -ul.tricks li div.trick { display:none;} -ul.tricks li div.trick img.arrow { - position:absolute; - margin:0; - padding:0; -/* border: 5px solid blue;*/ - text-align:center; - width:16%; - height:16em; - left:42%; - right:42%; - top:10em; - z-index:8; -} - -#trick0 img { float:left; width: 3em; } - -hr {clear:both;} - -/*ul.tricks li:hover div.table{ display:block; }*/ - -/* left player */ -ul.tricks li div div.card0 img, -ul.tricks li div div.card0 .score, -.vorbehalt0 { - position:absolute; - margin:0; - padding:0; - /*border: 1px solid red;*/ - top: 40%; - left:37.5%; - right:56.5%; - width:6%; - z-index:30; -} - -.vorbehalt0 { - left:37.5%; - right:57.5%; - width:10%; - text-align:left; -} -ul.tricks li div div.card0 span.comment{ - position:absolute; - margin:0; - padding:0; - /*border: 1px solid red;*/ - top: 5%; - right:66.5%; - left:17.5%; - width:16%; -} - -/* top player */ -ul.tricks li div div.card1 img, -ul.tricks li div div.card1 .score, -.vorbehalt1 { - position:absolute; - margin:0; - padding:0; - /*border: 1px solid red;*/ - top: 22%; - left:47%; - right:47%; - width:6%; - text-align:center; - z-index:30; -} -.vorbehalt1{ - left:45%; - right:45%; - width:10%; - z-index:30; -} -ul.tricks li div div.card1 span.comment{ - position:absolute; - margin:0; - padding:0; - /*border: 1px solid red;*/ - top: 5%; - left:66.5%; - right:17.5%; - width:16%; - text-align:center; -} - -/* right player */ -ul.tricks li div div.card2 img, -ul.tricks li div div.card2 .score, -.vorbehalt2{ - position:absolute; - margin:0; - padding:0; - /*border: 1px solid red;*/ - top: 40%; - right:37.5%; - left:56.5%; - width:6%; - z-index:30; -} -.vorbehalt2{ - left:auto; - right:38%; - width:10%; - text-align:right; -} -ul.tricks li div div.card2 span.comment{ - position:absolute; - margin:0; - padding:0; - /*border: 1px solid red;*/ - top: 85%; - left:66.5%; - right:17.5%; - width:16%; - text-align:center; -} - -/* bottom player */ -ul.tricks li div div.card3 img, -ul.tricks li div div.card3 .score, -.vorbehalt3{ - position:absolute; - margin:0; - padding:0; - /*border: 1px solid red;*/ - bottom: 20%; - left:47%; - right:47%; - width:6%; - text-align:center; - z-index:30; -} -.vorbehalt3{ - left:45%; - right:45%; - width:10%; - text-align:center; -} -ul.tricks li div div.card3 span.comment{ - position:absolute; - margin:0; - padding:0; - /*border: 1px solid red;*/ - top: 85%; - right:66.5%; - left:17.5%; - width:16%; -} - -span.comment{ - border: 3px solid green; - max-height:6em; - overflow: auto; - word-wrap: break-word; -} - -ul.tricks li div div span.comment span{ - display:block; - text-align:left; - border-top:1px solid green; -} - -.mycards { - margin:0; - margin-top:38.5em; - padding:0; - border-top: 2px solid gray; -/* border-bottom: 2px solid green;*/ - background-color: #faffc7; - text-align:center; -} - -.mycards img { height:6em;} - -.exchange { - clear:both; - margin:0; - padding:0; - border:1px solid red; - background-color:yellow; -} - -.exchange img { height:6em;} - -.line{ - clear:both; - border-top:2px solid gray; - margin:0; - padding:0; -} - -.gameinfo { - position:absolute; - top:27em; - right:0em; - margin:1em; - margin-top:0em; - margin-right:3em; - - width:12em; - - padding:0.3em; - - border: 2px solid gray; - background-color: #efefef; -} - -.usermenu { - position:absolute; - top:10em; - left:3em; - margin:1em; - margin-top:0em; - margin-left:0em; - - width: 12em; - - border: 2px solid gray; - - padding:0.3em; - - background-color: #eee; -} - -.notes { - position:absolute; - top:27em; - left:0; - margin:1em; - margin-top:0em; - margin-left:3em; - - width: 12em; - - border: 2px solid gray; - - padding:0.3em; - - background-color: #efefef; - - height:10em; - overflow: auto; - z-index:50; -} - -.user { margin-left:25%;margin-right:5%; } -.user td.usergames { width:50%; } -.wide { margin-left:5%;margin-right:5%; } - -.over { - text-align:center; - margin-bottom:0.1em; -} - -.cardinput { - display:inline; - position:relative; - border: 1px solid #000; -} - -.cardinput img { width: 4em;} - -.cardinput:hover{ background-color:red;} - -div span img.button { width: 2em;} -div span img.tinybutton { width: 1.4em;} - -.gamestatuspre { - padding: 0 0.3em; - background-color: #fd8901; -} -.gamestatusover { - padding:0 0.3em; - background-color: #f82c20 ; -} -.gamestatusplay { - padding:0 0.3em; - background-color: #15de26; -} - -.multi a{ color: #fff;} - -.bigger{ font-size:larger;} - - -/* statistics using jquery*/ -caption { - text-align: center; - margin: 0.5em; - padding: 0.5em; - padding-bottom: 0em; - margin-bottom: 0; - } - -table.stats { - margin: 0.5em 1em; - border: solid 0.2em #aeaeae; - -moz-border-radius: 0.5em ; - float: left; -} -table.stats tbody tr.odd td { background-color:#aeaeae; } -table.stats tbody tr.even td { background-color:#eaeaea; } -table.stats td, table.stats th { - margin-left: 0.2em; - margin-right: 0.2em; - padding-left: 0.2em; - padding-right: 0.2em; - border-right: solid 0.1em #000; -} -table.stats tr td:last-child, table.stats tr th:last-child { border-right: solid 0 #000; } -table.stats th { border-bottom: solid 0.2em #000 } - -table.stats thead tr .header { - background-image: url(bg.png); - background-repeat: no-repeat; - background-position: center right; - cursor: pointer; -} -table.stats tbody td { - padding: 4px; - background-color: #eaeaea; - vertical-align: top; -} -table.stats thead tr .headerSortUp { - background-image: url(asc.png); -} -table.stats thead tr .headerSortDown { - background-image: url(desc.png); -} -table.stats thead tr .headerSortDown, table.tablesorter thead tr .headerSortUp { - background-color: #8dbdd8; -} - - - -/* the login window */ -.login { - text-align:center; - padding-top: 1em; -} - -.login p, { - padding: 0.1em 0.1em 0.15em; -} -.login h4 { - padding: 0.3em 0.3em 0.45em; -} - -/* the login form */ -.login form{ - width: 24em; - margin: 0.5em auto; - padding: 0.5em 0.5em 1.5em; - text-align: center; -} - -fieldset { - border: 2px solid #000; - padding: 0.5em 0.5em 0.75em; - background-color: #eee; -} - -.login label, .login input{ margin: 0.5em 0.5em 0.75em;} - -.login label{ - float:left; - width:7em; - text-align: left; -} - -.login input #email, .login input #password{ - width:9em; - float:right; -} - -.login .submitbutton { background-color: #fff;} -.login .submitbutton:hover { background-color: #aaa;} - -#openid_url { - background: #FFFFFF url('openid-icon-small.gif') no-repeat scroll 0pt 50%; - padding-left: 18px; -} - -table.openid td, table.openid th{ - padding: 0.0em 0.3em;; -} - -.newbiehint { - background-color: #fee; -} - -.vacation { - color: #666; - background-color: #fc3; -} - -div.table div img.gravatar, img.gravatar { - width: 4em; - height: 4em; - border: 3px solid #aaa; -} \ No newline at end of file diff --git a/css/standard023.css b/css/standard023.css new file mode 100644 index 0000000..7c84507 --- /dev/null +++ b/css/standard023.css @@ -0,0 +1,656 @@ +/* reset CSS (taken from blueprint and modified a bit) */ + +html, body, div, span, +h1, h2, h3, h4, h5, h6, p, +a,img, dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, tbody, tfoot, thead, tr, th, td { + margin: 0; + padding: 0; + border: 0; + vertical-align: baseline; +} +table { border-collapse: separate; border-spacing: 0; } +caption, th, td { text-align: left; font-weight: normal; } +table, td, th { vertical-align: middle; } + +/* end reset */ + +/* some general layout */ +h1, h2, h3, h4, h5, h6, p {margin: 2px; padding: 1px;} + +body { background-color: #ddd; } + + +/* the header, footer, etc */ +.header { + background-color: #fff; + text-align: center; + height: 4em; + padding-top: 1.5em; + margin-left: 3em; + margin-right: 3em; + border-bottom: 3px solid gray; +} + +.lastlogin { + position:absolute; + top:0; + left:3em; +} +.lastlogin span { font-size:smaller;} + +.main { + background-color: #fff; + margin-left: 3em; + margin-right: 3em; + min-height: 40em; +} + +.footer { + background-color: #fff; + margin-left: 3em; + margin-right: 3em; + padding:0; + border-top: 2px solid gray; + clear:both; + height: 8em; +} +.footer .right { float:right; font-size:smaller;} +.footer .left { float:left; font-size:smaller; } + +.status { + position:absolute; + right:4em; + top:0.1em; + font-size: smaller; +} + +/* sessions */ +.session { + width: 100%; + border-bottom: 1px solid #000; + text-align: center; +} +.session div.sessionrules { + width: 19em; + float: left; + text-align: left; +} +.session div.sessionrules div{ + display:none; + background-color: #fff; + border: 1px solid #000; + position:absolute; + z-index: 30; + padding:0.5em; +} +.session div.sessionrules:hover div{ display:block; } +.session div.sessionscore { + width: 19em; + float: right; + text-align: right; +} +.session div.sessionscore div{ + position:absolute; + width:12em; + right:3em; + display:none; + background-color: #fff; + border: 1px solid #000; + z-index: 30; +} +.session div.sessionscore:hover div{ display:block;} +.session img.rulesicon{ height: 1em; } + +.session .scoretable{ + height:20em; + overflow: auto; +} +.session table.score { + margin:0.5em; + width:10em; + border-collapse:collapse; +} + +/* all kind of message that should appear in the middle of the page/table */ +.joingame,.sickness,.poverty,.total,.message { + position: absolute; + background-color: #fff; + width: 20%; + top:19em; + left:40%; + right:40%; + text-align: center; + z-index:22 +} + +.total { + top:11em; + width: 14%; + left: 43%; +} +/* scoring */ +.total .re { + position: absolute; + left: -12em; + top:8em; + background-color: #eee; + z-index:15; +} +.total .contra { + position: absolute; + right: -14em; + top:8em; + background-color: #eee; + z-index:15; +} + +/* output possible rules for a new game */ +.rules { margin-top:24em;} + +/* playing cards*/ +.card { + position:absolute; + z-index:20; + top:18em; + left:28em; + text-align:center; + background-color:#fff; + border:2px solid gray; +} +.card img { width:8em; } + +/* display the table and the names */ +div.table { + position:absolute; + width:100%; + height:37em; + margin:0; + left:0; + padding:0; +/* border: 3px solid blue; */ + top: 9.2em; + text-align:center; +} + +div.table img.table { + position:absolute; + width:25%; + top:20%; + height:22em; + left:37.5%; + z-index:5; + display: block; + margin:0; + padding:0; +} +div.table div { + /*background-color:green;*/ + position:absolute; + width:12.5%; + text-align:center; + z-index:20; +} +div.table div img{ + /*background-color:green;*/ + width:20%; +} + +div.table div.table0 { + top:45%; + right:62.5%; +} +div.table div.table1 { + top:0%; + left:43.75%; +} +div.table div.table2 { + top:45%; + left:62.5%; +} +div.table div.table3 { + bottom:0%; + left: 43.75%; +} + +/* display the card tricks */ + +ul.tricks { + position:relative; + zoom:1; /* fixes an IE6 issue and hopefully doesn't mess up anything else */ + list-style:none; + margin:3px; + padding:0; + padding-bottom:3px; + text-align:center; + border-bottom:1px solid #444; +} +ul.tricks a { text-decoration:none; color:#000;} +ul.tricks li { + /*background-color:blue;*/ + padding:0.1em; + margin:0.2em 0.5em; + display:inline; +} +ul.tricks li.old { background-color:#fff; } +ul.tricks li:hover { background-color: #bbb;} +ul.tricks li.nohighlight:hover { background-color: #fff;} + +ul.tricks li div.trick { + position:absolute; + width:100%; + height:35em; + top:2.2em; + left: 0; + margin:0; + padding:0; +/* border: 2px solid red;*/ + display:block; +} +ul.tricks li div.trick { display:none;} +ul.tricks li div.trick img.arrow { + position:absolute; + margin:0; + padding:0; +/* border: 5px solid blue;*/ + text-align:center; + width:16%; + height:16em; + left:42%; + right:42%; + top:10em; + z-index:8; +} + +#trick0 img { float:left; width: 3em; } + +hr {clear:both;} + +/*ul.tricks li:hover div.table{ display:block; }*/ + +/* left player */ +ul.tricks li div div.card0 img, +ul.tricks li div div.card0 .score, +.vorbehalt0 { + position:absolute; + margin:0; + padding:0; + /*border: 1px solid red;*/ + top: 40%; + left:37.5%; + right:56.5%; + width:6%; + z-index:30; +} + +.vorbehalt0 { + left:37.5%; + right:57.5%; + width:10%; + text-align:left; +} +ul.tricks li div div.card0 span.comment{ + position:absolute; + margin:0; + padding:0; + /*border: 1px solid red;*/ + top: 5%; + right:66.5%; + left:17.5%; + width:16%; +} + +/* top player */ +ul.tricks li div div.card1 img, +ul.tricks li div div.card1 .score, +.vorbehalt1 { + position:absolute; + margin:0; + padding:0; + /*border: 1px solid red;*/ + top: 22%; + left:47%; + right:47%; + width:6%; + text-align:center; + z-index:30; +} +.vorbehalt1{ + left:45%; + right:45%; + width:10%; + z-index:30; +} +ul.tricks li div div.card1 span.comment{ + position:absolute; + margin:0; + padding:0; + /*border: 1px solid red;*/ + top: 5%; + left:66.5%; + right:17.5%; + width:16%; + text-align:center; +} + +/* right player */ +ul.tricks li div div.card2 img, +ul.tricks li div div.card2 .score, +.vorbehalt2{ + position:absolute; + margin:0; + padding:0; + /*border: 1px solid red;*/ + top: 40%; + right:37.5%; + left:56.5%; + width:6%; + z-index:30; +} +.vorbehalt2{ + left:auto; + right:38%; + width:10%; + text-align:right; +} +ul.tricks li div div.card2 span.comment{ + position:absolute; + margin:0; + padding:0; + /*border: 1px solid red;*/ + top: 85%; + left:66.5%; + right:17.5%; + width:16%; + text-align:center; +} + +/* bottom player */ +ul.tricks li div div.card3 img, +ul.tricks li div div.card3 .score, +.vorbehalt3{ + position:absolute; + margin:0; + padding:0; + /*border: 1px solid red;*/ + bottom: 20%; + left:47%; + right:47%; + width:6%; + text-align:center; + z-index:30; +} +.vorbehalt3{ + left:45%; + right:45%; + width:10%; + text-align:center; +} +ul.tricks li div div.card3 span.comment{ + position:absolute; + margin:0; + padding:0; + /*border: 1px solid red;*/ + top: 85%; + right:66.5%; + left:17.5%; + width:16%; +} + +span.comment{ + border: 3px solid green; + max-height:6em; + overflow: auto; + word-wrap: break-word; +} + +ul.tricks li div div span.comment span{ + display:block; + text-align:left; + border-top:1px solid green; +} + +.mycards { + margin:0; + margin-top:38.5em; + padding:0; + border-top: 2px solid gray; +/* border-bottom: 2px solid green;*/ + background-color: #faffc7; + text-align:center; +} + +.mycards img { height:6em;} + +.exchange { + clear:both; + margin:0; + padding:0; + border:1px solid red; + background-color:yellow; +} + +.exchange img { height:6em;} + +.line{ + clear:both; + border-top:2px solid gray; + margin:0; + padding:0; +} + +.gameinfo { + position:absolute; + top:27em; + right:0em; + margin:1em; + margin-top:0em; + margin-right:3em; + + width:12em; + + padding:0.3em; + + border: 2px solid gray; + background-color: #efefef; +} + +.usermenu { + position:absolute; + top:10em; + left:3em; + margin:1em; + margin-top:0em; + margin-left:0em; + + width: 12em; + + border: 2px solid gray; + + padding:0.3em; + + background-color: #eee; +} + +.notes { + position:absolute; + top:27em; + left:0; + margin:1em; + margin-top:0em; + margin-left:3em; + + width: 12em; + + border: 2px solid gray; + + padding:0.3em; + + background-color: #efefef; + + height:10em; + overflow: auto; + z-index:50; +} + +.user { margin-left:25%;margin-right:5%; } +.user td.usergames { width:50%; } +.wide { margin-left:5%;margin-right:5%; } + +.over { + text-align:center; + margin-bottom:0.1em; +} + +.cardinput { + display:inline; + position:relative; + border: 1px solid #000; +} + +.cardinput img { width: 4em;} + +.cardinput:hover{ background-color:red;} + +div span img.button { width: 2em;} +div span img.tinybutton { width: 1.4em;} + +.gamestatuspre { + padding: 0 0.3em; + background-color: #fd8901; +} +.gamestatusover { + padding:0 0.3em; + background-color: #f82c20 ; +} +.gamestatusplay { + padding:0 0.3em; + background-color: #15de26; +} + +.multi a{ color: #fff;} + +.bigger{ font-size:larger;} + + +/* statistics using jquery*/ +caption { + text-align: center; + margin: 0.5em; + padding: 0.5em; + padding-bottom: 0em; + margin-bottom: 0; + } + +table.stats { + margin: 0.5em 1em; + border: solid 0.2em #aeaeae; + -moz-border-radius: 0.5em ; + float: left; +} +table.stats tbody tr.odd td { background-color:#aeaeae; } +table.stats tbody tr.even td { background-color:#eaeaea; } +table.stats td, table.stats th { + margin-left: 0.2em; + margin-right: 0.2em; + padding-left: 0.2em; + padding-right: 0.2em; + border-right: solid 0.1em #000; +} +table.stats tr td:last-child, table.stats tr th:last-child { border-right: solid 0 #000; } +table.stats th { border-bottom: solid 0.2em #000 } + +table.stats thead tr .header { + background-image: url(bg.png); + background-repeat: no-repeat; + background-position: center right; + cursor: pointer; +} +table.stats tbody td { + padding: 4px; + background-color: #eaeaea; + vertical-align: top; +} +table.stats thead tr .headerSortUp { + background-image: url(asc.png); +} +table.stats thead tr .headerSortDown { + background-image: url(desc.png); +} +table.stats thead tr .headerSortDown, table.tablesorter thead tr .headerSortUp { + background-color: #8dbdd8; +} + + + +/* the login window */ +.login { + text-align:center; + padding-top: 1em; +} + +.login p, { + padding: 0.1em 0.1em 0.15em; +} +.login h4 { + padding: 0.3em 0.3em 0.45em; +} + +/* the login form */ +.login form{ + width: 24em; + margin: 0.5em auto; + padding: 0.5em 0.5em 1.5em; + text-align: center; +} + +fieldset { + border: 2px solid #000; + padding: 0.5em 0.5em 0.75em; + background-color: #eee; +} + +.login label, .login input{ margin: 0.5em 0.5em 0.75em;} + +.login label{ + float:left; + width:7em; + text-align: left; +} + +.login input #email, .login input #password{ + width:9em; + float:right; +} + +.login .submitbutton { background-color: #fff;} +.login .submitbutton:hover { background-color: #aaa;} + +#openid_url { + background: #FFFFFF url('openid-icon-small.gif') no-repeat scroll 0pt 50%; + padding-left: 18px; +} + +table.openid td, table.openid th{ + padding: 0.0em 0.3em;; +} + +.newbiehint { + background-color: #fee; +} + +.vacation { + color: #666; + background-color: #fc3; +} + +div.table div img.gravatar, img.gravatar { + width: 4em; + height: 4em; + border: 3px solid #aaa; +} + +.highcall { + background-color: #fc3; +} diff --git a/include/functions.php b/include/functions.php index 63216eb..eca0155 100644 --- a/include/functions.php +++ b/include/functions.php @@ -708,19 +708,36 @@ function sort_comp_low_high($a,$b) function can_call($what,$hash) { + /* figure out if a person can make a call: + $what in 0,30,60,90,120 = points of the call + $hash = the hash of the person who wants to make the call + + return values: + 0 can't make that call + 1 can make the call + 2 can make the call, but this is the last chance to do so... + */ + global $RULES; + /* get some information + */ $gameid = DB_get_gameid_by_hash($hash); $gametype = DB_get_gametype_by_gameid($gameid); - $oldcall = DB_get_call_by_hash($hash); - $pcall = DB_get_partner_call_by_hash($hash); + $oldcall = DB_get_call_by_hash($hash); /* did the person already made a call? */ + $pcall = DB_get_partner_call_by_hash($hash); /* did the partner already made a call */ + - if( ($pcall!=NULL && $what >= $pcall) || - ($oldcall!=NULL && $what >=$oldcall) ) + /* you're call must be better than the one you or your partner already made + */ + if( ($pcall!=NULL && ($what >= $pcall)) + || ($oldcall!=NULL && ($what >=$oldcall)) ) { return 0; } + /* for some rules we need to know how many cards people have + */ $NRcards = count(DB_get_hand($hash)); $NRallcards = 0; @@ -730,7 +747,8 @@ function can_call($what,$hash) $NRallcards += count(DB_get_hand($user)); }; - /* in case of a wedding, everything will be delayed by an offset */ + /* in case of a wedding, everything will be delayed by an offset + */ $offset = 0; if($gametype=="wedding") { @@ -739,18 +757,34 @@ function can_call($what,$hash) return 0; }; + /* now check if the call is allowed depending on the rule set + */ switch ($RULES["call"]) { case "1st-own-card": - if( 4-($what/30) >= 12 - ($NRcards + $offset)) + /* calls can be made before/while you play your card... + * first card = 120, second card = 90, etc. + */ + if( 4-($what/30) == 12 - ($NRcards + $offset)) + return 2; + if( 4-($what/30) > 12 - ($NRcards + $offset)) return 1; break; case "5th-card": - if( 27+4*($what/30) <= $NRallcards + $offset*4) + /* you can make the first call anytime during the first trick + */ + if( 27+4*($what/30) == $NRallcards + $offset*4) + return 2; + if( 27+4*($what/30) < $NRallcards + $offset*4) return 1; break; case "9-cards": + /* you can call 120 with 12 cards, 90 with 9 or more cards, 60 with 6 or more, etc. + * you can't skip a call though + */ + /* figure out last call + */ if($oldcall!=NULL && $pcall!=NULL) $mincall = ($oldcall>$pcall) ? $pcall : $oldcall; else if($oldcall!=NULL) @@ -760,26 +794,51 @@ function can_call($what,$hash) else $mincall = -1; - if( 12 <= ($NRcards + $offset)) + + if( 12 == ($NRcards + $offset)) + { + return 2; + } + else if( 12 < ($NRcards + $offset)) { return 1; } - else if ( 9 <= ($NRcards + $offset)) + else if ( 9 == ($NRcards + $offset)) + { + if( ($mincall>=0 && $mincall==120) ) + return 2; + } + else if ( 9 < ($NRcards + $offset)) { if( ($mincall>=0 && $mincall==120) ) return 1; } - else if ( 6 <= ($NRcards + $offset)) + else if ( 6 == ($NRcards + $offset)) + { + if( ($mincall>=0 && $mincall<=90 && $what<=60 ) ) + return 2; + } + else if ( 6 < ($NRcards + $offset)) { if( ($mincall>=0 && $mincall<=90 && $what<=60 ) ) return 1; } - else if ( 3 <= ($NRcards + $offset)) + else if ( 3 == ($NRcards + $offset)) + { + if( ($mincall>=0 && $mincall<=60 && $what<=30 ) ) + return 2; + } + else if ( 3 < ($NRcards + $offset)) { if( ($mincall>=0 && $mincall<=60 && $what<=30 ) ) return 1; } - else if ( 0 <= ($NRcards + $offset)) + else if ( 0 == ($NRcards + $offset)) + { + if( ($mincall>=0 && $mincall<=30 && $what==0 ) ) + return 2; + } + else if ( 0 < ($NRcards + $offset)) { if( ($mincall>=0 && $mincall<=30 && $what==0 ) ) return 1; @@ -822,7 +881,7 @@ function display_table () $call = $r[5]; $hash = $r[7]; $timezone = $r[8]; - $email = $r[9]; + $email = $r[9]; $wins = DB_get_number_of_tricks($gameid,$pos); date_default_timezone_set($defaulttimezone); $lastlogin = strtotime($r[6]); diff --git a/include/game.php b/include/game.php index 30abe7d..de19cab 100644 --- a/include/game.php +++ b/include/game.php @@ -1420,7 +1420,10 @@ switch($mystatus) $play = DB_get_cards_by_trick($trickid); $winner = get_winner($play,$gametype); /* returns the position */ - /* check if someone caught a fox */ + /* + * check if someone caught a fox + *******************************/ + /* first check if we should account for solos at all, * since it doesn't make sense in some games */ @@ -1453,7 +1456,10 @@ switch($mystatus) } } - /* check for karlchen (jack of clubs in the last trick)*/ + /* + * check for karlchen (jack of clubs in the last trick) + ******************************************************/ + /* same as for foxes, karlchen doesn't always make sense * check what kind of game it is and set karlchen accordingly */ $ok = 1; /* default: karlchen should be accounted for */ @@ -1478,7 +1484,10 @@ switch($mystatus) DB_query("INSERT INTO Score". " VALUES( NULL,NULL,$gameid,'$party1',$uid1,NULL,'karlchen')"); } - /* check for doppelopf (>40 points)*/ + /* + * check for doppelopf (>40 points) + ***********************************/ + $points = 0; foreach($play as $played) { @@ -1493,6 +1502,10 @@ switch($mystatus) " VALUES( NULL,NULL,$gameid,'$party1',$uid1,NULL,'doko')"); } + /* + * set winner (for this trick) + */ + if($winner>0) DB_query("UPDATE Trick SET winner='$winner' WHERE id='$trickid'"); else diff --git a/include/output.php b/include/output.php index 9e87de3..57b3152 100644 --- a/include/output.php +++ b/include/output.php @@ -247,30 +247,61 @@ function output_check_for_sickness($me,$mycards) function output_form_calls($me,$myparty) { - if( can_call(120,$me) ) + $highstart = ""; + $highend = ""; + + $tmp = can_call(120,$me); + if( $tmp ) + { + if($tmp==2) echo $highstart; + if($myparty=='re') + echo "re (120):"; + else if ($myparty=='contra') + echo "contra (120):"; + else + echo " re/contra (120):"; + echo " "; + if($tmp==2) echo $highend; + echo "
\n"; + } + $tmp = can_call(90,$me); + if( $tmp ) + { + if($tmp==2) echo $highstart; + echo " 90:". + " "; + if($tmp==2) echo $highend; + echo "
\n"; + } + $tmp = can_call(60,$me); + if( $tmp ) + { + if($tmp==2) echo $highstart; + echo " 60:". + " "; + if($tmp==2) echo $highend; + echo "
\n"; + } + $tmp = can_call(30,$me); + if( $tmp ) + { + if($tmp==2) echo $highstart; + echo " 30:". + " "; + if($tmp==2) echo $highend; + echo "
\n"; + } + $tmp = can_call(0,$me); + if( $tmp ) { - if($myparty=='re') - echo "re (120):"; - else if ($myparty=='contra') - echo "contra (120):"; - else - echo " re/contra (120):"; - echo "
"; + if($tmp==2) echo $highstart; + echo " 0:". + " "; + if($tmp==2) echo $highend; + echo "
\n". + " no call:". + "
"; } - if( can_call(90,$me) ) - echo " 90:". - "
"; - 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) @@ -301,7 +332,7 @@ function output_header() e-Doko - + diff --git a/index.php b/index.php index 9702800..d92f478 100644 --- a/index.php +++ b/index.php @@ -2,7 +2,7 @@ error_reporting(E_ALL); /* start a session, if it is not already running. - * This way people don't have to log in all the times. + * This way people don't have to log in all the times. * The session variables can also be read out from different * php scripts, so that the code can be easily split up across several files */ @@ -50,11 +50,11 @@ switch($action) require './include/reminder.php'; break; case 'logout': - require './include/logout.php'; + require './include/logout.php'; require './include/welcome.php'; break; case 'login': - require './include/login.php'; + require './include/login.php'; require './include/user.php'; break; case 'register': -- cgit v1.2.3-18-g5258 From 3851854ad07430dc62337d482e811bf9363480a5 Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Thu, 4 Feb 2010 20:19:18 -0800 Subject: BUGFIX: timestamp was not always updated when user made a move this happend when the user wasn't logged in, but made a move by using an email link for example. Should be fixed now. --- include/game.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/include/game.php b/include/game.php index de19cab..0a40bab 100644 --- a/include/game.php +++ b/include/game.php @@ -24,10 +24,6 @@ if(!$myid) global $GAME,$RULES,$CARDS; -/* the user has done something, update the timestamp */ -if(isset($_SESSION['id'])) - DB_update_user_timestamp($_SESSION['id']); - /* get some information from the DB */ $gameid = DB_get_gameid_by_hash($me); $myname = DB_get_name('hash',$me); @@ -288,6 +284,16 @@ display_table(); * play: game in progress * gameover: are we revisiting a game */ + +/* the user has done something, update the timestamp. Use $myid in + * active games and check for session-id in old games (myid might be wrong in that case) + */ +if($mystatus!='gameover') + DB_update_user_timestamp($myid); + else + if(isset($_SESSION['id'])) + DB_update_user_timestamp($_SESSION['id']); + switch($mystatus) { case 'start': -- cgit v1.2.3-18-g5258 From 3b407a98fe0243cef87fdd64aeb4f567cca41f40 Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Thu, 4 Feb 2010 20:25:16 -0800 Subject: BUGFIX: show correct name of all players, when looking at games of other players the name of the player who had the same cards wasn't displayed, instead "your cards where" was shown. --- include/game.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/game.php b/include/game.php index 0a40bab..e20ea9a 100644 --- a/include/game.php +++ b/include/game.php @@ -1962,7 +1962,15 @@ switch($mystatus) { $oldcards = DB_get_all_hand($me); $oldcards = mysort($oldcards,$gametype); - echo "Your cards were:
\n"; + + if(isset($_SESSION['id']) && $myid==$_SESSION['id']) + echo "Your cards were:
\n"; + else + { + $name = DB_get_name('userid',$myid); + echo "$name's were:
\n"; + } + foreach($oldcards as $card) display_card($card,$PREF['cardset']); -- cgit v1.2.3-18-g5258 From b76cddb9313d8a67e5d7e1830503b5775666238f Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Tue, 2 Feb 2010 22:37:27 -0800 Subject: NEW FEATURE: provide an RSS feed for each user showing in which games it's his turn the feed shows the same as the "It's your turn in these games" box. --- INSTALL | 1 + config.php_template | 2 + include/db.php | 20 ++++++++++ include/functions.php | 14 +++++++ include/output.php | 71 ++++++++++++++++++----------------- rss.php | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 176 insertions(+), 33 deletions(-) create mode 100644 rss.php diff --git a/INSTALL b/INSTALL index 86b65d4..0fada71 100644 --- a/INSTALL +++ b/INSTALL @@ -26,6 +26,7 @@ Installation $HOST: for example "http://localhost" $INDEX: the absolute web path to your index.php file e.g. "/mypath/index.php" $STATS: the absolute web path to your stats.php file e.g. "/mypath/stast.php" + $RSSS: the absolute web path to your rss.php file e.g. "/mypath/rss.php" database info: diff --git a/config.php_template b/config.php_template index 93e951c..a3e9e54 100644 --- a/config.php_template +++ b/config.php_template @@ -33,6 +33,8 @@ */ $INDEX = "/index.php"; $HOST = "http://www.example.com"; + $STATS = "/stats.php"; + $RSS = "/rss.php"; /* point this to a Wiki that explains the rules, etc (or use this one)*/ $WIKI = "http://wiki.nubati.net/index.php?title=EmailDoko"; diff --git a/include/db.php b/include/db.php index 882a1ad..55d97c9 100644 --- a/include/db.php +++ b/include/db.php @@ -498,6 +498,15 @@ function DB_update_game_timestamp($gameid) return; } +function DB_get_game_timestamp($gameid) +{ + $r = DB_query_array("SELECT mod_date FROM Game WHERE id=".DB_quote_smart($gameid)); + + if($r) + return $r[0]; + else + return NULL; +} function DB_update_user_timestamp($userid) { @@ -514,6 +523,17 @@ function DB_get_user_timestamp($userid) else return NULL; } + +function DB_get_user_creation_date($userid) +{ + $r = DB_query_array("SELECT create_date FROM User WHERE id=".DB_quote_smart($userid)); + + if($r) + return $r[0]; + else + return NULL; +} + function DB_get_user_timezone($userid) { $r = DB_query_array("SELECT timezone FROM User WHERE id=".DB_quote_smart($userid)); diff --git a/include/functions.php b/include/functions.php index eca0155..33da9ef 100644 --- a/include/functions.php +++ b/include/functions.php @@ -1384,4 +1384,18 @@ function cancel_game($why,$gameid) return; } +function get_user_token($userid) +{ + + $token = NULL; + + $date = DB_get_user_creation_date($userid); + $name = DB_get_name('userid',$userid); + + if($date && $name) + $token = md5("token".$name.$date); + + return $token; +} + ?> diff --git a/include/output.php b/include/output.php index 57b3152..61fef60 100644 --- a/include/output.php +++ b/include/output.php @@ -380,39 +380,44 @@ function output_footer() function output_status() { - global $defaulttimezone,$INDEX,$WIKI; - if(isset($_SESSION["name"])) - { - $name = $_SESSION["name"]; - - /* logout info */ - echo "\n
\n"; - echo $name,"\n"; - echo " | mypage \n"; - echo " | settings\n"; - echo " | new game\n"; - echo " | statistics\n"; - echo " | wiki\n"; - echo " |    logout\n"; - echo "
\n"; - - /* last logon time */ - $myid = DB_get_userid("name",$name); - $zone = DB_get_user_timezone($myid); - - $time = DB_get_user_timestamp($myid); - date_default_timezone_set($defaulttimezone); - $unixtime = strtotime($time); - date_default_timezone_set($zone); - - echo "
last login: ".date("r",$unixtime)."
\n"; - } - else - { - echo "\n
\n"; - echo "login\n"; - echo "
\n"; - } + global $defaulttimezone, $INDEX, $WIKI, $RSS; + + if(isset($_SESSION["name"])) + { + $name = $_SESSION["name"]; + + /* last logon time */ + $myid = DB_get_userid("name",$name); + $zone = DB_get_user_timezone($myid); + + $time = DB_get_user_timestamp($myid); + date_default_timezone_set($defaulttimezone); + $unixtime = strtotime($time); + date_default_timezone_set($zone); + + /* rss token */ + $token = get_user_token($myid); + + /* logout info */ + echo "\n
\n"; + echo $name,"\n"; + echo " | mypage \n"; + echo " | settings\n"; + echo " | new game\n"; + echo " | statistics\n"; + echo " | wiki\n"; + echo " | rss\n"; + echo " |    logout\n"; + echo "
\n"; + + echo "
last login: ".date("r",$unixtime)."
\n"; + } + else + { + echo "\n
\n"; + echo "login\n"; + echo "
\n"; + } return; } diff --git a/rss.php b/rss.php new file mode 100644 index 0000000..6dbb6e6 --- /dev/null +++ b/rss.php @@ -0,0 +1,101 @@ + + +E-DoKo Feed +Know when it is your turn +\n"; +echo "\n"; +$date = DB_query_array("Select create_date from User order by create_date ASC limit 1"); +$date = $date[0]; +$timestamp = strtotime($date); +echo "tag:".$_SERVER['SERVER_NAME'].",".date("Y-m-d",$timestamp).":$INDEX\n"; +echo "".date(DATE_ATOM)."\n"; +echo "\n"; +echo "$ADMIN_NAME $date $timestamp\n"; +echo "$ADMIN_EMAIL\n"; +echo "\n\n"; + + + /* output the entries */ + + + $result = DB_query("SELECT Hand.hash,Hand.game_id,Game.player from Hand". + " LEFT JOIN Game On Hand.game_id=Game.id". + " WHERE Hand.user_id='$id'". + " AND ( Game.player='$id' OR ISNULL(Game.player) )". + " AND ( Game.status='pre' OR Game.status='play' )". + " ORDER BY Game.session" ); + + while( $r = DB_fetch_array($result)) + { + echo "\n"; + echo "game ".DB_format_gameid($r[1])."\n"; + $url=$INDEX."?action=game&me=".$r[0]; + echo "\n"; + $date = DB_get_game_timestamp($r[1]); + $timestamp = strtotime($date); + $date = date("Y-m-d",$timestamp); + echo "tag:doko.nubati.net,$date:$url\n"; + echo "".date(DATE_ATOM,$timestamp)."\n"; + echo "Please use the link to access the game.\n"; + echo "\n\n"; + } + +?> + \ No newline at end of file -- cgit v1.2.3-18-g5258