From 4263759ab3aaba01a12be658f899bad36f4376bc Mon Sep 17 00:00:00 2001 From: Ulrike Uhlig Date: Mon, 15 Sep 2014 19:19:11 +0000 Subject: use nav element for menu on homepage. add some css for nav and pre elements, improve h1. git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@28803 e39458fd-73e7-0310-bf30-c45bca0a0e42 --- bin/tracker_service.py | 4 ++-- lib/python/web_support.py | 44 +++++++++++++++++++++++--------------------- static/style.css | 38 +++++++++++++++++++++++++------------- 3 files changed, 50 insertions(+), 36 deletions(-) diff --git a/bin/tracker_service.py b/bin/tracker_service.py index 1387b669c6..e9a9455398 100644 --- a/bin/tracker_service.py +++ b/bin/tracker_service.py @@ -193,7 +193,7 @@ aware of and/or help us improve the quality of this information by """, A(url.scriptRelative("data/report"), "participating"), "."), - make_menu( + NAV(make_menu( url.scriptRelative, ('status/release/unstable', 'Vulnerable packages in the unstable suite'), @@ -223,7 +223,7 @@ aware of and/or help us improve the quality of this information by """, 'Packages with strange version numbers'), ('data/releases', 'Covered Debian releases and architectures (slow)') - ), + )), self.make_search_button(url), P("""(You can enter CVE names, Debian bug numbers and package diff --git a/lib/python/web_support.py b/lib/python/web_support.py index d5cef51228..2eabfaae1e 100644 --- a/lib/python/web_support.py +++ b/lib/python/web_support.py @@ -1,16 +1,16 @@ # web_support.py -- simple HTTP generation framework # Copyright (C) 2005 Florian Weimer -# +# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA @@ -114,7 +114,7 @@ class Service: self.handle(cli, env, data, result) client.sendall(result.getvalue()) client.close() - + except ServinvokeError: client.close() pass @@ -126,7 +126,7 @@ class Service: target = cStringIO.StringIO() traceback.print_exc(None, target) self.log("%s", target.getvalue()) - + def handle(args, environ, data): """Invoke by run to handle a single request. Should return the data to be sent back to the client.""" @@ -146,7 +146,7 @@ class URLFactory: This factory class handles the case where a script wants to generate URLs which reference to itself (see scriptRelative).""" - + def __init__(self, server_name, script_name, path_info='', params={}, secure=False): self.server_name = server_name or 'localhost' @@ -177,15 +177,15 @@ class URLFactory: while arg[:1] == '/': arg = arg[1:] return arg - + def absolute(self, url, **args): """Creates an absolute URL, with optional arguments to pass.""" - + return URL(url + self._convertArgs(args)) def absoluteDict(self, url, args): """Creates an absolute URL, with arguments to pass.""" - + return URL(url + self._convertArgs(args)) def scriptRelative(self, path, **args): @@ -195,7 +195,7 @@ class URLFactory: return URL("/%s%s%s" % (self.script_name, self._stripSlashes(path), self._convertArgs(args))) - + def scriptRelativeFull(self, path, **args): """Like scriptRelative, but returns an absolute URL, including the http:// prefix.""" @@ -235,7 +235,7 @@ del _initStringToHTML def escapeHTML(str): '''Replaces the characters <>&" in the passed strings with their HTML entities.''' - + result = [] append = result.append for ch in str: @@ -263,7 +263,7 @@ class HTMLBase: class VerbatimHTML(HTMLBase): """Creates verbatim HTML from a string object. Mainly used for optimizing recurring HTML snippets.""" - + def __init__(self, contents): self.__contents = contents @@ -288,13 +288,13 @@ class Compose(HTMLBase): def compose(*contents): """Concatenates several HTML objects.""" return Compose(contents) - + class Tag(HTMLBase): """Base class for HTML tags.""" - + re_name = re.compile(r'\A_?[a-zA-Z][a-zA-Z0-9]*\Z') - + def __init__(self, name, contents, attribs={}): self._check(name) self.__name = name @@ -342,7 +342,7 @@ class Tag(HTMLBase): pass raise write(closing) - + else: write("<%s%s/>" % (self.__name, self.__attribs)) @@ -356,7 +356,7 @@ class Tag(HTMLBase): def tag(__name, __contents, **__attribs): """Creates a new tag object. - + name - name of the tag contents - a sequence objet (or iterator) for the enclosed contents attribs - keyword arguments froming forming attributes @@ -429,6 +429,8 @@ def HEADER(*__contents, **__attribs): return Tag('header', __contents, __attribs) def FOOTER(*__contents, **__attribs): return Tag('footer', __contents, __attribs) +def NAV(*__contents, **__attribs): + return Tag('nav', __contents, __attribs) def _linkify(match): extra = match.group(2) @@ -555,7 +557,7 @@ class PathRouter: 'wildcard ** in the middle of path' m['**'] = value return - + m_new = {} m[element] = m_new m = m_new @@ -734,7 +736,7 @@ class WebServiceBase: def pre_dispatch(self, url): """Invoked by handle prior to calling the registered handler.""" pass - + class WebService(Service, WebServiceBase): "CGI service implemented using servinvoke" def __init__(self, socket_name): @@ -778,7 +780,7 @@ class WebServiceHTTP(WebServiceBase): self.lock = threading.Lock() self.__parse_base_url(base_url) - + service_self = self class Handler(BaseHTTPServer.BaseHTTPRequestHandler): def do_GET(self): @@ -839,7 +841,7 @@ class WebServiceHTTP(WebServiceBase): self.secure = m.group(1) == "https" self.server_name = m.group(2) self.script_name = m.group(3) - + def __test(): assert str(URL("")) == "" diff --git a/static/style.css b/static/style.css index de2678f418..8362aace00 100644 --- a/static/style.css +++ b/static/style.css @@ -14,9 +14,8 @@ body { color: #333333; } -header { - border-bottom: 1px solid crimson; - margin-bottom: 2em; +pre { + overflow: auto; } a { @@ -29,6 +28,16 @@ a:hover, a:focus { text-decoration:underline; } +header { + border-bottom: 1px solid crimson; + margin-bottom: 2em; +} + +footer { + text-align: center; + margin-top: 1em; +} + ul, ol { padding-left: 0; } @@ -41,7 +50,7 @@ ul li { display: inline-block; } -li a { +ul li a { background: #fafafa; border: 1px solid #ddd; margin: 0 0.5em 0.2em 0; @@ -50,10 +59,21 @@ li a { display: block; } +nav ul li { + display: block; +} + +nav ul li a { + background: none; + border: none; + padding: 0; +} + h1 { font-size : 250%; padding: 0; margin: 0; + margin-right: 260px; line-height: 1.4em; } @@ -105,11 +125,6 @@ hr { display: none; } -footer { - text-align: center; - margin-top: 1em; -} - form { text-align: center; padding: 1em 0; @@ -138,9 +153,6 @@ span.dangerous { color: rgb(191,127,0); } @media all and (min-width: 641px) { header { background: url(/tracker/logo.png) top right no-repeat; - min-height: 60px; - } - h1 { - line-height: 2.4em; + min-height: 80px; } } -- cgit v1.2.3