"theme" settings, actually just a path to the css
This commit is contained in:
parent
d18c60dcee
commit
3f4f9c6998
|
@ -165,7 +165,7 @@ class LibertyIDPUI(Directory):
|
|||
|
||||
class SettingsDirectory(Directory):
|
||||
|
||||
_q_exports = ["", "liberty_idp", "liberty_sp", ("metadata.xml", "metadata")]
|
||||
_q_exports = ["", "liberty_idp", "liberty_sp", ("metadata.xml", "metadata"), "theme"]
|
||||
|
||||
def _q_index [html] (self):
|
||||
wcs.misc.reload_cfg()
|
||||
|
@ -183,8 +183,43 @@ class SettingsDirectory(Directory):
|
|||
|
||||
"</dl>"
|
||||
|
||||
"<h2>%s</h2>" % _('Appearance')
|
||||
|
||||
"<dl>"
|
||||
"""<dt><a href="theme">%s</a></dt> <dd>%s</dd>""" % (
|
||||
_('Theme'), _('Configure Theme'))
|
||||
"</dl>"
|
||||
|
||||
html_foot()
|
||||
|
||||
def theme [html] (self):
|
||||
form = Form(enctype="multipart/form-data")
|
||||
form.add(StringWidget, "css", title = _('CSS Filename'),
|
||||
value = wcs.misc.cfg.get('appearance', {}).get('css', None),
|
||||
hint = _('Leave empty for default theme'))
|
||||
form.add_submit("cancel", _("Cancel"))
|
||||
form.add_submit("submit", _("Submit"))
|
||||
|
||||
if form.get_widget('cancel').parse():
|
||||
return redirect('.')
|
||||
if not form.is_submitted() or form.has_errors():
|
||||
html_top('settings', title = _('Theme'))
|
||||
'<h2>%s</h2>' % _('Theme')
|
||||
form.render()
|
||||
html_foot()
|
||||
else:
|
||||
wcs.misc.reload_cfg()
|
||||
if not wcs.misc.cfg.has_key(str('appearance')):
|
||||
wcs.misc.cfg[str('appearance')] = {}
|
||||
css = form.get_widget('css').parse()
|
||||
if not css:
|
||||
del wcs.misc.cfg[str('appearance')][str('css')]
|
||||
else:
|
||||
wcs.misc.cfg[str('appearance')][str('css')] = str(css)
|
||||
wcs.misc.write_cfg()
|
||||
return redirect('.')
|
||||
|
||||
|
||||
def liberty_sp [html] (self):
|
||||
wcs.misc.reload_cfg()
|
||||
base_url = wcs.misc.cfg.get("sp", {}).get('base_url', None)
|
||||
|
@ -213,7 +248,10 @@ class SettingsDirectory(Directory):
|
|||
form.add(StringWidget, "common_domain",
|
||||
title = _("Identity Provider Introduction, Common Domain"),
|
||||
hint = _("Disabled if empty"), value = common_domain)
|
||||
form.add_submit("submit", "Submit")
|
||||
form.add_cancel("cancel", _("Cancel"))
|
||||
form.add_submit("submit", _("Submit"))
|
||||
if form.get_widget('cancel').parse():
|
||||
return redirect('.')
|
||||
if not form.is_submitted() or form.has_errors():
|
||||
html_top('settings', title = _('Service Provider Configuration'))
|
||||
'<h2>%s</h2>' % _('Service Provider Configuration')
|
||||
|
|
Loading…
Reference in New Issue