diff options
-rwxr-xr-x | pagehandler.py | 12 | ||||
-rwxr-xr-x | patchtracker/SourceArchive.py | 3 | ||||
-rw-r--r-- | static/css/patches.css | 3 | ||||
-rw-r--r-- | templates/frontpage.tmpl | 30 |
4 files changed, 34 insertions, 14 deletions
diff --git a/pagehandler.py b/pagehandler.py index bbfa428..7ddeac4 100755 --- a/pagehandler.py +++ b/pagehandler.py @@ -2,6 +2,7 @@ # -*- coding: utf-8 -*- import cgi +import cgitb; cgitb.enable() import os import sys import patchtracker.Conf as Conf @@ -12,6 +13,7 @@ from patchtracker.DB import PatchTrackerDB import pygments from pygments.lexers import DiffLexer from pygments.formatters import HtmlFormatter +import patchtracker.SourceArchive as SourceArchive class CmdHandler: def __init__(self, uri): @@ -20,7 +22,7 @@ class CmdHandler: self.db = PatchTrackerDB() args = uri[len(Conf.root_url)+1:].split("/") - print "args:",args + #print "args:",args self.cmd = args[0] if self.cmd == "patch": patchtype,mode,pkgname,version = args[1:5] @@ -54,6 +56,9 @@ class CmdHandler: else: self.letter = args[1] self.toc = self.db.findLetterToc(self.letter) + elif self.cmd == "jump": + form = cgi.FieldStorage() + self.name = form.getfirst("package") elif not len(self.cmd): self.index = self.db.findMasterIndex() self.cmd = "frontpage" @@ -112,6 +117,11 @@ class CmdHandler: elif self.cmd == "frontpage": print "Content-Type: text/html\n\n" print FrontPageTemplate(self.index) + elif self.cmd == "jump": + print "Location: http://%s%s/index/%s#%s\n\n"%(os.getenv("HTTP_HOST"), + Conf.root_url, + SourceArchive.getidx(self.name), + self.name) if __name__ == "__main__": uri = os.getenv("REQUEST_URI") diff --git a/patchtracker/SourceArchive.py b/patchtracker/SourceArchive.py index 0da9fa4..c15c5f9 100755 --- a/patchtracker/SourceArchive.py +++ b/patchtracker/SourceArchive.py @@ -131,8 +131,7 @@ class MasterIndex: self.pkgcounts[idx] += 1 def indices(self): - for k,v in sorted(self.pkgcounts.iteritems()): - yield (k,v) + return sorted(self.pkgcounts.iterkeys()) class SourcePackageIndex: def __init__(self): diff --git a/static/css/patches.css b/static/css/patches.css index 15fe762..39cc8bc 100644 --- a/static/css/patches.css +++ b/static/css/patches.css @@ -30,9 +30,10 @@ td, th { padding: 10px; } -div.patch { +div.patch, div.quicklinks, div.framed { margin: 30px; padding: 15px; background-color: #eee; border: 1px solid black; } + diff --git a/templates/frontpage.tmpl b/templates/frontpage.tmpl index 5cb7fcc..17ddbd9 100644 --- a/templates/frontpage.tmpl +++ b/templates/frontpage.tmpl @@ -5,14 +5,24 @@ Debian Project patch tracking system #end def #def body <h1>Debian Project patch tracking system</h1> - <h2>Browse patches by package name</h2> - <table class="patchlisting"> - <tr><th>index</th><th># packages</th></tr> -#for $k,$v in $allindex.indices - <tr> - <td><a href="index/$k">$k</a></td> - <td>$v</td> - </tr> -#end for - </table> + <h2>Introduction</h2> + <p> + This site is used to track/visualize the changes made in the source code + of software packaged in the debian distribution. + </p> + <h2>Quick access</h2> + <h3>Browse patches by package name</h3> +#set $links = [ "<a href=\"index/"+k+"\">"+k+"</a>" for k in $allindex.indices ] +#set $out = " - ".join($links) + <div class="quicklinks"> + $out + </div> + <h3>Jump to package</h3> + <div class="framed"> + <form name="jumper" action="/jump" method="post"> + <input type="text" name="package" /> + <input type="submit" name="submit" /> + </form> + </div> + #end def |