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