Basic web is now working

parent 089b1e15
<html>
<body>
Directory listing denied
</body>
</html>
<html>
<body>
Directory listing denied
</body>
</html>
This diff is collapsed.
<html>
<head>
<title>Penguidom GUI</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=0.85, maximum-scale=0.85, minimum-scale=0.85, user-scalable=no" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=0.85" />
<style>
body {
background: none repeat scroll 0 0 #FBFBFB;
font-family: "HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",sans-serif;
font-size: 12px;
height: 100%;
line-height: 1.4em;
margin: 0;
min-width: 0;
padding: 0;
}
.tblack {
background-color: #000 !important;
}
</style>
@SCRIPT@
</head>
<body class="tblack">
<div id="content" class="tblack" >
@CONTENT@
</div>
</body>
</html>
<html>
<body>
Directory listing denied
</body>
</html>
<html>
<body>
Directory listing denied
</body>
</html>
......@@ -68,35 +68,81 @@ WEB_SYSTEM_PATHS=[
server.version='PenguidomWeb/1.0'
class RootPage(rend.Page):
class BasePage(rend.Page):
addSlash = True
logged = False
childvars = {}
isLeaf = False
perms = False
sse = False
child_resources = StaticFile(curdir+'/Web/resources/')
child_download = StaticFile(curdir+'/Web/download/')
def renderHTML(self, ctx):
log.debug("renderHTML in BasePage")
request = inevow.IRequest(ctx)
session = inevow.ISession(ctx)
return rend.Page.renderHTTP(self, ctx)
def __init__(self, avatarId=None, port=80):
self.port = port
log.debug("Root page initialized by " + str(avatarId))
super(RootPage, self).__init__(self)
log.debug("BasePage initialized by " + str(avatarId))
super(BasePage, self).__init__(self)
self.avatarId=avatarId
self.putChild('favicon.ico', static.File(curdir+'/Web/resources/img/favicon.ico'))
self.putChild('crossdomain.xml', static.File(curdir+'/Web/resources/xml/crossdomain.xml'))
self.putChild('sockjs.min.js', static.File(curdir+'/Web/resources/js/sockjs.min.js'))
def renderHTML(self, ctx):
def locateChild(self, ctx, name):
log.debug("LocateChild in BasePage (%s)" % str(name))
return rend.Page.locateChild(self, ctx, name)
def childFactory(self, ctx, name):
request = inevow.IRequest(ctx)
session = inevow.ISession(ctx)
return rend.Page.renderHTTP(self, ctx)
log.debug("No child found (%s)" % name)
return permissionDenied()
class GuiPage(BasePage):
addSlash = True
html="""<html><head></head><body><div>Cannot find GuiPage template files</div></body></html>"""
def renderHTTP( self, ctx):
request = inevow.IRequest(ctx)
return self.getStandardHTML(request.uri)
def getStandardHTML(self, path):
log.info(path)
html = self.html
html = html.replace("@SCRIPT@", "")
return html
def childFactory(self, ctx, name):
log.debug("GuiPage childFactory")
return self
class RootPage(BasePage):
logged = False
childvars = {}
isLeaf = False
perms = False
addSlash = True
def __init__(self, avatarId=None, port=80):
self.port = port
log.debug("Root page initialized by " + str(avatarId))
super(RootPage, self).__init__(self)
def child_gui(self, ctx):
log.debug("Enter GUI page")
gui = GuiPage(self.avatarId)
gui.core = self.core
return gui
def child_botauth(self, ctx):
session = inevow.ISession(ctx)
log.debug("BOT AUTH callback received")
botauth = bot.BotAuth()
botauth.core = self.core
......@@ -104,11 +150,13 @@ class RootPage(rend.Page):
def child_rest(self, ctx):
log.debug("Enter Rest Page")
self.rest = rest.RestPages()
self.rest.core = self.core
return self.rest
def child_rawplugin(self, ctx):
log.debug("Trying Plugins Page")
request = inevow.IRequest(ctx)
pl=request.path.split("/")
if len(pl)>2:
......@@ -133,12 +181,8 @@ class RootPage(rend.Page):
log.debug("no plugin name in request")
return self.childFactory(ctx, 'rawplugin')
def locateChild(self, ctx, name):
return rend.Page.locateChild(self, ctx, name)
def child_(self, ctx):
log.debug("Gui redirection")
html = """
Redirecting...
"""
......@@ -146,17 +190,18 @@ class RootPage(rend.Page):
request.setHeader('Location', 'gui/');
request.setResponseCode(302)
return html
def locateChild(self, ctx, name):
log.debug("LocateChild in RootPage (%s)" % str(name))
return rend.Page.locateChild(self, ctx, name)
def childFactory(self, ctx, name):
request = inevow.IRequest(ctx)
log.debug("No child found (%s)" % name)
log.debug("RootPage No child found (%s)" % str(name))
return permissionDenied()
### Authentication
from twisted.cred.error import UnauthorizedLogin
from nevow import url
......@@ -263,7 +308,7 @@ class LogoutPage(rend.Page):
class RootAuthPage(RootPage):
def __init__(self, avatarId=None, port=80, mind=None):
RootPage.__init__(self, avatarId, port)
super(RootAuthPage, self).__init__(self)
self.logged=True
self.mind = mind
self.perms = avatarId[1]
......@@ -276,7 +321,7 @@ class RootAuthPage(RootPage):
def locateChild(self, ctx, name):
request = inevow.IRequest(ctx)
if not self.mind.loginsaved:
log.debug("LocateChild in RootAuthPage Ming Args: "+str(self.mind.args))
log.debug("LocateChild in RootAuthPage")
self.mind.loginsaved = True
self.mind.perms = self.perms
if 'rememberMe' in self.mind.args:
......@@ -429,7 +474,6 @@ class LoginPage(rend.Page):
def childFactory(self, ctx, name):
log.debug("Login childFactory")
request = inevow.IRequest(ctx)
return self
......@@ -463,6 +507,7 @@ class PenguidomAuthRealm(object):
resc.core = self.core
resc.putChild('sockjs', ajax.getSocketJSResource(self.core))
return (inevow.IResource, resc, resc.logout)
raise NotImplementedError("Can't support that interface.")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment