Skip to content

Commit

Permalink
Navigation complete, but no content other than functional page elements.
Browse files Browse the repository at this point in the history
  • Loading branch information
nugget committed Feb 23, 2012
1 parent 64134c6 commit 97cd686
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 18 deletions.
1 change: 1 addition & 0 deletions packages/ergkeeper/runkeeper.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ proc runkeeper_bind_user {token} {

set sql "UPDATE sessions SET user_id = $user_id WHERE session = [pg_quote $::session(session)]"
sql_exec $::db $sql
set ::session(user_id) $user_id
}

proc runkeeper_json_post {method body} {
Expand Down
19 changes: 11 additions & 8 deletions packages/ergkeeper/web.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,27 @@ proc page_head {{title "ErgKeeper"}} {

set menu [list /about About /privacy Privacy]

foreach {uri label} {/about About /privacy Privacy /code "Source Code"} {
foreach {uri label} {/about About /upload "Upload" /chooser "Post" /privacy Privacy /code "Source Code"} {
puts "<a href=\"$uri\" class=\"topmenu\">$label</a> "
}

#if {[info exists ::session(user_id)] && $::session(user_id) != ""} {
# if {[info exists ::rkprofile(small_picture)]} {
# puts "<div class=\"profile_pic\"><img src=\"$::rkprofile(small_picture)\" /></div>"
# }
# puts "<p>Logout</p>"
#}
if {[info exists ::user(id)]} {
if {[info exists ::rkprofile(small_picture)]} {
set img_url $::rkprofile(small_picture)
} else {
set img_url "/images/userpic.jpg"
}
puts "<a href=\"/logout\" class=\"topuser\">Logout (<img class=\"topuser\" height=\"20\" width=\"20\" src=\"$img_url\" /> $::rkprofile(name))</a>"
}

puts "</div>"
puts "<div class=\"body\">"
}

proc page_foot {} {
puts "</div>"

if {1} {
if {0} {
puts "<p>debug:</p>"
foreach a {::session ::user ::rkuser ::rkprofile} {
if {[info exists $a]} {
Expand Down
12 changes: 12 additions & 0 deletions webroot/about.rvt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?
package require ergkeeper

page_init
page_response
page_head

require_login

page_foot
page_term
?>
12 changes: 12 additions & 0 deletions webroot/code.rvt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?
package require ergkeeper

page_init
page_response
page_head

require_login

page_foot
page_term
?>
29 changes: 28 additions & 1 deletion webroot/css/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ div.footer {
bottom: 0px;
margin-bottom: 0;
padding: 4;
width: 100%;
left: 0;
right: 0;
font-size: x-small;
text-align: center;
border-top: 2px solid black;
Expand All @@ -34,11 +35,37 @@ a.topmenu {
color: #ffffff;
padding: 4px 8px;
}

a.topmenu:hover {
background-color: #3280c2;
}

a.topuser {
font-family: Georgia, Tahoma, sans-serif;
font-weight: bold;
background-color: #000000;
border: 1px solid black;
color: #ffffff;
padding: 4px 8px;
position: absolute;
right: 8;
top: 8;
font-size: 12pt;
text-decoration: none;
}
a.topuser:hover {
background-color: #3280c2;
}
img.topuser {
height: 10pt;
width: 10pt;
}

div.body {
margin: 8;
}

div.userinfo {
align: center;
border: 1px solid black;
}
7 changes: 5 additions & 2 deletions webroot/index.rvt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
page_response
page_head

puts "<h1>Welcome to ErgKeeper</h1>"

puts "<p>"
puts "</p>"

if {![info exists ::user(id)]} {
puts [runkeeper_login_button]
page_foot
page_term
}

page_foot
Expand Down
8 changes: 5 additions & 3 deletions webroot/login.rvt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
package require ergkeeper

page_init

page_response
load_env

set details "Unknown error"

Expand All @@ -15,9 +13,13 @@
if {[string is true $success]} {
runkeeper_bind_user $token

headers set Location http://ergkeeper.com/
headers set Location http://ergkeeper.com/moocow

page_head
puts "<p>Successful login!</p>"
page_foot
page_term

}
}

Expand Down
10 changes: 6 additions & 4 deletions webroot/logout.rvt
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
page_init

if {[info exists ::session(session)]} {
set sql "UPDATE sessions SET deleted = current_timstamp at time zone 'utc' WHERE session = [pg_quote $::session(session)]"
set sql "UPDATE sessions SET deleted = current_timestamp at time zone 'utc' WHERE session = [pg_quote $::session(session)]"
sql_exec $::db $sql
cookie set ergkeeper_session "" -path "/" -days -1
}

page_response
load_env
unset -nocomplain ::user ::session ::rkuser ::rkprofile

page_head

puts "<h1>Logout Successful</h1>"

puts "<p>You have been successfully logged out of the ErgKeeper site</p>"

page_foot

Expand Down
12 changes: 12 additions & 0 deletions webroot/privacy.rvt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?
package require ergkeeper

page_init
page_response
page_head

require_login

page_foot
page_term
?>

0 comments on commit 97cd686

Please sign in to comment.