casweb/cas.py | 23 +++++++++++++++++++----
casweb/media/css/main.css | 4 ++++
casweb/templates/index.html | 3 +++
casweb/templates/job.html | 14 ++++++++++++--
casweb/templates/jobs.html | 2 +-
5 files changed, 39 insertions(+), 7 deletions(-)
New commits:
commit 84340e674cc833524e46baaae3f0dfae5cd5679e
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Wed Jan 27 16:41:45 2010 -0500
- webby
diff --git a/casweb/cas.py b/casweb/cas.py
index a22742d..d96ad91 100644
--- a/casweb/cas.py
+++ b/casweb/cas.py
@@ -1,11 +1,20 @@
import web
import os
+import ConfigParser
+import glob
try:
from cas.db import CasStorage
except ImportError:
raise Exception("Unable to import CasStorage, make sure CAS is installed")
+global settings
+config = ConfigParser.ConfigParser()
+config.read("/etc/cas.conf")
+settings = {}
+if config.has_section("settings"):
+ for opt, val in config.items("settings"):
+ settings[opt.upper()] = val
# do not edit below this line unless you know what you are doing
render = web.template.render(os.path.join(os.path.dirname(__file__),'templates').replace('\\','/'), cache=False)
@@ -13,7 +22,7 @@ web.template.Template.globals['ctx'] = web.ctx
urls = (
'/', 'index',
- '/job/(\d+)', 'job',
+ '/job/(\d+)/(.*)', 'job',
'/jobs', 'jobs',
)
@@ -26,11 +35,17 @@ casDB.connect()
class index:
def GET(self):
- return render.base(render.index())
+ userdoc = glob.glob('/usr/share/doc/cas*/index.html')[0]
+ return render.base(render.index(userdoc))
class job:
- def GET(self, id):
- return render.base(render.job(id))
+ def GET(self, id, timestamp):
+ path_construct = os.path.join(settings["WORKDIRECTORY"],id)
+ path_construct = os.path.join(path_construct, timestamp)
+ path_construct = os.path.join(path_construct, '%d.log' % (int(id),))
+ if os.path.isfile(path_construct):
+ fp = open(path_construct, 'r').readlines()
+ return render.base(render.job(id, fp))
class jobs:
def GET(self):
diff --git a/casweb/media/css/main.css b/casweb/media/css/main.css
index 7ef24e4..cb6ca6a 100644
--- a/casweb/media/css/main.css
+++ b/casweb/media/css/main.css
@@ -23,5 +23,9 @@ body {
clear:both;
}
+#content .jobstatus {
+ font-size: .7em;
+}
+
/* vim:ts=2 sw=2 et
* /
diff --git a/casweb/templates/index.html b/casweb/templates/index.html
index 181f60d..e3580f2 100644
--- a/casweb/templates/index.html
+++ b/casweb/templates/index.html
@@ -1,5 +1,8 @@
+$def with (userdoc)
<h3>CAS Web Administration</h3>
Welcome to the CAS web frontend. This application gives the ability to view recent jobs,
schedule new jobs, and perform minor maintenance work through the administration panel.
+<h3>Documentation</h3>
+Latest CAS Documentation is located @ $:userdoc
$# vim:ts=2 sw=2 et
diff --git a/casweb/templates/job.html b/casweb/templates/job.html
index b01d138..8f0f53e 100644
--- a/casweb/templates/job.html
+++ b/casweb/templates/job.html
@@ -1,3 +1,13 @@
-$def with (id=0)
+$def with (id, fp)
-job status on $id
+<h3>Job Status</h3>
+Job ID:$id
+<div class="jobstatus">
+<ul>
+$if fp:
+ $for line in fp:
+ <li>$:line</li>
+$else:
+ No information available.
+</ul>
+</div>
diff --git a/casweb/templates/jobs.html b/casweb/templates/jobs.html
index f62399d..c89d0dd 100644
--- a/casweb/templates/jobs.html
+++ b/casweb/templates/jobs.html
@@ -9,7 +9,7 @@ $for job in allJobs[:25]:
$code:
dbid, jobid, timestamp, email = job
<tr>
- <td>$:email</td><td><a href="$ctx.homepath/job/$jobid">$:timestamp</a></td>
+ <td>$:email</td><td>$:jobid | <a href="$ctx.homepath/job/$jobid/$timestamp">$:timestamp</a></td>
</tr>
</table>