aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcustomize.rb23
-rwxr-xr-xparticipate.rb2
-rw-r--r--poll.rb2
3 files changed, 19 insertions, 8 deletions
diff --git a/customize.rb b/customize.rb
index 8a9231a..bad79c1 100755
--- a/customize.rb
+++ b/customize.rb
@@ -32,10 +32,13 @@ $html.header["Cache-Control"] = "no-cache"
$html.add_css("../dudle.css")
-$html << "<body>"
-$html << Dudle::tabs("Customize")
-$html << "<div id='main'>"
-$html << "<h1>Customize Personal Settings</h1>"
+$html << <<END
+<body>
+#{Dudle::tabs("Customize")}
+<div id='main'>
+<h1>Customize Personal Settings</h1>
+You need cookies enabled in order to personalize your settings.
+END
$html << <<CHARSET
<div id='charset'>
@@ -77,13 +80,21 @@ $html << <<CHARSET
</div>
CHARSET
+
+username = $cgi.cookies["username"][0]
+if $cgi.include?("username")
+ username = $cgi["username"]
+ $html.add_cookie("username",username,"/",Time.now + 1*60*60*24*365)
+end
+
+
$html << <<CHARSET
<div id='config_user'>
<h2>Default Username</h2>
-<form method='post' action=''>
+<form method='GET' action=''>
<div>
<label for=''>Username: </label>
- <input id='' size='16' type='text' value="" name='default_username' />
+ <input id='' size='16' type='text' value="#{username}" name='username' />
<input type='submit' value='Save' />
</div>
</form>
diff --git a/participate.rb b/participate.rb
index 6efca03..3bc6358 100755
--- a/participate.rb
+++ b/participate.rb
@@ -76,7 +76,7 @@ $html << <<TABLE
<h1>#{table.name}</h1>
<div id='polltable'>
<form method='post' action='.'>
- #{table.to_html($cgi['edituser'])}
+ #{table.to_html($cgi.include?('edituser') ? $cgi['edituser'] : $cgi.cookies["username"][0] )}
</form>
</div>
TABLE
diff --git a/poll.rb b/poll.rb
index 97ae081..d03d584 100644
--- a/poll.rb
+++ b/poll.rb
@@ -60,7 +60,7 @@ class Poll
end
end
- def to_html(edituser = "", showparticipation = true)
+ def to_html(edituser, showparticipation = true)
ret = "<table border='1'>\n"
ret += @head.to_html