diff --git a/src/www/Bongo.rules b/src/www/Bongo.rules index 79e7875..37ab14a 100644 --- a/src/www/Bongo.rules +++ b/src/www/Bongo.rules @@ -16,6 +16,7 @@ dist_css_DATA := \ src/www/css/composer.css \ src/www/css/contacts.css \ src/www/css/conversation.css \ + src/www/css/hawkeye.css \ src/www/css/interpreter.css \ src/www/css/layout.css \ src/www/css/login.css \ @@ -180,7 +181,21 @@ dist_img_DATA := \ src/www/img/toolbar/16/format-text-italic.png \ src/www/img/toolbar/16/format-text-strikethrough.png \ src/www/img/toolbar/16/format-text-underline.png \ - src/www/img/toolbar/16/mail-attachment.png + src/www/img/toolbar/16/mail-attachment.png \ + src/www/img/bg.png \ + src/www/img/Bongo-logo.png \ + src/www/img/cbg.png \ + src/www/img/dialog-warning.png \ + src/www/img/help-browser.png \ + src/www/img/locked.png \ + src/www/img/login-pane.png \ + src/www/img/network-server.png \ + src/www/img/sel.png \ + src/www/img/system-installer.png \ + src/www/img/system-users.png \ + src/www/img/user.png \ + src/www/img/user-desktop.png \ + src/www/img/welcome-box.png jsdir = $(htdocsdir)/js @@ -286,11 +301,12 @@ pkgpythonhawkeyedir = $(pkgpythondir)/hawkeye pkgpythonhawkeye_PYTHON := \ src/www/bongo/hawkeye/__init__.py \ - src/www/bongo/hawkeye/AgentsView.py \ + src/www/bongo/hawkeye/AgentView.py \ src/www/bongo/hawkeye/Auth.py \ src/www/bongo/hawkeye/BackupView.py \ src/www/bongo/hawkeye/HawkeyeHandler.py \ src/www/bongo/hawkeye/HawkeyePath.py \ + src/www/bongo/hawkeye/SystemView.py \ src/www/bongo/hawkeye/RootView.py \ src/www/bongo/hawkeye/Server.py \ src/www/bongo/hawkeye/ServerView.py \ @@ -311,6 +327,14 @@ dist_hawkeyetplbackup_DATA := \ hawkeyetplserverdir = $(htdocsdir)/hawkeye/server dist_hawkeyetplserver_DATA := \ src/www/hawkeye/server/index.tpl + +hawkeyetplsystemdir = $(htdocsdir)/hawkeye/system +dist_hawkeyetplsystem_DATA := \ + src/www/hawkeye/system/index.tpl + +hawkeyetplagentsdir = $(htdocsdir)/hawkeye/agents +dist_hawkeyetplagents_DATA := \ + src/www/hawkeye/agents/index.tpl hawkeyetpldir = $(htdocsdir)/hawkeye dist_hawkeyetpl_DATA := \ diff --git a/src/www/bongo/hawkeye/AgentsView.py b/src/www/bongo/hawkeye/AgentsView.py deleted file mode 100644 index 8be0502..0000000 --- a/src/www/bongo/hawkeye/AgentsView.py +++ /dev/null @@ -1,19 +0,0 @@ -import bongo.dragonfly -import Hawkeye -from HawkeyeHandler import HawkeyeHandler - -class AgentsHandler(HawkeyeHandler): - def ParsePath(self, rp): - rp.pathInfo = Hawkeye.SplitQueryArgs(rp.path) - - def index_GET(self, req, rp): - vars = {"mdb" : self.GetMdb(req)} - return self.SendTemplate(req, rp, "index.psp", vars) - - def edit_GET(self, req, rp): - vars = {"mdb" : self.GetMdb(req)} - return self.SendTemplate(req, rp, "edit.psp", vars) - - def edit_POST(self, req, rp): - vars = {"mdb" : self.GetMdb(req)} - return self.SendTemplate(req, rp, "edit.psp", vars) diff --git a/src/www/bongo/hawkeye/BackupView.py b/src/www/bongo/hawkeye/BackupView.py index cfc38b0..cb0efa7 100644 --- a/src/www/bongo/hawkeye/BackupView.py +++ b/src/www/bongo/hawkeye/BackupView.py @@ -13,6 +13,8 @@ class BackupHandler(HawkeyeHandler): def index_GET(self, req, rp): today = datetime.date.today() self.SetVariable("set", today.strftime("%y%m%d")) + self.SetVariable("breadcrumb", "System » Backup and Restore"); + self.SetVariable("systab", "selecteditem"); return self.SendTemplate(req, rp, "index.tpl") def download_GET(self, req, rp): diff --git a/src/www/bongo/hawkeye/HawkeyePath.py b/src/www/bongo/hawkeye/HawkeyePath.py index cbcaa84..438f610 100644 --- a/src/www/bongo/hawkeye/HawkeyePath.py +++ b/src/www/bongo/hawkeye/HawkeyePath.py @@ -6,12 +6,16 @@ from bongo.dragonfly.BongoSession import BongoSession from bongo.dragonfly.HttpError import HttpError import RootView +import AgentView import BackupView import ServerView +import SystemView views = { "root" : RootView.RootHandler(), + "agents" : AgentView.AgentHandler(), "backup" : BackupView.BackupHandler(), + "system" : SystemView.SystemHandler(), "server" : ServerView.ServerHandler() } diff --git a/src/www/bongo/hawkeye/RootView.py b/src/www/bongo/hawkeye/RootView.py index 788fff9..b21f97d 100644 --- a/src/www/bongo/hawkeye/RootView.py +++ b/src/www/bongo/hawkeye/RootView.py @@ -1,4 +1,5 @@ import bongo.dragonfly +import os import bongo.dragonfly.BongoUtil from HawkeyeHandler import HawkeyeHandler import bongo.hawkeye.Auth as Auth @@ -10,7 +11,34 @@ class RootHandler(HawkeyeHandler): else: return True + def memory(self, VmKey): + '''Return process memory usage in bytes. + ''' + _scale = {'kB': 1024.0, 'mB': 1024.0*1024.0, + 'KB': 1024.0, 'MB': 1024.0*1024.0} + + try: # get the /proc//status pseudo file + t = open('/proc/meminfo') + v = [v for v in t.readlines() if v.startswith(VmKey)] + t.close() + + # convert Vm value to bytes + if len(v) == 1: + t = v[0].split() # e.g. 'VmRSS: 9999 kB' + if len(t) == 3: ## and t[0] == VmKey: + return float(t[1]) * _scale.get(t[2], 0.0) + except: + pass + return 0.0 + def index_GET(self, req, rp): + cm = self.memory("MemTotal:") + used = cm - self.memory("MemFree:") + used = used / 1024 / 1024 + cm = cm / 1024 / 1024 + self.SetVariable("mem", str(round(used, 2)) + "MB / " + str(round(cm, 2)) + "MB") + self.SetVariable("breadcrumb", "Desktop") + self.SetVariable("dsktab", "selecteditem") return self.SendTemplate(req, rp, "index.tpl") def test_GET(self, req, rp): diff --git a/src/www/bongo/hawkeye/ServerView.py b/src/www/bongo/hawkeye/ServerView.py index fe4b26f..9bc9b0c 100644 --- a/src/www/bongo/hawkeye/ServerView.py +++ b/src/www/bongo/hawkeye/ServerView.py @@ -22,6 +22,9 @@ class ServerHandler(HawkeyeHandler): else: self.SetVariable("success", 0) + self.SetVariable("breadcrumb", "Agents » Enable/Disable Agents"); + self.SetVariable("agntab", "selecteditem"); + return self.SendTemplate(req, rp, "index.tpl") def index_POST(self, req, rp): diff --git a/src/www/bongo/hawkeye/SummaryView.py b/src/www/bongo/hawkeye/SummaryView.py index b6e6f7c..3bee11a 100644 --- a/src/www/bongo/hawkeye/SummaryView.py +++ b/src/www/bongo/hawkeye/SummaryView.py @@ -1,6 +1,39 @@ +import os import bongo.dragonfly from HawkeyeHandler import HawkeyeHandler class SummaryHandler(HawkeyeHandler): + _proc_status = '/proc/%d/status' % os.getpid() # Linux only? + _scale = {'kB': 1024.0, 'mB': 1024.0*1024.0, + 'KB': 1024.0, 'MB': 1024.0*1024.0} + + def _VmB(VmKey): + global _scale + try: # get the /proc//status pseudo file + t = open(_proc_status) + v = [v for v in t.readlines() if v.startswith(VmKey)] + t.close() + # convert Vm value to bytes + if len(v) == 1: + t = v[0].split() # e.g. 'VmRSS: 9999 kB' + if len(t) == 3: ## and t[0] == VmKey: + return float(t[1]) * _scale.get(t[2], 0.0) + except: + pass + return 0.0 + + def memory(since=0.0): + '''Return process memory usage in bytes. + ''' + return _VmB('VmSize:') - since + + def stacksize(since=0.0): + '''Return process stack size in bytes. + ''' + return _VmB('VmStk:') - since + def index_GET(self, req, rp): + self.SetVariable("mem", memory()) + self.SetVariable("breadcrumb", "Desktop") + self.SetVariable("dsktab", "selecteditem") return self.SendTemplate(req, rp, "index.tpl", vars) diff --git a/src/www/css/admin.css b/src/www/css/admin.css index 23797c9..5094be6 100644 --- a/src/www/css/admin.css +++ b/src/www/css/admin.css @@ -1,74 +1,66 @@ -* { - font-family: sans-serif; -} - -html, body { - overflow: auto; - margin: 0; - padding: 0; - border: 0; -} +/* + Bongo web administration interface (aka Hawkeye) stylesheet + (c) 2007 Alexander Hixon - see COPYING for details + Last modified: Sunday May 6, 2007 +*/ body { - border-top: 2px solid #d4dceb; - background-color: #627aa3; /* #b4c5e1; */ + background-color: #eeeeec; + font-size: 12px; + font-family: Verdana, Arial, Helvetica, SunSans-Regular, Sans-Serif; + color:#2e3436; + padding:0px; + margin:0px; + + height: 100%; /* Blasted IE! */ } -img#logo { - position: absolute; - top: 40px; - left: 40px; - width: 339px; - height: 59px; +#login { + position:absolute; + height:200px; + width:400px; + margin:-100px 0px 0px -200px; + top: 50%; + left: 50%; + + text-align: center; + padding: 0px; + background-image: url('../img/login-pane.png'); + background-repeat: no-repeat; /* Make sure this doesn't actually happen. */ + overflow: none; } -ul.navigation { - position: absolute; - top: 110px; - left: 40px; - width: 150px; - background-color: white; - padding: 10px; - border: 1px solid #555; - margin: 0; +form { + padding: 16px; + padding-top: 6.5em; } -ul.navigation li { - list-style: none; - margin: 0; - text-align: left; +.inputbox { + margin-bottom: 2px; } -ul.navigation li a { - display: block; - text-decoration: none; - padding: .25em; - color: black; - border-bottom: 1px solid #555; +.submit { + padding-top: 2em; + padding-bottom: 0px; + margin-bottom: 0px; } -ul.navigation li a:hover { - background-color: #ddd; +input { + color: #555753; + border: 1px solid #2e3436; } -div#content { - position: absolute; - top: 110px; - right: 20px; - left: 220px; - border: 1px solid #555; - background-color: white; - padding: 10px; +.username { + background-image: url('../img/user.png'); } -div#login { - position: absolute; - top: 200px; - left: 220px; - width: 500px; - height: 250px; - background-color: white; - padding: 20px; - text-align: right; - border: 1px solid #555; +.password { + background-image: url('../img/locked.png'); +} + +.password, .username { + padding-left: 22px; + min-height: 18px; + background-color: #eeeeec; + background-repeat: no-repeat; } diff --git a/src/www/css/hawkeye.css b/src/www/css/hawkeye.css new file mode 100644 index 0000000..bf800ca --- /dev/null +++ b/src/www/css/hawkeye.css @@ -0,0 +1,158 @@ + /* body and font definitions */ +body { + background: url('/img/bg.png'); + background-repeat: repeat-x; + background-color: #fff; + margin-top: 25px; + margin-left: 60px; + margin-right: 60px; + +} + +html>body { + font-family: luxi sans, trebuchet ms, bitstream vera sans, sans-serif; +} + +#userinfo { +padding-top: 20px; +font-size: 80%; +float: right; +} +#logo { +margin-bottom: 60px; +} +p { +/*padding-left: 12px; +padding-right: 12px;*/ +font-size: 90%; +color: #2e3436; /* Tango DARK-GREY */ +} + +#page { + background: url('/img/cbg.png'); + background-repeat: repeat-x; + background-color: #eeeeec; /* Tango GREY */ +/* float: left;*/ +/* width: 100% - 175px;*/ +/* margin: 0px;*/ + + margin-left: 165px; /* Push across width of sidebar, minus 10px, for bg behind round corner */ + padding-left: 10px; /* Prints BG for 10px, now flush with sidebar */ + + padding-top: 6px; + +/* z-index: -1;*/ + +/* padding-right: 8px; */ +/* padding-left: 16px;*/ +/* margin-left: 280px;*/ +min-height: 500px; +} +#content { + padding-left: 12px; + padding-right: 12px; +} + +#sidebar { +color: #eeeeec; /* Tango WHITE */ +/* background: url('/img/sbg.png'); + background-repeat: repeat-x;*/ + background-color: #2e3436; /* Tango DARK-GREY */ +float: left; +height: 500px; +width: 175px; + +text-align: right; +margin-right: 0px; +padding-right: 0px; +-moz-border-radius: 15px; +} +.helpitem { +/* FIXME! */ +} +.selecteditem { +background-image: url('/img/sel.png'); +width: 175px; +background-repeat: repeat-none; +color: #2e3436; +} + + +ul.nav, +.nav ul{ +/*Remove all spacings from the list items*/ +/*float: right;*/ +/*display: block; */ +margin-right: 0px; +padding-left: 4px; +margin-left: 6px; +/*padding-left: 0px; /* Use this instead of margin? */ +padding-right: 0px; +/* cursor: default;*/ + list-style-type: none; +} +a.nav, +.nav a{ +color: #eeeeec; +text-decoration:none; +} + +a.selecteditem, +.selecteditem a, +.selecteditem a:link, +.selecteditem a:visited { +color: #2e3436; +text-decoration:none; +} + +li.nav, +.nav li{ + display: block; + font-size: 115%; /* Bold maybe? */ + min-height: 35px; +/* color: #eeeeec;*/ + text-align: left; + + padding-left: 15%; + + padding-right: 15px; + margin-bottom: 15px; +text-decoration:none; + margin-top: 5px; + width: 95%; +} + +img.icon { + margin-right: 6px; + vertical-align:middle; +} + +.breadcrumb { + font-size: 75%; +} +ul.nav{ + width: 100%; +} +.htable { +border: 2px solid #2e3436; +font-size: 110%; +} + +.hrow { +background-color: #2e3436; +color: #eeeeec; +padding-left: 4px; +} +.tlist { +padding-bottom: 3px; +padding-top: 3px; +font-size: 80%; +padding-left: 16px; +} + +.floaty { +float: right; +padding-left: 16px; +padding-right: 16px; +display: block; +} diff --git a/src/www/hawkeye/footer.tpl b/src/www/hawkeye/footer.tpl index de32b55..19d0481 100644 --- a/src/www/hawkeye/footer.tpl +++ b/src/www/hawkeye/footer.tpl @@ -1,5 +1,5 @@ - + diff --git a/src/www/hawkeye/header.tpl b/src/www/hawkeye/header.tpl index 41a6e97..b635599 100644 --- a/src/www/hawkeye/header.tpl +++ b/src/www/hawkeye/header.tpl @@ -1,22 +1,29 @@ - + + - Bongo Web Administration - + + Bongo Web Administration - %(breadcrumb)s + - - - - - +
Logged in as: admin [logout]
+ + +
+ + diff --git a/src/www/hawkeye/root/index.tpl b/src/www/hawkeye/root/index.tpl index 3562cea..bd7de04 100644 --- a/src/www/hawkeye/root/index.tpl +++ b/src/www/hawkeye/root/index.tpl @@ -1,7 +1,39 @@ %(include|header.tpl)s +Welcome to Bongo +

