from twisted.web import resource, static
from twisted.python import reflect
import cgi, logging
from nevow import inevow, rend, tags, loaders, flat, athena
import os, sys


log = logging.getLogger("Webgui")
curdir=os.path.abspath(os.path.dirname(sys.argv[0]))
template_path = curdir+'/Web/html/Guest/'

class MyElement(athena.LiveElement):

   docFactory = loaders.stan(tags.div(render=tags.directive('liveElement')))


class Page(athena.LivePage):
   
   addSlash = True
   docFactory = loaders.stan(tags.html[
      tags.head(render=tags.directive('liveglue')),
      tags.body(render=tags.directive('myElement'))])


   def __init__(self, avatarId=None):
      self.avatarId = avatarId
      log.debug("Requested Userlist by "+str(avatarId))
      athena.LivePage.__init__(self)

   def render_myElement(self, ctx, data):
      f = MyElement()
      f.setFragmentParent(self)
      return ctx.tag[f]

   def child_(self, ctx):
      return Page()

