diff --git a/default.css b/default.css index 30111d7..feb3d19 100644 --- a/default.css +++ b/default.css @@ -10,6 +10,20 @@ body { font-family: verdana, lucida, arial, helvetica, sans-serif; } +table { + margin:auto; + border-collapse:collapse; +} +tr{ + +} +td { + border: 1px solid #5e5e5e; + padding: 5px; + text-align: center; + +} + #main { background: none; width: 600px; @@ -30,10 +44,12 @@ body { #main h1 { font-size: 2em; + } #main h2 { font-size: 1.5em; + margin-top:50px; } #main h3 { @@ -212,6 +228,12 @@ body { /* ----------------------=-=-=- Forms -=-=-=--------------------- */ /* pretty forms and buttons */ +input { + /* top right bottom left */ + + border: 0px; + } + input#text { border: 1px solid #333333; color: #333333; @@ -247,11 +269,7 @@ input#submit:hover { } -input { - padding: 0px; - border: 0px; - margin: 0px; - } + /*input#goban:hover { padding: 0px; @@ -268,96 +286,3 @@ input { #words form p { text-align: center; } - -/* ------------=-=-=- language selection -=-=-=------------- */ - -#lang { - position: fixed; - float: right; - right: 5px; - top: 5px; - text-align: right; - } - -#lang a { - color: #acacac; - font-family: verdana, lucida, arial, helvetica, sans-serif; - font-size: smaller; - } - -#lang a:hover { - color: #707070; - } - - -/* ------------=-=-=- documentation -=-=-=------------- */ - -#doc ol,ul li { - text-align: left; - margin-left: 20px; - } - -#doc dl dt { - text-align: left; - margin-left: 20px; - font-style: italic; - } - -#doc h1 { - padding-top: 25px; -} - -#doc h2 { - padding-top: 20px; -} - -#doc h3 { - padding-top: 10px; - } - -/* ------------=-=-=- special things -=-=-=------------- */ - -#partition_info p { - margin-left: 10%; - margin-right: 10%; - font-family: monospace - } - -#words a.popup { - line-height: inherit; - color: inherit; - text-decoration: inherit; - font-weight: inherit; - font-size: inherit; - } - -#words a.popup:hover { - text-decoration: inherit; - } - -#words a.popup span { - display: none; - position: fixed; - bottom: 10px; - left: 9%; - width: 80%; - background: #f0f0f0; - padding: 10px; - border-color: #e0e0e0; - border-width: 2px; - border-style: solid; - margin: 0; - } - -#words a.popup:hover span { - display: inline; - } - -#words a.popup span p { - text-align: left; - } - -#words a.popup span h3 { - color: #909090; - margin-top: 0px; - } diff --git a/deletegame.py b/deletegame.py index 5fef7eb..8dea3c2 100644 --- a/deletegame.py +++ b/deletegame.py @@ -31,6 +31,7 @@ def main(req,form): #free game slots of players for player in players: gameslot = get_game_slot_of_game(player,gamename) + helper.debug(req,form,"delete: got %s as gameslot." % gameslot) if gameslot != "": psql.set_game_slot(player,gameslot,"") diff --git a/gamecreation.py b/gamecreation.py index b4983ed..0e34aab 100644 --- a/gamecreation.py +++ b/gamecreation.py @@ -20,6 +20,7 @@ def display_game_creation_form(req,sessionid,username):
Player One (Black): %s
Player Two (White): %s
Goban Size: %s fields
+Optional name for game:
@@ -39,11 +40,16 @@ def process_creation_form(req,form): player1 = form["player1"] player2 = form["player2"] username = form["username"] + try: + description = form["description"] + except: + description = "" + helper.debug(req,form,"game creation: will use '%s' as description." % description) #check if at least one of the players is the current user if (player1 == username) or (player2 == username): #create game - gamename = psql.create_goban_table(player1,player2,int(form["gobansize"])) + gamename = psql.create_goban_table(player1,player2,int(form["gobansize"]),description) #update entries for player one and player two for player in [player1,player2]: gameslot = psql.get_free_game_slot(player) diff --git a/goban.py b/goban.py index 714d912..887326b 100755 --- a/goban.py +++ b/goban.py @@ -135,6 +135,7 @@ def set_stone(gobandict, position,req,form): #write new sgf file into database psql.update_goban_table_field(name,"x1","sgf",new_sgf) psql.update_turn_number(name,turn+1) + psql.set_time(name) return "" else: #move not ok return "This is not a legal move (says Gnugo)." diff --git a/helper.py b/helper.py index 063a607..9ec6b5f 100644 --- a/helper.py +++ b/helper.py @@ -1,4 +1,4 @@ -import string,re +import string,re,time DEBUG = 1 @@ -101,12 +101,39 @@ def dict_coords_to_gnugo_coords(coords,size): return letter+str(digit) +def format_time(mytime): + """ + gets output of time.time() + formats it nicely and returns as string. + """ + acttime = int(time.time()) + if mytime == None: + retstring = "" + elif acttime-mytime<86400: #given time is less than 24h ago + tmp = acttime-mytime + hour = int(tmp/3600) + minute = int((tmp-hour*3600)/60) + if hour == 0: + retstring = "%dm ago" % (minute) + else: + retstring = "%dh %dm ago" % (hour,minute) + else: + mytime = int(mytime) + retstring = time.strftime("%Y-%m-%d %H:%M",time.gmtime(mytime)) + return retstring +def clean_list(l): + #removing None-entries + clean = [] + for item in l: + if (item != "None") and (item != None): + clean.append(item) + return clean + - def test(): print dict_coords_to_gnugo_coords((6,5),7) - + print format_time(time.time()-20000) if __name__ == "__main__": diff --git a/init_webgo.py b/init_webgo.py index 3e0113f..18e2e7b 100755 --- a/init_webgo.py +++ b/init_webgo.py @@ -9,13 +9,14 @@ def clear(): def create(): #psql.create_goban_table("gast","gast2",9) psql.create_user_table() - psql.add_webgo_user("gast","gast") - psql.add_webgo_user("gast2","gast2") + #psql.add_webgo_user("gast","gast") + #psql.add_webgo_user("gast2","gast2") def main(): clear() create() - - \ No newline at end of file + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/login.py b/login.py index 36d7b72..4a29c36 100755 --- a/login.py +++ b/login.py @@ -1,4 +1,5 @@ import psql,init_webgo,helper,gamecreation +from sets import Set as set from mod_python import * def process_form(req,form): @@ -42,29 +43,47 @@ def game_overview_form(req,form): username = form["username"] sessionid = form["sessionid"] + data = helper.header()+ """