This commit is contained in:
darthsandmann
2016-10-16 21:53:15 +02:00
parent 0d10f8b9dc
commit c9f3117da1
412 changed files with 137942 additions and 0 deletions

View File

@ -0,0 +1 @@
# python package initialization

View File

@ -0,0 +1,82 @@
# coding: utf-8
import cherrypy
import json
import codecs
#--------------------------------------
class Application_cl(object):
#---------------------------------------------------
def __init__(self):
#---------------------------------------------------
# constructor
pass
#---------------------------------------------------
#---------------------------------------------------
def module(self):
#---------------------------------------------------
anfang_s = """
<!DOCTYPE html>
<html>
<head>
<script src="main.js">
</script>
<title>
Titel
</title>
<meta charset= "UTF-8"/>
</head>
<body>"""
ende_s = """
</body>
</html>"""
# Inhalt der Datei "module.json" im Verzeichnis "data"
# einlesen und als Python-Datenstruktur ablegen
# verwenden Sie dazu das Modul "json"
json_modul = codecs.open("./data/module.json", "r", "UTF-8")
modul_inhalt = json.load(json_modul)
json_modul.close()
##markup_s = modul_inhalt
# anschließend einfaches Markup aufbauen:
# einleitenden Teil des Markups zuweisen
# Schleife über alle Einträge in der Python-Datenstruktur:
# Daten extrahieren und weiteres Markup damit erzeugen und anhängen
# abschließenden Teil des Markups anhängen
# erzeugtes Markup als Ergebnis zurückliefern
markup_s = anfang_s
#markup_s += "<ul>"
for key_s in sorted(modul_inhalt):
markup_s += "<ul> <h3 onclick=\"change_view('" + str(key_s) + "')\"" + ">" + str(key_s) + '</h3>' + '<div style="display:block;" id="' + str(key_s) + '">'
for key2_s in sorted(modul_inhalt[key_s]):
markup_s += '<li>' + str(modul_inhalt[key_s][key2_s])
markup_s += '</ul> </div>'
#markup_s += "</ul>"
markup_s += ende_s
return markup_s
module.exposed = True
#---------------------------------------------------
#---------------------------------------------------
def default(self, *arglist, **kwargs):
#---------------------------------------------------
msg_s = "unbekannte Anforderung: " + \
str (arglist) + \
'' +\
str (kwargs)
raise cherrypy.HTTPError(404, msg_s)
default.exposed = True
#---------------------------------------------------
# EOF

View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<title>
Titel
</title>
<meta charset= "UTF-8"/>
</head>
<body>
<p>
<a href="/module">Modul</a>
</p>
</body>
</html>

View File

@ -0,0 +1,14 @@
function change_view(idContainer){
var element_o = document.getElementById(idContainer);
if (element_o.style.display != "none"){
element_o.style.display = "none";
}
else{
element_o.style.display = "block";
}
}

View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<title>
Titel
</title>
<meta charset= "UTF-8"/>
</head>
<body>
<p>
Inhalt
</p>
<p>
<a href="/module">Modul</a>
</p>
</body>
</html>

View File

@ -0,0 +1,20 @@
{
"WEB": {
"bezeichnung": "Web-Engineering",
"studiengang": "Bachelor Informatik",
"semester": 3,
"beschreibung": "Hier kann man einen Beschreibungstext vorsehen"
},
"IAS": {
"bezeichnung": "Interaktive Systeme",
"studiengang": "Bachelor Informatik",
"semester": 4,
"beschreibung": "Hier kann man einen Beschreibungstext vorsehen"
},
"SWE": {
"bezeichnung": "Software Engineering",
"studiengang": "Bachelor Informatik",
"semester": 5,
"beschreibung": "Hier kann man einen Beschreibungstext vorsehen"
}
}

View File

@ -0,0 +1,39 @@
#coding: utf-8
import os
import cherrypy
from app import application
#--------------------------------------
def main():
#--------------------------------------
# Get current directory
try:
current_dir = os.path.dirname(os.path.abspath(__file__))
except:
current_dir = os.path.dirname(os.path.abspath(sys.executable))
# disable autoreload and timeout_monitor
cherrypy.engine.autoreload.unsubscribe()
cherrypy.engine.timeout_monitor.unsubscribe()
# Static content config
static_config = {
'/' : {
'tools.staticdir.root': current_dir,
'tools.staticdir.on': True,
'tools.staticdir.dir':'./content',
'tools.staticdir.index':'index.html'
}
}
# Mount static content handler
root_o = cherrypy.tree.mount(application.Application_cl() ,'/', static_config)
# suppress traceback-info
cherrypy.config.update({'request.show_tracebacks':False})
# Start server
cherrypy.engine.start()
cherrypy.engine.block()
#--------------------------------------
if __name__ == '__main__':
#--------------------------------------
main()
# EOF