diff --git a/Makefile b/Makefile
index d644fd8..e6dd21d 100644
--- a/Makefile
+++ b/Makefile
@@ -26,6 +26,10 @@ target: $(PYC)
$(INSTALL) -d $(PYCDIR)/ctf
$(INSTALL) $(PYC) $(PYCDIR)/ctf
+ $(INSTALL) -d $(DESTDIR)/usr/lib/python2.6/site-packages/ctf
+ $(INSTALL) ctf/__init__.py $(DESTDIR)/usr/lib/python2.6/site-packages/ctf
+ $(INSTALL) ctf/config.py $(DESTDIR)/usr/lib/python2.6/site-packages/ctf
+
$(INSTALL) -d $(DESTDIR)/usr/sbin
$(INSTALL) ctfd.py $(DESTDIR)/usr/sbin
$(INSTALL) new-contest $(DESTDIR)/usr/sbin
diff --git a/ctf.css b/ctf.css
index 433b9c6..0d6ed28 100644
--- a/ctf.css
+++ b/ctf.css
@@ -7,7 +7,7 @@ html {
body {
font-family: sans-serif;
color: #fff;
- margin: 50px 0 0 100px;
+ margin: 50px 0 0 110px;
padding: 10px;
max-width: 700px;
}
@@ -33,7 +33,7 @@ h1:first-child:before {
/*** left side bar ***/
#navigation {
- position: fixed;
+ position: absolute;
background: #222;
opacity: 0.9;
top: 80px;
@@ -41,6 +41,11 @@ h1:first-child:before {
padding: 0;
}
+#navigation h3 {
+ font-size: 100%;
+ border-bottom: 2px solid #444;
+}
+
#navigation ul {
list-style: none;
padding: 0;
@@ -113,6 +118,27 @@ p {
color: #f4f4f4;
}
+hr {
+ border: 1px solid #444;
+}
+
+dt {
+ white-space: pre;
+ background-color: #333;
+ padding: 5px;
+ border: 2px solid green;
+ border-bottom: none;
+ font-weight: bold;
+}
+
+dd {
+ border: 2px solid green;
+ margin: 0px;
+ padding: 5px;
+ background-color: #282828;
+}
+
+
/**** special cases ****/
.wide {
diff --git a/ctf/config.py b/ctf/config.py
index 4bdfe25..e39eacc 100755
--- a/ctf/config.py
+++ b/ctf/config.py
@@ -77,7 +77,7 @@ def datafile(filename):
def url(path):
return base_url + path
-def start_html(title, hdr='', cls=''):
+def start_html(title, hdr='', cls='', links=[], links_title=None):
ret = []
if os.environ.get('GATEWAY_INTERFACE'):
ret.append('Content-type: text/html')
@@ -98,16 +98,24 @@ def start_html(title, hdr='', cls=''):
-
''' % {'title': title,
'css': css,
'hdr': hdr,
'base': base_url,
'class': cls})
+ if links:
+ if links_title:
+ ret.append('%s
' % links_title)
+ else:
+ ret.append('
')
+ for url, name in links:
+ ret.append('%s' % (url, name))
+ ret.append(' ')
return '\n'.join(ret)
def end_html():
diff --git a/tanks/lib/Program.py b/tanks/lib/Program.py
index ad30b1d..2063d1f 100644
--- a/tanks/lib/Program.py
+++ b/tanks/lib/Program.py
@@ -7,7 +7,7 @@ skills at designing those wits to survive.
Programming Your Tank
Your tanks are programmed using the Super Useful Command and Kontrol language,
-the very best in laser tank AI languages. It includes amazing feature such
+the very best in laser tank AI languages. It includes amazing features such
as comments (Started by a #, ended at EOL), logic, versatility, and
semi-colons (all lines must end in one). As with all new military systems
it utilizes only integers; we must never rest in our
diff --git a/tanks/lib/docs.py b/tanks/lib/docs.py
index 1724d52..0318250 100644
--- a/tanks/lib/docs.py
+++ b/tanks/lib/docs.py
@@ -4,9 +4,8 @@ def mkDocTable(objects):
objects.sort(lambda o1, o2: cmp(o1.__doc__, o2.__doc__))
for object in objects:
- print ''
if object.__doc__ is None:
- print '%s |
---|
Bad object' % \
+ print '' % \
xml.sax.saxutils.escape(str(object))
continue
text = object.__doc__
@@ -23,5 +22,5 @@ def mkDocTable(objects):
body = '\n'.join(body)
print '%s - %s
' % (head, body)
#print ' |
%s | Intentionally blank | |
---|
%s' % (head, body)
- print ' |
'
+
diff --git a/tanks/www/ctf.css b/tanks/www/ctf.css
deleted file mode 100644
index cf21d76..0000000
--- a/tanks/www/ctf.css
+++ /dev/null
@@ -1,104 +0,0 @@
-/**** document ****/
-
-html {
- background: #222 url(grunge.png) repeat-x;
-}
-
-body {
- font-family: sans-serif;
- color: #eee;
- margin: 50px 0 0 100px;
- padding: 10px;
- max-width: 700px;
-}
-
-/**** heading ****/
-
-h1:first-child {
- text-transform: lowercase;
- font-size: 1.6em;
-/* background-color: #222; */
-/* opacity: 0.9; */
- padding: 3px;
- color: #2a2;
- margin: 0 0 1em 70px;
-}
-
-h1:first-child:before {
- color: #fff;
- letter-spacing: -0.1em;
- content: "Capture The Flag: ";
-}
-
-/**** body ****/
-
-a img {
- border: 0px;
-}
-
-a {
- text-decoration: none;
- color: #2a2;
- font-weight: bold;
-}
-
-a:hover {
- color: #fff;
- background: #2a2;
- font-weight: bold;
-}
-
-
-h1, h2, h3 {
- color: #999;
- letter-spacing: -0.05em;
-}
-
-code, pre, .readme, div.errors {
- color: #fff;
- background-color: #555;
- margin: 1em;
-}
-
-th, td {
- vertical-align: top;
-}
-
-.scoreboard td {
- height: 400px;
-}
-
-p {
- line-height: 1.4em;
- margin-bottom: 20px;
- color: #f4f4f4;
-}
-
-dt {
- white-space: pre;
-}
-
-dt div.tab {
- background-color: #333;
- display: inline-block;
- padding: 5px;
- border: 3px solid green;
- border-bottom: none;
- font-weight: bold;
-}
-
-dd {
- border: 3px solid green;
- margin: 0px;
- padding: 5px;
- background-color: #282828;
-}
-
-fieldset * {
- margin: 3px;
-}
-
-table.results td, th{
- padding : 3px;
- font-weight : bold;
-}
diff --git a/tanks/www/docs.cgi b/tanks/www/docs.cgi
index 26306e3..6a6b514 100755
--- a/tanks/www/docs.cgi
+++ b/tanks/www/docs.cgi
@@ -1,10 +1,9 @@
#!/usr/bin/python
-print """Content-Type: text/html\n\n"""
-print """\n\n"""
import cgitb; cgitb.enable()
import os
import sys
+from ctf import config
try:
from tanks import Program, setup, conditions, actions, docs
@@ -15,10 +14,13 @@ except:
sys.path.append(os.path.join('/', *path))
import Program, setup, conditions, actions, docs
-print open('head.html').read() % "Documentation"
-print ''
-print 'Pflanzarr Documentation
'
-print open('links.html').read()
+print(config.start_html('Tanks Documentation',
+ links_title='Tanks',
+ links=[('docs.cgi', 'Docs'),
+ ('results.cgi', 'Results'),
+ ('submit.html', 'Submit'),
+ ('errors.cgi', 'My Errors')]))
+
print Program.__doc__
print 'Setup Actions:
'
@@ -34,4 +36,4 @@ print 'Actions:
'
print 'These actions are not for cowards. Remember, if actions contradict, your tank will simply do the last thing it was told in a turn. If ordered to hop on a plane to hell it will gladly do so. If order to make tea shortly afterwards, it will serve it politely and with cookies instead.'
docs.mkDocTable(actions.actions.values())
-print '