Welcome

+

Thank you for choosing Bongo as your calendaring and mail solution.

+

This screen enables you to briefly overview your system status, and to access commonly and recently used tasks.

+

Help can be accessed by clicking on the help menu at any time.
To get started, either click on one of the menus to the left, or click on one of the common tasks listed below.

-

This is the admin tool. Under construction, obviously :)

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
System StatusSpace time continuum stable.
Agent StatusOperation normal.
Bongo UpdatesCritical security update available.Warning
Memory Usage%(mem)s
LoadUnknown
-%(include|footer.tpl)s + +%(include|footer.tpl)s \ No newline at end of file diff --git a/src/www/hawkeye/root/login.tpl b/src/www/hawkeye/root/login.tpl index e2743e4..de4eba3 100644 --- a/src/www/hawkeye/root/login.tpl +++ b/src/www/hawkeye/root/login.tpl @@ -1,28 +1,21 @@ - + + - Bongo Web Administration - + Bongo Web Administration › Login - + - - - - +
- -

Login Required

- -
-

User name:

-

Password:

- -
- +
+ + +
+
- - + \ No newline at end of file diff --git a/src/www/hawkeye/server/index.tpl b/src/www/hawkeye/server/index.tpl index 21e40b0..f749990 100644 --- a/src/www/hawkeye/server/index.tpl +++ b/src/www/hawkeye/server/index.tpl @@ -1,6 +1,6 @@ %(include|header.tpl)s -

