1 import os
2 from zope.interface import implements
3 from webut.skin import iskin
4 from nevow import rend, loaders, tags, util, inevow, static
5 from formless import webform
6
8 implements(iskin.ISkin)
9
10 docFactory = loaders.xmlfile(
11 util.resource_filename('ldaptor.apps.webui', 'skin-default.html'))
12
13 stylesheets = [
14 'form.css',
15 'ldaptor.css',
16 ]
17
19 if segments[0] == 'form.css':
20 return webform.defaultCSS, segments[1:]
21 if segments[0] == 'ldaptor.css':
22 dirname = os.path.abspath(os.path.dirname(__file__))
23 return (static.File(os.path.join(dirname, 'ldaptor.css')),
24 segments[1:])
25 else:
26 return None, ()
27
30
32 def links(l, path=None):
33 for filename in l:
34 href = filename
35 if path is not None:
36 href = path.child(href)
37 yield tags.link(rel="stylesheet",
38 type="text/css",
39 href=href)
40 ctx.tag.clear()
41 stylesheets = getattr(self, 'stylesheets', None)
42 if stylesheets is not None:
43 ctx.tag[links(stylesheets, path=self.original.pathToFiles)]
44 stylesheets = getattr(self.original.resource, 'stylesheets', None)
45 if stylesheets is not None:
46 ctx.tag[links(stylesheets)]
47 return ctx.tag
48
49 - def render_content(self, ctx, data):
50 return self.original.content
51