From 5ccd80c4d6de5f88f29c83faf0a568534c2f53a8 Mon Sep 17 00:00:00 2001
From: Bernie Innocenti <bernie@codewiz.org>
Date: Tue, 15 Nov 2011 22:42:33 -0500
Subject: [PATCH] Changes from codewiz.org wiki

---
 sys/EditPage         |  8 +++----
 sys/geekigeeki.css   | 50 +++++++++++++++++++++++++++++++++-----------
 sys/macros/CgiVar.py |  7 ++++++-
 3 files changed, 48 insertions(+), 17 deletions(-)

diff --git a/sys/EditPage b/sys/EditPage
index b33b583..47ab7d1 100644
--- a/sys/EditPage
+++ b/sys/EditPage
@@ -1,12 +1,12 @@
-**Editing <<HttpGet|q>> for <<CgiVar|REMOTE_USER>> from <<CgiVar|REMOTE_HOST>>**
+Editing **<<CgiVar|QUERY_STRING>>** for **<<CgiVar|REMOTE_USER>>** from **<<CgiVar|REMOTE_HOST>>**:
 <div class="editor">
-<form method="post" enctype="multipart/form-data" action="<<HttpGet|q>>" >
+<form method="post" enctype="multipart/form-data" action="<<CgiVar|SCRIPT_NAME>>/<<CgiVar|QUERY_STRING>>" >
 <input type="hidden" name="a" value="edit">
 <input type="hidden" name="q" value="<<HttpGet|q>>">
-<textarea wrap="off" autofocus="true" spellcheck="true" id="editor" name="savetext" rows="17" cols="100" accesskey="e"><<EDIT_BODY>></textarea>
+<textarea wrap="off" autofocus="true" spellcheck="true" class="editor" name="savetext" rows="17" cols="100" accesskey="e"><<EDIT_BODY>></textarea>
 <label for="file" accesskey="u">Or upload a file:</label> <input type="file" name="file" value="<<HttpPost|file>>" />
 \\
-<input type="input" id="editor" name="changelog" value="Edit page <<HttpGet|q>>" accesskey="c" />
+<label for="changelog" accesskey="s"><u>S</u>ummary:</label>&nbsp;<input type="text" class="changelog" name="changelog" value="Edit page <<CgiVar|QUERY_STRING>>" accesskey="c" />
 \\
 <input type="submit" name="save" value="Save" accesskey="s" />
 <input type="submit" name="preview" value="Preview" accesskey="p" />
diff --git a/sys/geekigeeki.css b/sys/geekigeeki.css
index a0263ca..106fabc 100644
--- a/sys/geekigeeki.css
+++ b/sys/geekigeeki.css
@@ -15,7 +15,10 @@ body {
 a { color: #1010FF; }
 a:visited { color: #501080; }
 a.nonexistent { color: #D04040; }
-a.navlink { color: #000088; font-size: smaller; font-weight: bold}
+a.navlink, a.login { font-size: smaller; font-weight: bold; text-decoration: none; }
+a.navlink:hover, a.login:hover { text-decoration: underline; }
+a.navlink { color: #000088; }
+a.login { color: #bb0000; }
 a.external { font-style: italic; }
 a.heading { text-decoration: none; color: #aaaaaa; font-size: smaller; }
 
@@ -24,7 +27,7 @@ h1 {
 	font-weight: bold;
 	color: #3377FF;
 	border: #5599EE;
-	background-color: #C2E2FF;
+	background-color: #D0F0FF;
 	clear: both;
 
 	margin-bottom: 0.2em;
@@ -167,7 +170,7 @@ div.nav {
 	background-color: #aaccee;*/
 	border-color: #888888;
 	background-color: #cccccc;
-	border-style: solid;
+	border-style: solid
 	border-top-width: 0px;
 	border-bottom-width: 2px;
 	border-left-width: 0px;
@@ -182,13 +185,22 @@ div.nav {
 	margin-right:	0px;
 }
 
-.nav hr {
-	display: none;
+.nav li {
+	display: inline;
 }
 
-.nav .login {
-	font-size: small;
-	color: red;
+.nav ul
+{
+	list-style-type: none;
+	margin: 0;
+	padding: 0;
+	padding-top: 6px;
+	padding-bottom: 6px;
+}
+
+
+.nav hr {
+	display: none;
 }
 
 #footer div {
@@ -337,13 +349,14 @@ pre.notice {
 	margin: 0px;
 }
 
-#editor {
+.editor input[type='text'], .editor textarea {
 	font-family: monospace;
-	width: 100%;
 	color: black;
 	background-color: white;
 	border: 1px solid #8cacbb;
 }
+.editor textarea.editor { width: 100%; }
+.editor input.changelog { width: 50%; }
 
 /* thumbnails */
 
@@ -395,6 +408,19 @@ div .innerthumb {
 }
 
 @media print {
- #footer { display: none }
- .nav { display: none }
+	body {
+		background: white;
+		font-size: 12pt;
+	}
+	h1 { font-size: 14pt; }
+	h2 { font-size: 13pt; }
+	h3 { font-size: 12pt; border: none; }
+	h4 { font-size: 12pt; border: none; }
+	h5 { font-size: 12pt; border: none; }
+	a { text-color: #225; text-decoration: underline; }
+	.heading:link, .heading:visited { display: none; }
+	#footer { display: none; }
+	.nav { display: none; }
+	.noprint { display: none; }
+	div.wiki { font-size: smaller; }
 }
diff --git a/sys/macros/CgiVar.py b/sys/macros/CgiVar.py
index c2ba707..807662c 100644
--- a/sys/macros/CgiVar.py
+++ b/sys/macros/CgiVar.py
@@ -1,9 +1,14 @@
 #acl bernie:read,write All:read
 
+#FIXME: couldn't we just return any env variable?
+#       Would there be any security issues?
 def _macro_CgiVar(*args, **kvargs):
+    if args[1].startswith('HTTP_'):
+        return os.environ.get(args[1], '')
     return {
+        'SCRIPT_NAME': script_name(),
         'REMOTE_USER': remote_user(),
         'REMOTE_HOST': get_hostname(remote_host()),
         'REMOTE_ADDR': remote_host(),
-        'QUERY_STRING': relative_url(query_string()),
+        'QUERY_STRING': query_string(),
     }[args[1]]
-- 
2.34.1