|
|
|
@ -40,9 +40,13 @@ class IhrApp(Bottle):
|
|
|
|
|
|
|
|
|
|
def bureau_config(self, bureau):
|
|
|
|
|
# parse the config and make it into a form
|
|
|
|
|
# TODO: add a little html snippet with cfg file docs
|
|
|
|
|
templfile = os.path.join(self.tdir, "web_config.html")
|
|
|
|
|
template = mako.template.Template(filename=templfile)
|
|
|
|
|
basedir = os.path.expanduser("~/.screenless")
|
|
|
|
|
|
|
|
|
|
msg = ""
|
|
|
|
|
|
|
|
|
|
if bureau == "mgmt":
|
|
|
|
|
cfgfile = "mgmt.ini"
|
|
|
|
|
mode = "ini"
|
|
|
|
@ -54,15 +58,15 @@ class IhrApp(Bottle):
|
|
|
|
|
mode = "yaml"
|
|
|
|
|
cfgfile = os.path.join(basedir, cfgfile)
|
|
|
|
|
if request.method == "POST":
|
|
|
|
|
#save all the request.forms stuff to the config
|
|
|
|
|
# tell the bureau to restart / reload
|
|
|
|
|
# set our message to be "updated config"
|
|
|
|
|
print("NOT saving updated ", cfgfile)
|
|
|
|
|
pass
|
|
|
|
|
with open(cfgfile, "w") as cfg:
|
|
|
|
|
cfg.write(request.forms.get("cfgdata"))
|
|
|
|
|
# TODO: tell the bureau to restart / reload
|
|
|
|
|
msg = "Modified config file saved!"
|
|
|
|
|
|
|
|
|
|
#parse and show the config as a form
|
|
|
|
|
with open(cfgfile) as cfg:
|
|
|
|
|
cfgdata = cfg.read()
|
|
|
|
|
return template.render_unicode(bureau=bureau, cfgfile=cfgfile, mode=mode, cfgdata=cfgdata)
|
|
|
|
|
return template.render_unicode(msg=msg, bureau=bureau, cfgfile=cfgfile, mode=mode, cfgdata=cfgdata)
|
|
|
|
|
|
|
|
|
|
def register_bureau(self, bureau):
|
|
|
|
|
self.bureaus.append(bureau)
|
|
|
|
|