diff --git a/direct/src/http/LandingPage.py b/direct/src/http/LandingPage.py
index ae421ee692..39bbca48d0 100755
--- a/direct/src/http/LandingPage.py
+++ b/direct/src/http/LandingPage.py
@@ -45,6 +45,10 @@ class LandingPage:
uriList.remove("/services")
autoList.append("/services")
+ if "/default.css" in uriList:
+ uriList.remove("/default.css")
+ autoList.append("/default.css")
+
output += LandingPageHTML.getURITable(title="Application",uriList=uriList,uriToHandler=uriToHandler)
output += LandingPageHTML.getURITable(title="Admin",uriList=autoList,uriToHandler=uriToHandler)
@@ -78,6 +82,9 @@ class LandingPage:
def getMainPage(self):
return LandingPageHTML.mainPageBody % {"description" : self.getDescription(),
"quickstats" : self.getQuickStatsTable()}
+
+ def getStyleSheet(self):
+ return LandingPageHTML.stylesheet
def skin(self, body, uri):
title = self.uriToTitle.get(uri,"Services")
diff --git a/direct/src/http/LandingPageHTML.py b/direct/src/http/LandingPageHTML.py
index 99afec909f..bf1143d435 100755
--- a/direct/src/http/LandingPageHTML.py
+++ b/direct/src/http/LandingPageHTML.py
@@ -9,19 +9,14 @@ defaultDesc = description
contactInfo = "M. Ian Graham - ian.graham@dig.com - 818-623-3219"
-
-
# -- Begin fancy layout stuff, change at your own risk --
-header = '''
-
-%(titlestring)s
-
+ }
+\r\n'''
+
+header = '''
+
+
+%(titlestring)s
+
+
+
+
+
+
+
+
'''
mainPageBody = '''
%(description)s
+
%(quickstats)s
'''
footer = '''
+
+
+
@@ -297,7 +308,7 @@ def getRowClassString(rowNum):
return " class=\"odd\""
def getURITable(title,uriList,uriToHandler):
- output = "\n%s| URI | Handler |
\n\n" % title
+ output = "\n\n
\n%s| URI | Handler |
\n" % title
output += "\n"
rowNum = 0
@@ -311,7 +322,7 @@ def getURITable(title,uriList,uriToHandler):
handlerFunc)
rowNum += 1
- output += "
\n"
+ output += "\n
\n\n"
return output
@@ -352,7 +363,7 @@ def getTabs(menu,activeTab):
return s
def getQuickStatsTable(quickStats):
- output = "\nQuick Stats| Item | Value |
\n\n"
+ output = "\n\nQuick Stats\n| Item | Value |
\n"
output += "\n"
rowNum = 0
@@ -363,6 +374,6 @@ def getQuickStatsTable(quickStats):
quickStats[1][item])
rowNum += 1
- output += "
\n"
+ output += "\n
\n"
return output
diff --git a/direct/src/http/WebRequest.py b/direct/src/http/WebRequest.py
index 7a4b3dbfac..fa33a5afcd 100755
--- a/direct/src/http/WebRequest.py
+++ b/direct/src/http/WebRequest.py
@@ -43,6 +43,15 @@ class WebRequest(object):
msg = "HTTP/1.0 200 OK\r\nContent-Type: text/xml\r\n\r\n%s" % body
self.connection.SendThisResponse(msg)
+ def respondCustom(self,contentType,body):
+ msg = "HTTP/1.0 200 OK\r\nContent-Type: %s\n" % contentType
+
+ if contentType in ["text/css",]:
+ msg += "Cache-Control: max-age=313977290\nExpires: Tue, 02 May 2017 04:08:44 GMT\n"
+
+ msg += "\r\n\r\n%s" % (body)
+ self.connection.SendThisResponse(msg)
+
def timeout(self):
resp = "Error 504: Request timed out\r\n"
self.respondHTTP("504 Gateway Timeout",resp)
@@ -215,6 +224,7 @@ class WebRequestDispatcher(object):
self.landingPage = LandingPage()
self.registerGETHandler("/", self._main, returnsResponse = True, autoSkin = True)
self.registerGETHandler("/services", self._services, returnsResponse = True, autoSkin = True)
+ self.registerGETHandler("/default.css", self._stylesheet)
self.landingPage.addTab("Main", "/")
self.landingPage.addTab("Services", "/services")
else:
@@ -228,3 +238,11 @@ class WebRequestDispatcher(object):
def _services(self):
return self.landingPage.getServicesPage(self.uriToHandler)
+
+ def _stylesheet(self,**kw):
+ replyTo = kw.get("replyTo",None)
+ assert replyTo is not None
+ body = self.landingPage.getStyleSheet()
+ replyTo.respondCustom("text/css",body)
+
+