Server Settings

+

Enable/Disable Agents

No message.

@@ -12,7 +12,7 @@
- +
diff --git a/src/www/img/Bongo-logo.png b/src/www/img/Bongo-logo.png new file mode 100755 index 0000000..a752adc Binary files /dev/null and b/src/www/img/Bongo-logo.png differ diff --git a/src/www/img/bg.png b/src/www/img/bg.png new file mode 100755 index 0000000..086e877 Binary files /dev/null and b/src/www/img/bg.png differ diff --git a/src/www/img/cbg.png b/src/www/img/cbg.png new file mode 100755 index 0000000..4cfc20c Binary files /dev/null and b/src/www/img/cbg.png differ diff --git a/src/www/img/dialog-warning.png b/src/www/img/dialog-warning.png new file mode 100644 index 0000000..a9e4ff3 Binary files /dev/null and b/src/www/img/dialog-warning.png differ diff --git a/src/www/img/help-browser.png b/src/www/img/help-browser.png new file mode 100644 index 0000000..d60425f Binary files /dev/null and b/src/www/img/help-browser.png differ diff --git a/src/www/img/locked.png b/src/www/img/locked.png new file mode 100644 index 0000000..4009def Binary files /dev/null and b/src/www/img/locked.png differ diff --git a/src/www/img/login-pane.png b/src/www/img/login-pane.png new file mode 100644 index 0000000..0c2c049 Binary files /dev/null and b/src/www/img/login-pane.png differ diff --git a/src/www/img/network-server.png b/src/www/img/network-server.png new file mode 100644 index 0000000..1d38e4f Binary files /dev/null and b/src/www/img/network-server.png differ diff --git a/src/www/img/sel.png b/src/www/img/sel.png new file mode 100755 index 0000000..ee4defd Binary files /dev/null and b/src/www/img/sel.png differ diff --git a/src/www/img/system-installer.png b/src/www/img/system-installer.png new file mode 100644 index 0000000..c26576e Binary files /dev/null and b/src/www/img/system-installer.png differ diff --git a/src/www/img/system-users.png b/src/www/img/system-users.png new file mode 100644 index 0000000..749c825 Binary files /dev/null and b/src/www/img/system-users.png differ diff --git a/src/www/img/user-desktop.png b/src/www/img/user-desktop.png new file mode 100644 index 0000000..57fb177 Binary files /dev/null and b/src/www/img/user-desktop.png differ diff --git a/src/www/img/user.png b/src/www/img/user.png new file mode 100644 index 0000000..ed35fe0 Binary files /dev/null and b/src/www/img/user.png differ diff --git a/src/www/img/welcome-box.png b/src/www/img/welcome-box.png new file mode 100644 index 0000000..04abdc5 Binary files /dev/null and b/src/www/img/welcome-box.png differ
Enabled? Agent Name