Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneSeifert committed Jun 13, 2014
1 parent 08b4d16 commit 9424156
Show file tree
Hide file tree
Showing 301 changed files with 27,332 additions and 0 deletions.
6 changes: 6 additions & 0 deletions babel.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[python: **.py]
[jinja2: **/templates/**.html]
encoding = utf-8
extensions=jinja2.ext.autoescape,jinja2.ext.with_
[javascript: **.js]
extract_messages = $._, jQuery._
3 changes: 3 additions & 0 deletions emonitor/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

from webapp import create_app
webapp = create_app()
Empty file added emonitor/admin/__init__.py
Empty file.
93 changes: 93 additions & 0 deletions emonitor/admin/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
from collections import OrderedDict
import flask.ext.login as login
from emonitor.sockethandler import SocketHandler
from flask import Blueprint, request, render_template, send_from_directory, current_app, jsonify
from emonitor.decorators import login_required
from emonitor.user import User
from emonitor.extensions import babel, signal


admin = Blueprint('admin', __name__, template_folder="web/templates")
admin.modules = OrderedDict()
admin.processes = [] # dict for admin processes


def init_app(app):
signal.addSignal('admin', 'processes')
signal.connect('admin', 'processes', adminHandler.handleProcesses)

admin.init_app = init_app


def addModule(module):
if module.info['name'] not in admin.modules.keys():
admin.modules[module.info['name']] = module

admin.addModule = addModule


def addProcess(process):
if process not in admin.processes:
admin.processes.append(process)
#signal.send('admin.processes')

admin.addModule = addModule


babel.gettext(u'trigger.default')
babel.gettext(u'trigger.file_added')
babel.gettext(u'trigger.file_removed')


@admin.route('/admin')
@admin.route('/admin/')
@admin.route('/admin/<path:module>', methods=['GET', 'POST'])
@login_required
def adminContent(module=''):
try:
current_mod = [admin.modules[m] for m in admin.modules if admin.modules[m].info['path'] == module.split('/')[0]][0]
except:
current_mod = admin.modules['startpages']
current_app.logger.error("admin module %s not found" % module)

#return render_template('admin.html', modules=admin.modules, current_mod=current_mod, user=User.get(login.current_user.get_id() or 0), app_name=current_app.config.get('PROJECT'), app_version=current_app.config.get('APP_VERSION'), path='/admin/'+module)
return current_mod.getAdminContent(modules=admin.modules, current_mod=current_mod, user=User.get(login.current_user.get_id() or 0), app_name=current_app.config.get('PROJECT'), app_version=current_app.config.get('APP_VERSION'), path='/admin/'+module)


@admin.route('/admin/data/', methods=['GET', 'POST'])
@admin.route('/admin/data/<path:module>', methods=['GET', 'POST'])
def adminData(module=''):
current_mod = [admin.modules[m] for m in admin.modules if admin.modules[m].info['path'] == module.split('/')[0]][0]
result = current_mod.getAdminData()
if request.args.get('format') == 'json': # reformat to json
result = jsonify(result)
result.status_code = 200
return result


# static folders
@admin.route('/admin/img/<path:filename>')
def imagebase_static(filename):
return send_from_directory(admin.root_path + '/web/img/', filename)


@admin.route('/admin/js/<path:filename>')
def jsbase_static(filename):
return send_from_directory(admin.root_path + '/web/js/', filename)


@admin.route('/admin/css/<path:filename>')
def cssbase_static(filename):
return send_from_directory(admin.root_path + '/web/css/', filename)


class adminHandler(SocketHandler):
@staticmethod
def handleProcesses(sender, **extra):
# TODO: change process info
print "EXTRAS;", extra

if 'id' in extra:
SocketHandler.send_message(str(extra['id']))
else:
SocketHandler.send_message('admin.processes', **extra)
56 changes: 56 additions & 0 deletions emonitor/admin/translations/admin.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Translations template for PROJECT.
# Copyright (C) 2014 ORGANIZATION
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2014.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2014-03-16 21:48+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 1.3\n"

#: emonitor/admin/admin.py:20
msgid "trigger.default"
msgstr ""

#: emonitor/admin/admin.py:21
msgid "trigger.file_added"
msgstr ""

#: emonitor/admin/admin.py:22
msgid "trigger.file_removed"
msgstr ""

#: emonitor/admin/web/templates/admin.html:12
#: emonitor/admin/web/templates/admin.html:41
msgid "admin.titlemain"
msgstr ""

#: emonitor/admin/web/templates/admin.html:42
msgid "admin.frontendlink"
msgstr ""

#: emonitor/admin/web/templates/admin.html:50
msgid "admin.logout"
msgstr ""

#: emonitor/admin/web/templates/admin.html:84
msgid "layout.resize"
msgstr ""

#: emonitor/admin/web/templates/admin.html:85
msgid "layout.open"
msgstr ""

#: emonitor/admin/web/templates/admin.html:86
msgid "layout.closed"
msgstr ""

Binary file added emonitor/admin/translations/de/LC_MESSAGES/admin.mo
Binary file not shown.
59 changes: 59 additions & 0 deletions emonitor/admin/translations/de/LC_MESSAGES/admin.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright (C) 2014 ORGANIZATION
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2014.
#
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2014-03-16 21:48+0100\n"
"PO-Revision-Date: 2014-03-16 21:49+0100\n"
"Last-Translator: Arne Seifert <[email protected]>\n"
"Language-Team: de <[email protected]>\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 1.3\n"
"Language: de\n"
"X-Generator: Poedit 1.6.4\n"

#: emonitor/admin/admin.py:20
msgid "trigger.default"
msgstr "Standardansicht"

#: emonitor/admin/admin.py:21
msgid "trigger.file_added"
msgstr "Observer - Datei hinzugefügt"

#: emonitor/admin/admin.py:22
msgid "trigger.file_removed"
msgstr "Observer - Datei entfernt"

#: emonitor/admin/web/templates/admin.html:12
#: emonitor/admin/web/templates/admin.html:41
msgid "admin.titlemain"
msgstr "eMonitor - Administrationsbereich"

#: emonitor/admin/web/templates/admin.html:42
msgid "admin.frontendlink"
msgstr "Eingabeoberfläche"

#: emonitor/admin/web/templates/admin.html:50
msgid "admin.logout"
msgstr "abmelden"

#: emonitor/admin/web/templates/admin.html:84
msgid "layout.resize"
msgstr "Verschieben"

#: emonitor/admin/web/templates/admin.html:85
msgid "layout.open"
msgstr "Schließen"

#: emonitor/admin/web/templates/admin.html:86
msgid "layout.closed"
msgstr "Öffnen"

#~ msgid "admin.monitorlink"
#~ msgstr "Monitoroberfläche"
75 changes: 75 additions & 0 deletions emonitor/admin/web/css/admin.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@

body, html{height:100%;color: #000000; font-family:Verdana, Arial, Helvetica, sans-serif; font-weight:normal; text-decoration:none; text-align:left; font-size:11px;margin: 0;padding: 0;}
textarea{font-family:Verdana, Arial, Helvetica, sans-serif;}
a, a:visited{color:#B40431;text-decoration:none;}
a:hover{text-decoration:underline;}
label{font-weight: normal!important;}

div.maincontainer{margin:0;height:100%;background-color:#ddd;}

div.ui-layout-toggler:hover{background-color:#333;}
div.ui-layout-north{background-color: #ddd;width:100%;margin:0;padding:0;border-width:0 !important;overflow:hidden;}
div.ui-layout-north div.header_links{position:absolute;top:15px;right:35px;}
div.ui-layout-north div.header_links a{color:black;}
div.user{position:absolute;right:10px;top:13px;}
div.user a, div.user a img{border-width:0;}
div.user a:hover{text-decoration:none;}
div.user ul { margin:0; padding: 0; list-style: none; cursor: pointer; position: relative; text-align:right;}
div.user ul li { padding: 0.25em 3px 0.3em 15px;}
div.user ul ul { z-index: 200000; display: none; position: absolute; right: 0; bottom: 0; margin: 0 0 1.55em; text-align:right;border:1px solid black;}
div.user .dropdown ul ul { bottom: auto; margin: 1.45em 0 0;}
div.user ul ul li { padding: 0.3em 5px 0.3em 5px;}
div.user ul ul li:hover { background-color: #ababab;}
div.user ul li:hover ul { display: block; background-color: #dedede;z-index: 200000;}
div.content{margin:0;border-width:0 !important;}

div.ui-layout-center{border-right-width:0;}
div.ui-layout-south{width:100%;background-color:#333;position:fixed;bottom:0;left:0;height:15px;border:0 !important;}
div.ui-layout-west{background-color:#ddd !important;float:left;width:200px;height:100%;position:fixed;margin:0 !important;border-left-width:0 !important;padding: 26px 0 0;}
div.ui-layout-west ul{list-style-type:none;padding:0;margin:0;}
div.ui-layout-west li{border-bottom:1px solid #bbb}
div.ui-layout-west a{color:black;text-decoration:none;display:block;padding:10px;text-shadow: 1px 1px 0 #f2f2f2;}
div.ui-layout-west a:hover{font-weight:bolder;text-decoration:none;background-color:#fff;}
div.ui-layout-west a.active{font-weight:bolder;text-decoration:none;background-color:#333;color:#fff;text-shadow: none;}
div.ui-layout-west a.active:hover{background-color:#000;}

div.subnavigation{width:100%;background-color:#ddd;border-width:0 0 1px 0 !important;min-height:23px !important;overflow:hidden;padding:0 !important;}
div.subnavigation a{float:left;padding:6px 20px;display:block;color:#000;border-right:1px solid #bbb;text-transform:uppercase;margin:0;text-shadow: 1px 1px 0 #f2f2f2;}
div.subnavigation a:hover{background-color:#fff;text-decoration:none;color:#000;border-top-color:#fff;}
div.subnavigation a.selected{background-color:#333;color:#fff;border-top-color:#333;text-shadow:none;}
div.subnavigation a.selected:hover{background-color:#000;border-top-color:#000;}

div.subnavigationeast{width:200px;background-color:#ddd/*rgb(171, 171, 171)*/;border-width:0 0 0 1px !important;padding:0 !important;overflow:auto !important}
div.maincontainer div.pane div.ui-layout-resizer-east{border-left:1px solid #bbb}

p button.save, p button.cancel{padding:5px 40px;}

div.headrow{background-color: #ababab;font-weight:bolder;overflow:hidden;padding:10px 4px;}
div.headcell{float:left;}
div.subheadrow{background-color:#F2F2F2;font-weight:bolder;overflow:hidden;padding:4px 4px;border:1px solid silver;border-top-width:0;}
div.subheadcell{float:left;}
div.rowadd{position:relative;overflow:hidden;padding:1px 4px;background-color:#fff/*rgb(222, 222, 222)*/;border:1px solid silver;border-top:0;}
div.row{position:relative;overflow:hidden;padding:1px 4px!important;background-color:#fff/*rgb(222, 222, 222)*/;border:1px solid silver;border-top:0;margin:0 !important;}
div.row:hover{background-color: #dedede /*#fff*/;cursor:default;}
div.row .morelink{background:url(/img/more.png) no-repeat 3px transparent;border:0;position:absolute;top:3px;width:20px;height:20px;}
div.row .morelink:hover{background:url(/img/moreover.png) no-repeat 3px transparent;}
div.row .expanded{background:url(/img/details.png) no-repeat 3px transparent;}
div.row .expanded:hover{background:url(/img/details.png) no-repeat 3px transparent;}
div.rowcell{float:left;margin-top:4px;}
div.subrow{position:relative;overflow:hidden;padding:1px 4px;background-color:#fff;border:1px solid silver;border-top:0;}
div.subrow:hover{background-color: #dedede;cursor:default;}
div.subrowcell{float:left;margin-top:4px;}
div.rownoentry{border:1px solid silver;min-height:40px;}
div.row button, div.subrow button{float:right;width:22px;height:22px;padding:1px;margin: 0px 0px 0px 2px}
div.headrow button.add{float:right;width:24px;height:21px;margin:0;padding: 0;}
div.subheadrow button.add{float:right;width:24px;height:21px;margin:0;padding: 0;}
div.rowadd button.save{float:right;width:46px;height:21px;padding:1px; margin: 4px 0 0 2px;}

div.overlay{position:fixed;top:0;left:0;right:0;bottom:0;z-index:10;display:none;}
div.overlay div.overlay_back{width:100%;height:100%;background-color:#fff;opacity: 0.5; -moz-opacity: 0.5; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";filter:alpha(opacity=50);}
div.overlay div.popup{display:block;position:absolute;top:0;left:0;right:0;bottom:0;width:500px;height:300px;margin:auto;border:1px solid silver;background-color:#fff;z-index:11;box-shadow:5px 5px 5px #BBB;}
div.popup_close{position:absolute;top:-10px;right:-10px;}
div.popup_close a img{border:0;}

div.version{background:url(/img/logo.png) no-repeat 0 0 transparent;position:absolute;left:2px; bottom:2px;height:30px;padding-left:30px;}
.required{margin-left:5px;color:red;}
1 change: 1 addition & 0 deletions emonitor/admin/web/css/admin.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added emonitor/admin/web/img/activate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added emonitor/admin/web/img/loading.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added emonitor/admin/web/img/updating.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions emonitor/admin/web/js/admin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

window.WebSocket=window.WebSocket || window.MozWebSocket || false;
if(!window.WebSocket){
$('#ws').html("-");
console.log('websockets not supportetd');
}else {
ws = new WebSocket("ws://"+location.host+"/ws");
ws.onclose=function(){
$('#ws').html('<i class="fa fa-eye-slash fa-lg"></i>');
}
}
Loading

0 comments on commit 9424156

Please sign in to comment.