3 /* functions which only ouput html */
5 function display_links($email,$password)
8 echo "<div class=\"bug\">\n".
9 "Report bugs in the <a href=\"". $wiki."\">wiki</a>.<hr />\n";
10 output_link_to_user_page($email,$password);
15 function output_link_to_user_page($email,$password)
17 echo "<div class=\"over\">\n";
18 echo "<form action=\"index.php\" method=\"post\">\n";
19 echo " <input type=\"hidden\" name=\"email\" value=\"".$email."\" />\n";
20 echo " <input type=\"hidden\" name=\"password\" value=\"".$password."\" />\n";
21 echo " <input type=\"submit\" class=\"submitbutton\" value=\"go to my user page\" />\n";
28 function output_user_settings($email,$password)
30 echo "<div class=\"useroptions\">\n";
31 echo "<h4> Settings </h4>\n";
32 echo "<form action=\"index.php\" method=\"post\">\n";
33 echo " <input type=\"hidden\" name=\"email\" value=\"".$email."\" />\n";
34 echo " <input type=\"hidden\" name=\"password\" value=\"".$password."\" />\n";
35 echo " <input type=\"submit\" class=\"submitbutton\" name=\"passwd\" value=\"change password\" /> <br />\n";
37 echo "<form action=\"index.php\" method=\"post\">\n";
38 echo " <input type=\"hidden\" name=\"email\" value=\"".$email."\" />\n";
39 echo " <input type=\"hidden\" name=\"password\" value=\"".$password."\" />\n";
40 echo " <input type=\"hidden\" name=\"setpref\" value=\"englishcards\" />\n";
41 echo " <input type=\"submit\" class=\"submitbutton\" value=\"use english cards\" /> <br />\n";
43 echo "<form action=\"index.php\" method=\"post\">\n";
44 echo " <input type=\"hidden\" name=\"email\" value=\"".$email."\" />\n";
45 echo " <input type=\"hidden\" name=\"password\" value=\"".$password."\" />\n";
46 echo " <input type=\"hidden\" name=\"setpref\" value=\"germancards\" />\n";
47 echo " <input type=\"submit\" class=\"submitbutton\" value=\"use german cards\" /> <br />\n";
53 function output_register()
55 echo "IMPORTANT: passwords are going over the net as clear text, so pick an easy password. No need to pick anything complicated here ;)<br /><br />";
56 echo "TODO: convert timezone into a menu<br />\n";
57 echo "TODO: figure out a way to handle passwords <br />\n";
59 <form action="index.php" method="post">
61 <legend>Register</legend>
64 <td><label for="Rfullname">Full name:</label></td>
65 <td><input type="text" id="Rfullname" name="Rfullname" size="20" maxsize="30" /> </td>
67 <td><label for="Remail">Email:</label></td>
68 <td><input type="text" id="Remail" name="Remail" size="20" maxsize="30" /></td>
70 <td><label for="Rpassword">Password(will be displayed in cleartext on the next page):</label></td>
71 <td><input type="password" id="Rpassword" name="Rpassword" size="20" maxsize="30" /></td>
73 <td><label for="Rtimezone">Timezone:</label></td>
75 <input type="text" id="Rtimezone" name="Rtimezone" size="4" maxsize="4" value="+1" />
78 <td colspan="2"> <input type="submit" value="register" /></td>
86 function output_ask_for_new_game($playerA,$playerB,$playerC,$playerD,$oldgameid)
90 echo "Do you want to continue playing?(This will start a new game, with the next person as dealer.)\n";
91 echo "<form action=\"index.php\" method=\"post\">\n";
92 echo " <input type=\"hidden\" name=\"PlayerA\" value=\"$playerA\" />\n";
93 echo " <input type=\"hidden\" name=\"PlayerB\" value=\"$playerB\" />\n";
94 echo " <input type=\"hidden\" name=\"PlayerC\" value=\"$playerC\" />\n";
95 echo " <input type=\"hidden\" name=\"PlayerD\" value=\"$playerD\" />\n";
96 echo " <input type=\"hidden\" name=\"dullen\" value=\"".$RULES["dullen"]."\" />\n";
97 echo " <input type=\"hidden\" name=\"schweinchen\" value=\"".$RULES["schweinchen"]."\" />\n";
98 echo " <input type=\"hidden\" name=\"followup\" value=\"$oldgameid\" />\n";
99 echo " <input type=\"submit\" value=\"keep playing\" />\n";
105 function output_form_for_new_game($names)
109 <p>Please select four players (or use the randomly pre-selected names)</p>
110 <form action="index.php" method="post">
112 /* ask for player names */
113 foreach( array("PlayerA","PlayerB","PlayerC","PlayerD") as $player)
115 srand((float) microtime() * 10000000);
116 $randkey = array_rand($names);
117 $rand = $names[$randkey];
118 echo " Name: <select name=\"$player\" size=\"1\" /> \n";
119 foreach($names as $name)
123 echo " <option selected=\"selected\">$name</option>\n";
126 echo " <option>$name</option>\n";
132 <p> Some areas are grayed out which means that the rule is not implemented yet and therefore cannot be selected </p>
135 <li> <input type="radio" name="dullen" value="none" /> just normal non-trump </li>
136 <li> <input type="radio" name="dullen" value="firstwins" /> first ten of hearts wins the trick </li>
137 <li> <input type="radio" name="dullen" value="secondwins" checked="checked" /> second ten of hearts wins the trick </li>
140 <p> schweinchen (both foxes), only in normal games or silent solos:
142 <li> <input type="radio" name="schweinchen" value="none" checked="checked" /> none </li>
143 <li> <input type="radio" name="schweinchen" value="both" />
144 both become highest trump (automatic call at beginning of the game)
146 <li> <input type="radio" name="schweinchen" value="second" />
147 first one normal, second one becomes highest (call during the game) </li>
148 <li> <input type="radio" name="schweinchen" value="secondaftercall" disabled="disabled" />
149 second one become highest only in case re/contra was announced (not working yet)
154 <input type="submit" value="start game" />
159 function display_card($card,$dir="english")
161 /* cards are only availabl for the odd values, e.g. 1.png, 3.png, ...
162 * convert even cards to the matching odd value */
164 if( $card/2 - (int)($card/2) == 0.5)
165 echo "<img src=\"cards/".$dir."/".$card.".png\" alt=\"".card_to_name($card)."\" />\n";
167 echo "<img src=\"cards/".$dir."/".($card-1).".png\" alt=\"".card_to_name($card-1)."\" />\n";
172 function display_link_card($card,$dir="english",$type="card")
174 if( $card/2 - (int)($card/2) == 0.5)
175 echo "<div class=\"cardinput\"><input type=\"radio\" name=\"".$type."\" value=\"".$card."\" /><img src=\"cards/".$dir."/".$card.".png\" alt=\"\" /></div>\n";
177 echo "<div class=\"cardinput\" ><input type=\"radio\" name=\"".$type."\" value=\"".$card."\" /><img src=\"cards/".$dir."/".($card-1).".png\" alt=\"\" /></div>\n";
181 function check_for_sickness($me,$mycards)
184 <p> Solo will work, but the first player will not change. Nothing else implemented. </p>
186 <form action="index.php" method="post">
188 do you want to play solo?
189 <select name="solo" size="1">
190 <option selected="selected">No</option>
191 <option>trumpless</option>
192 <option>trump</option>
193 <option>queen</option>
194 <option>jack</option>
195 <option>club</option>
196 <option>spade</option>
197 <option>heart</option>
204 if(check_wedding($mycards))
206 echo " yes<input type=\"radio\" name=\"wedding\" value=\"yes\" checked=\"checked\" />";
207 echo " no <input type=\"radio\" name=\"wedding\" value=\"no\" /> <br />\n";
211 echo " no <input type=\"hidden\" name=\"wedding\" value=\"no\" /> <br />\n";
214 echo "do you have poverty?";
215 if(count_trump($mycards)<4)
217 echo " yes<input type=\"radio\" name=\"poverty\" value=\"yes\" checked=\"checked\" />";
218 echo " no <input type=\"radio\" name=\"poverty\" value=\"no\" /> <br />\n";
222 echo " no <input type=\"hidden\" name=\"poverty\" value=\"no\" /> <br />\n";
225 echo "do you have too many nines?";
226 if(count_nines($mycards)>4)
228 echo " yes<input type=\"radio\" name=\"nines\" value=\"yes\" checked=\"checked\" />";
229 echo " no <input type=\"radio\" name=\"nines\" value=\"no\" /> <br />\n";
233 echo " no <input type=\"hidden\" name=\"nines\" value=\"no\" /> <br />\n";
236 echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
237 echo "<input type=\"submit\" value=\"count me in\" />\n";
244 function check_want_to_play($me)
247 <form action="index.php" method="post">
248 Do you want to play a game of DoKo?
249 yes<input type="radio" name="in" value="yes" />
250 no<input type="radio" name="in" value="no" /> <br />
254 Do you want to get an email for every card played or only if it your move?
255 every card<input type="radio" name="update" value="card" />
256 only on my turn<input type="radio" name="update" value="turn" /> <br />
258 echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
260 echo "<input type=\"submit\" value=\"count me in\" />\n";
266 function output_home_page($pre,$game,$done)
269 <p> If you want to play a game of Doppelkopf, you found the right place ;) </p>
272 echo "<p> At the moment there are no games that are being started ";
274 echo "<p> At the moment there is one games that is being started ";
276 echo "<p> At the moment there are $pre games that are being started ";
281 echo " zero games that are ongoing. ";
283 echo " one game that is ongoing. ";
285 echo "$game games that are ongoing. ";
288 echo "No game has been completed on this server. </p>";
290 echo "One game has been completed on this server. </p>";
292 echo "$done games have been completed on this server. </p>";
295 <p> Please <a href="index.php?register">register</a>, in case you haven't done that yet <br />
296 or login with you email-address or name and password here:
298 <form action="index.php" method="post">
300 <legend>Login</legend>
303 <td><label for="email">Email:</label></td>
304 <td><input type="text" id="email" name="email" size="20" maxlength="30" /> </td>
306 <td><label for="password">Password:</label></td>
307 <td><input type="password" id="password" name="password" size="20" maxlength="30" /></td>
309 <td> <input type="submit" class="submitbutton" name="login" value="login" /></td>
310 <td> <input type="submit" class="submitbutton" name="forgot" value="Forgot your password?" /></td>
320 function output_header()
324 <!DOCTYPE html PUBLIC
325 "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
326 "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
327 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
329 <title>e-Doko</title>
330 <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
331 <link rel="stylesheet" type="text/css" href="css/standard.css" />
332 <script type="text/javascript">
334 if(document.getElementById){
337 if(document.getElementById("trick"+i))
338 document.getElementById("trick"+i).style.display = 'none';
340 document.getElementById("trick"+num).style.display = 'block';
343 function high_last(){
344 if(document.getElementById){
347 if(document.getElementById("trick"+i))
357 <body onload="high_last();">
359 <h1> Welcome to E-Doko <sup style="color:#888;">(beta)</sup> </h1>
368 function output_footer()
372 echo "<div class=\"footer\">\n";
373 echo "<p class=\"left\"> copyright 2006-2007 Arun Persaud <br />\n".
374 "Verwendung der [deutschen] Kartenbilder mit Genehmigung <br />der Spielkartenfabrik Altenburg GmbH,(c) ASS Altenburger <br />".
375 "- ASS Altenburger Spielkarten - Spielkartenfabrik Altenburg GmbH <br />".
376 "a Carta Mundi Company Email: info@spielkarten.com Internet: www.spielkarten.com</p>\n";
377 echo "<p class=\"right\"> Revision: $REV; <br /><a href=\"http://svn.nubati.net/emaildoko/trunk/\">".
378 "http://svn.nubati.net/emaildoko/trunk/</a> <br />".
379 "<a href=\"http://www.dreamhost.com/green.cgi\">".
380 "<img border=\"0\" alt=\"Green Web Hosting! This site hosted by DreamHost.\"".
381 "src=\"https://secure.newdream.net/green1.gif\" height=\"32\" width=\"100\" /></a>".