Mercurial > hg > rlgallery-misc
annotate web/recent.cgi @ 35:6592cdd1fceb
Add a high score CGI script.
/scoring/high.cgi shows a score list, with a configurable length,
offset, and game list.
| author | John "Elwin" Edwards | 
|---|---|
| date | Fri, 03 Jan 2014 11:11:07 -0500 | 
| parents | 25843238434a | 
| children | 44e8aaa20d02 | 
| rev | line source | 
|---|---|
| 30 | 1 #!/usr/bin/python3 | 
| 
7
 
64272fc2350c
Begin importing the website.
 
John "Elwin" Edwards <elwin@sdf.org> 
parents:  
diff
changeset
 | 
2 # CGI script creating page of recent games | 
| 
 
64272fc2350c
Begin importing the website.
 
John "Elwin" Edwards <elwin@sdf.org> 
parents:  
diff
changeset
 | 
3 | 
| 
 
64272fc2350c
Begin importing the website.
 
John "Elwin" Edwards <elwin@sdf.org> 
parents:  
diff
changeset
 | 
4 import sys | 
| 
 
64272fc2350c
Begin importing the website.
 
John "Elwin" Edwards <elwin@sdf.org> 
parents:  
diff
changeset
 | 
5 import time | 
| 
33
 
25843238434a
Change the Python module's name back to rlgall.
 
John "Elwin" Edwards 
parents: 
30 
diff
changeset
 | 
6 import rlgall | 
| 
7
 
64272fc2350c
Begin importing the website.
 
John "Elwin" Edwards <elwin@sdf.org> 
parents:  
diff
changeset
 | 
7 | 
| 30 | 8 # It is assumed that sys.stdout uses UTF-8 encoding. If this is not the case, | 
| 9 # configure the Web server to set the LC_CTYPE environment variable to a UTF-8 | |
| 10 # locale. | |
| 11 | |
| 
7
 
64272fc2350c
Begin importing the website.
 
John "Elwin" Edwards <elwin@sdf.org> 
parents:  
diff
changeset
 | 
12 # The required header | 
| 30 | 13 sys.stdout.write("Content-Type: text/html; charset=utf-8\r\n\r\n") | 
| 
7
 
64272fc2350c
Begin importing the website.
 
John "Elwin" Edwards <elwin@sdf.org> 
parents:  
diff
changeset
 | 
14 # The top of the page | 
| 
 
64272fc2350c
Begin importing the website.
 
John "Elwin" Edwards <elwin@sdf.org> 
parents:  
diff
changeset
 | 
15 sys.stdout.write(rlgall.phead.format("Recent Games")) | 
| 
 
64272fc2350c
Begin importing the website.
 
John "Elwin" Edwards <elwin@sdf.org> 
parents:  
diff
changeset
 | 
16 sys.stdout.write(rlgall.ptop); | 
| 
 
64272fc2350c
Begin importing the website.
 
John "Elwin" Edwards <elwin@sdf.org> 
parents:  
diff
changeset
 | 
17 sys.stdout.write(rlgall.navtop.format("Recent")); | 
| 
 
64272fc2350c
Begin importing the website.
 
John "Elwin" Edwards <elwin@sdf.org> 
parents:  
diff
changeset
 | 
18 sys.stdout.write(rlgall.pti.format("Recent Expeditions")) | 
| 
 
64272fc2350c
Begin importing the website.
 
John "Elwin" Edwards <elwin@sdf.org> 
parents:  
diff
changeset
 | 
19 | 
| 
 
64272fc2350c
Begin importing the website.
 
John "Elwin" Edwards <elwin@sdf.org> 
parents:  
diff
changeset
 | 
20 for game in rlgall.gamelist: | 
| 
 
64272fc2350c
Begin importing the website.
 
John "Elwin" Edwards <elwin@sdf.org> 
parents:  
diff
changeset
 | 
21 game.tablerecent(sys.stdout) | 
| 
 
64272fc2350c
Begin importing the website.
 
John "Elwin" Edwards <elwin@sdf.org> 
parents:  
diff
changeset
 | 
22 | 
| 
 
64272fc2350c
Begin importing the website.
 
John "Elwin" Edwards <elwin@sdf.org> 
parents:  
diff
changeset
 | 
23 sys.stdout.write(rlgall.pend) | 
| 
 
64272fc2350c
Begin importing the website.
 
John "Elwin" Edwards <elwin@sdf.org> 
parents:  
diff
changeset
 | 
24 exit() | 
