aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2009-11-20 16:28:40 +0100
committerBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2009-11-20 16:28:40 +0100
commitd5c5f1816037817117ed759d1954bf17780122cb (patch)
tree690132da3983dd2abe7e6494be83de1feb80fcd7
parent00183811523468d9571d9da34bbe1356528dacae (diff)
fix charset settings
-rw-r--r--charset.rb9
-rwxr-xr-xcustomize.rb23
2 files changed, 23 insertions, 9 deletions
diff --git a/charset.rb b/charset.rb
index c208dd6..1dfef01 100644
--- a/charset.rb
+++ b/charset.rb
@@ -18,7 +18,7 @@
############################################################################
if ($cgi.include?("utf") || $cgi.cookies["utf"][0]) && !$cgi.include?("ascii")
- expiretime = Time.now+1*60*60*24*365
+ USEUTF = true
YES = CGI.escapeHTML('✔')
NO = CGI.escapeHTML('✘')
@@ -33,7 +33,7 @@ if ($cgi.include?("utf") || $cgi.cookies["utf"][0]) && !$cgi.include?("ascii")
EDIT = CGI.escapeHTML("✍")
DELETE = CGI.escapeHTML("⌧")
else
- expiretime = Time.now-1*60*60*24*36
+ USEUTF = false
YES = CGI.escapeHTML('OK')
NO = CGI.escapeHTML('NO')
@@ -49,6 +49,5 @@ else
DELETE = CGI.escapeHTML("delete")
end
-UTFCHARS = [YES,NO,MAYBE,UNKNOWN,YEARBACK,MONTHBACK,MONTHFORWARD,YEARFORWARD,EDIT,DELETE]
-
-$html.add_cookie("utf","true","/",expiretime)
+UTFCHARS = CGI.escapeHTML("✔✘↞←→↠✍⌧")
+$html.add_cookie("utf","true","/",Time.now + (1*60*60*24*365 * (USEUTF ? 1 : -1 )))
diff --git a/customize.rb b/customize.rb
index d881965..a976452 100755
--- a/customize.rb
+++ b/customize.rb
@@ -40,10 +40,25 @@ $html << "<h1>Customize Personal Settings</h1>"
$html << <<CHARSET
<div id='charset'>
<h2>Charset</h2>
-<ul>
-<li><a href='?utf' style='text-decoration:none'>If you see all these characters: #{UTFCHARS} you can safely change the charset to UTF-8</a></li>
-<li><a href='?ascii' style='text-decoration:none'>Change Charset to plain ASCII</a></li>
-</ul>
+<table>
+ <tr>
+ <th>Current Setting</th>
+ <th>Description</th>
+ </tr>
+CHARSET
+[["Use special characters (#{UTFCHARS})","utf"],
+ ["Use normal strings","ascii"]].each{|description,href|
+ selected = href == (USEUTF ? "utf" : "ascii")
+ $html << "<tr><td>"
+ $html << "X" if selected
+ $html << "</td><td>"
+ $html << "<a href='?#{href}'>" unless selected
+ $html << description
+ $html << "</a>" unless selected
+ $html << "</td></tr>"
+ }
+$html << <<CHARSET
+</table>
</div>
CHARSET