##// END OF EJS Templates
Add style support to hgwebdir
Edouard Gomez -
r3221:d7d53e3d default
parent child Browse files
Show More
@@ -21,6 +21,7 class hgwebdir(object):
21 return [(name.strip(os.sep), path) for name, path in items]
21 return [(name.strip(os.sep), path) for name, path in items]
22
22
23 self.motd = ""
23 self.motd = ""
24 self.style = ""
24 self.repos_sorted = ('name', False)
25 self.repos_sorted = ('name', False)
25 if isinstance(config, (list, tuple)):
26 if isinstance(config, (list, tuple)):
26 self.repos = cleannames(config)
27 self.repos = cleannames(config)
@@ -32,8 +33,11 class hgwebdir(object):
32 cp = ConfigParser.SafeConfigParser()
33 cp = ConfigParser.SafeConfigParser()
33 cp.read(config)
34 cp.read(config)
34 self.repos = []
35 self.repos = []
35 if cp.has_section('web') and cp.has_option('web', 'motd'):
36 if cp.has_section('web'):
36 self.motd = cp.get('web', 'motd')
37 if cp.has_option('web', 'motd'):
38 self.motd = cp.get('web', 'motd')
39 if cp.has_option('web', 'style'):
40 self.style = cp.get('web', 'style')
37 if cp.has_section('paths'):
41 if cp.has_section('paths'):
38 self.repos.extend(cleannames(cp.items('paths')))
42 self.repos.extend(cleannames(cp.items('paths')))
39 if cp.has_section('collections'):
43 if cp.has_section('collections'):
@@ -66,6 +70,15 class hgwebdir(object):
66 yield tmpl("footer", motd=self.motd, **map)
70 yield tmpl("footer", motd=self.motd, **map)
67
71
68 m = os.path.join(templater.templatepath(), "map")
72 m = os.path.join(templater.templatepath(), "map")
73 style = self.style
74 if req.form.has_key('style'):
75 style = req.form['style'][0]
76 if style != "":
77 b = os.path.basename("map-" + style)
78 p = os.path.join(templater.templatepath(), b)
79 if os.path.isfile(p):
80 m = p
81
69 tmpl = templater.templater(m, templater.common_filters,
82 tmpl = templater.templater(m, templater.common_filters,
70 defaults={"header": header,
83 defaults={"header": header,
71 "footer": footer})
84 "footer": footer})
General Comments 0
You need to be logged in to leave comments. Login now