|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
# this is a web interface for simple edits to configuration or editing data
|
|
|
|
|
# for particular bureaus
|
|
|
|
|
import configparser
|
|
|
|
|
import inspect
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
from bottle import Bottle, request
|
|
|
|
@ -14,11 +15,13 @@ class IhrApp(Bottle):
|
|
|
|
|
self.route("/config/<bureau>", callback=self.bureau_config)
|
|
|
|
|
self.route("/config/<bureau>", callback=self.bureau_config, method="POST")
|
|
|
|
|
self.bureaus = []
|
|
|
|
|
mpath = inspect.getfile(self.__class__)
|
|
|
|
|
self.tdir = os.path.dirname(mpath)
|
|
|
|
|
|
|
|
|
|
def index(self):
|
|
|
|
|
# return a list of active bureaus with links
|
|
|
|
|
# TODO: allow (de)activation of non-essential bureaus
|
|
|
|
|
templfile = "web_index.html"
|
|
|
|
|
templfile = os.path.join(self.tdir, "web_index.html")
|
|
|
|
|
out = """
|
|
|
|
|
<h3>The Screenless Office</h3>
|
|
|
|
|
<h4><em>Config Manager</em></h4>
|
|
|
|
@ -36,7 +39,7 @@ class IhrApp(Bottle):
|
|
|
|
|
|
|
|
|
|
def bureau_config(self, bureau):
|
|
|
|
|
# parse the config and make it into a form
|
|
|
|
|
templfile = "web_config.html"
|
|
|
|
|
templfile = os.path.join(self.tdir, "web_config.html")
|
|
|
|
|
template = mako.template.Template(filename=templfile)
|
|
|
|
|
basedir = os.path.expanduser("~/.screenless")
|
|
|
|
|
if bureau == "mgmt":
|
|
|
|
|