[Secure-testing-commits] r28798 - bin lib/python

Ulrike Uhlig u-guest at moszumanska.debian.org
Mon Sep 15 19:14:21 UTC 2014


Author: u-guest
Date: 2014-09-15 19:14:21 +0000 (Mon, 15 Sep 2014)
New Revision: 28798

Modified:
   bin/tracker_service.css
   bin/tracker_service.py
   lib/python/web_support.py
Log:
use modern html5 css. switch to external stylesheet.

Modified: bin/tracker_service.css
===================================================================
--- bin/tracker_service.css	2014-09-15 19:08:32 UTC (rev 28797)
+++ bin/tracker_service.css	2014-09-15 19:14:21 UTC (rev 28798)
@@ -0,0 +1,133 @@
+html {
+	font-size: 100%;
+	-webkit-text-size-adjust: 100%;
+    -ms-text-size-adjust:100%;
+}
+
+body {
+	width: 90%;
+	max-width: 1200px;
+	margin: 2em auto 1em;
+	font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
+	font-size: 14px;
+	line-height: 20px;
+	color: #333333;
+}
+
+header {
+	border-bottom: 1px solid crimson;
+	margin-bottom: 2em;
+}
+
+a {
+	color:#0088cc;
+	text-decoration:none;
+}
+
+a:hover, a:focus {
+	color:#005580;
+	text-decoration:underline;
+}
+
+ul, li {
+	list-style: none;
+}
+
+ul, ol {
+	padding-left: 0;
+}
+
+h1 {
+	font-size : 250%;
+	padding: 0;
+	margin: 0;
+	line-height: 1.4em;
+}
+
+h2 {
+	font-size : 110%;
+	background: crimson;
+	margin: 1em 0 0;
+	padding: 0.5em;
+	color: #fff;
+	border-top-left-radius: 0.5em;
+	border-top-right-radius: 0.5em;
+}
+
+h3 {
+	font-size : 110%;
+}
+
+table {
+	width: 100%;
+	border: 1px solid #ddd;
+	border-radius: 0.5em;
+	border-collapse: collapse;
+	box-shadow: 0 1px 3px #eee;
+	margin-bottom: 2em;
+}
+
+tr(even) {
+	background-color: #fafafa;
+}
+
+td, th {
+	text-align: left;
+	padding: 0.25em 0.5em;
+	border-bottom: 1px solid #ddd;
+	border-collapse: collapse;
+	vertical-align: top;
+}
+
+table tr:last-child td {
+	border: none;
+}
+
+th {
+	background: #eee;
+	padding: 0.5em;
+}
+
+hr {
+	display: none;
+}
+
+footer {
+	text-align: center;
+	margin-top: 1em;
+}
+
+form {
+	text-align: center;
+	padding: 1em 0;
+	margin: 1em 0;
+	border-top: 1px solid #ddd;
+	border-bottom: 1px solid #ddd;
+}
+
+span.red { color: red; }
+span.purple { color: purple; }
+span.green { color: green; }
+span.dangerous { color: rgb(191,127,0); }
+
+ at media all and (max-width: 641px) {
+	body {
+		font-size: 13px;
+	}
+	table {
+		table-layout: fixed;
+	}
+	td, th {
+		overflow: hidden;
+	}
+}
+
+ at media all and (min-width: 641px) {
+	header {
+		background: url(https://tracker.debian.org/static/img/logo.png) top right no-repeat;
+		min-height: 60px;
+	}
+	h1 {
+		line-height: 2.4em;
+	}
+}

Modified: bin/tracker_service.py
===================================================================
--- bin/tracker_service.py	2014-09-15 19:08:32 UTC (rev 28797)
+++ bin/tracker_service.py	2014-09-15 19:14:21 UTC (rev 28798)
@@ -86,38 +86,25 @@
         return nodsa and not self.params['show_nodsa']
 
 class TrackerService(webservice_base_class):
-    head_contents = compose(STYLE(
-        """h1 { font-size : 144%; }
-h2 { font-size : 120%; }
-h3 { font-size : 100%; }
+    head_contents = compose(
+	LINK(' ', href="/tracker/style.css"),
+	SCRIPT('''var old_query_value = "";
+	function selectSearch() {
+	document.searchForm.query.focus();
+	}
 
-table { padding-left : 1.5em }
-td, th { text-align : left;
-	 padding-left : 0.25em;
-         padding-right : 0.25em; }
-td { vertical-align: baseline }
-span.red { color: red; }
-span.purple { color: purple; }
-span.green { color: green; }
-span.dangerous { color: rgb(191,127,0); }
-"""), SCRIPT('''var old_query_value = "";
+	function onSearch(query) {
+	if (old_query_value == "") {
+		if (query.length > 5) {
+		old_query_value = query;
+		document.searchForm.submit();
+		} else {
+		old_query_value = query;
+		}
+	}
+	}
+	''')).toHTML()
 
-function selectSearch() {
-  document.searchForm.query.focus();
-}
-
-function onSearch(query) {
-  if (old_query_value == "") {
-    if (query.length > 5) {
-      old_query_value = query;
-      document.searchForm.submit();
-    } else {
-      old_query_value = query;
-    }
-  }
-}
-''')).toHTML()
-
     nvd_text =  P('''If a "**" is included, the urgency field was automatically
         assigned by the NVD (National Vulnerability Database). Note that this
         rating is automatically derived from a set of known factors about the
@@ -232,7 +219,7 @@
              P("""(You can enter CVE names, Debian bug numbers and package
 names in the search forms.)"""),
 
-             H2("External interfaces"),
+             H3("External interfaces"),
              P("""If you want to automatically open a relevant web page for
 some object, use the """,
                CODE(str(url.scriptRelative("redirect/")), EM("object")),
@@ -1222,7 +1209,7 @@
         append(HR())
         if not search_in_page:
             append(self.make_search_button(url))
-        append(P(A(url.scriptRelative(""), "Home"),
+            append(FOOTER(P(A(url.scriptRelative(""), "Home"),
                     " - ", A(url.absolute("http://secure-testing.debian.net/"),
                              "Testing Security Team"),
                     " - ", A(url.absolute("https://www.debian.org/security/"),
@@ -1230,7 +1217,7 @@
 		    " - ", A(url.absolute("https://anonscm.debian.org/viewvc/secure-testing/bin/tracker_service.py?view=markup"),
 		             "Source"),
 		    " ", A(url.absolute("svn://anonscm.debian.org/svn/secure-testing"), "(SVN)"),
-                    ))
+                    )))
         if search_in_page:
             on_load = "selectSearch()"
         else:

Modified: lib/python/web_support.py
===================================================================
--- lib/python/web_support.py	2014-09-15 19:08:32 UTC (rev 28797)
+++ lib/python/web_support.py	2014-09-15 19:14:21 UTC (rev 28798)
@@ -379,6 +379,8 @@
     return tag('style', contents, type=type)
 def SCRIPT(contents, type="text/javascript", language="JavaScript"):
     return tag('script', contents, type=type, language=language)
+def LINK(contents, type="text/css", rel="stylesheet", href=""):
+    return tag('link', contents, type=type, rel=rel, href=href)
 def TITLE(contents):
     return tag('title', contents)
 def HTML(head, body):
@@ -391,6 +393,8 @@
     return tag('h1', contents)
 def H2(contents):
     return tag('h2', contents)
+def H3(contents):
+    return tag('h3', contents)
 def P(*contents):
     return Tag('p', contents)
 def SPAN(*__contents, **__attribs):
@@ -419,6 +423,10 @@
     return Tag('input', __contents, __attribs)
 def LI(*__contents, **__attribs):
     return Tag('li', __contents, __attribs)
+def HEADER(*__contents, **__attribs):
+    return Tag('header', __contents, __attribs)
+def FOOTER(*__contents, **__attribs):
+    return Tag('footer', __contents, __attribs)
 
 def _linkify(match):
     extra = match.group(2)
@@ -696,7 +704,7 @@
     def html_dtd(self):
         """Returns the DOCTYPE declaration to be used for HTML documents.
         Can be overridden."""
-        return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
+        return '<!DOCTYPE html>'
 
     def add_title(self, title, body, head_contents=None, body_attribs={}):
         """Takes a sequence of HTML objects and wraps them in 'body'
@@ -716,7 +724,7 @@
             body_list = [body]
         else:
             body_list = list(body)
-        body_list[:0] = (H1(title),)
+        body_list[:0] = (HEADER(H1(title)),)
 
         return tag('html',
                    (HEAD(head_list), Tag('body', body_list, body_attribs)))




More information about the Secure-testing-commits mailing list