PPM2: select
This commit is contained in:
parent
f0db62320a
commit
1b35f02647
@ -1,72 +1 @@
|
||||
body {
|
||||
font-family: "Open Sans", sans-serif;
|
||||
font-size: 12pt;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
td {
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
th {
|
||||
height: 50px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
li {
|
||||
}
|
||||
|
||||
ul {
|
||||
padding-left: 30px;
|
||||
list-style-type: square;
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
|
||||
label {
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 200px;
|
||||
border: none;
|
||||
border-bottom: 2px solid black;
|
||||
font-size: 12pt;
|
||||
}
|
||||
|
||||
input.button {
|
||||
background-color: #eeeeee;
|
||||
color: black;
|
||||
padding: 5px 10px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
border: none;
|
||||
}
|
||||
|
||||
input.button:hover, input.button:active {
|
||||
background-color: #e7e7e7;
|
||||
}
|
||||
|
||||
idWTForm {
|
||||
}
|
||||
|
||||
|
||||
|
||||
a:link, a:visited {
|
||||
background-color: #eeeeee;
|
||||
color: black;
|
||||
padding: 5px 10px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
|
||||
a:hover, a:active {
|
||||
background-color: #e7e7e7;
|
||||
}
|
||||
|
||||
a.clDelete {
|
||||
}
|
||||
|
||||
body{font-family:"Open Sans",sans-serif;font-size:12pt;padding:0;margin:0;}td{border:1px solid black;}th{height:50px;border:1px solid black;}li{}ul{padding-left:30px;list-style-type:square;margin-bottom:50px;}label{padding-left:15px;}input{width:200px;border:none;border-bottom:2px solid black;font-size:12pt;}input.button{background-color:#eeeeee;color:black;padding:5px 10px;text-align:center;text-decoration:none;display:inline-block;border:none;}input.button:hover,input.button:active{background-color:#e7e7e7;}idWTForm{}a:link,a:visited{background-color:#eeeeee;color:black;padding:5px 10px;text-align:center;text-decoration:none;display:inline-block;}a:hover,a:active{background-color:#e7e7e7;}a.clDelete{}
|
BIN
Praktikum2/AufgabePrak2A.pdf
Normal file
BIN
Praktikum2/AufgabePrak2A.pdf
Normal file
Binary file not shown.
0
Praktikum2/ppm1/app/__init__.py
Normal file
0
Praktikum2/ppm1/app/__init__.py
Normal file
BIN
Praktikum2/ppm1/app/__pycache__/__init__.cpython-35.pyc
Normal file
BIN
Praktikum2/ppm1/app/__pycache__/__init__.cpython-35.pyc
Normal file
Binary file not shown.
BIN
Praktikum2/ppm1/app/__pycache__/application.cpython-35.pyc
Normal file
BIN
Praktikum2/ppm1/app/__pycache__/application.cpython-35.pyc
Normal file
Binary file not shown.
BIN
Praktikum2/ppm1/app/__pycache__/database.cpython-35.pyc
Normal file
BIN
Praktikum2/ppm1/app/__pycache__/database.cpython-35.pyc
Normal file
Binary file not shown.
BIN
Praktikum2/ppm1/app/__pycache__/view.cpython-35.pyc
Normal file
BIN
Praktikum2/ppm1/app/__pycache__/view.cpython-35.pyc
Normal file
Binary file not shown.
284
Praktikum2/ppm1/app/application.py
Normal file
284
Praktikum2/ppm1/app/application.py
Normal file
@ -0,0 +1,284 @@
|
||||
import cherrypy
|
||||
from .database import Database_cl
|
||||
from .view import View_cl
|
||||
import collections
|
||||
orderedDict = collections.OrderedDict()
|
||||
from collections import OrderedDict
|
||||
|
||||
#----------------------------------------------------------
|
||||
class Application_cl(object):
|
||||
#----------------------------------------------------------
|
||||
|
||||
#-------------------------------------------------------
|
||||
# Request Processing
|
||||
#-------------------------------------------------------
|
||||
|
||||
#-------------------------------------------------------
|
||||
def __init__(self):
|
||||
#-------------------------------------------------------
|
||||
# spezielle Initialisierung können hier eingetragen werden
|
||||
self.db = Database_cl()
|
||||
self.view = View_cl()
|
||||
@cherrypy.expose
|
||||
|
||||
#-------------------------------------------------------
|
||||
def index(self):
|
||||
#-------------------------------------------------------
|
||||
print("Index\n")
|
||||
return self.GenerateIndex()
|
||||
@cherrypy.expose
|
||||
|
||||
#-------------------------------------------------------
|
||||
def category(self, cat=None):
|
||||
#-------------------------------------------------------
|
||||
print("Category: ", cat, "\n")
|
||||
if(cat==None):
|
||||
return self.GenerateIndex()
|
||||
else:
|
||||
return self.GenerateList(cat)
|
||||
@cherrypy.expose
|
||||
|
||||
#-------------------------------------------------------
|
||||
def choice(self):
|
||||
#-------------------------------------------------------
|
||||
print("Choice \n")
|
||||
return self.GenerateListChoice()
|
||||
@cherrypy.expose
|
||||
|
||||
#-------------------------------------------------------
|
||||
def eval(self, cat):
|
||||
#-------------------------------------------------------
|
||||
print("Eval \n")
|
||||
self.db.CheckDates()
|
||||
return self.GenerateListEval(cat)
|
||||
@cherrypy.expose
|
||||
|
||||
#-------------------------------------------------------
|
||||
def detail(self, cat=None, id=None):
|
||||
#-------------------------------------------------------
|
||||
if(cat!=None):
|
||||
if(id!=None):
|
||||
print("Cat=", cat, " id=", id)
|
||||
return self.GenerateDetail(cat, id)
|
||||
else:
|
||||
print("ID=None Cat=", cat)
|
||||
return self.GenerateDetail(cat)
|
||||
else:
|
||||
return self.GenerateIndex()
|
||||
@cherrypy.expose
|
||||
|
||||
#-------------------------------------------------------
|
||||
def detailchoice(self, id):
|
||||
#-------------------------------------------------------
|
||||
print("id=", id)
|
||||
return self.GenerateDetailChoice(id)
|
||||
|
||||
@cherrypy.expose
|
||||
|
||||
#-------------------------------------------------------
|
||||
def save(self, cat=None, **data):
|
||||
#-------------------------------------------------------
|
||||
print("Save: ", cat)
|
||||
dataTmp = data
|
||||
return self.GenerateSave(dataTmp, cat)
|
||||
@cherrypy.expose
|
||||
|
||||
#-------------------------------------------------------
|
||||
def saveChoice(self, **data):
|
||||
#-------------------------------------------------------
|
||||
print("Save: Choice")
|
||||
dataTmp = data
|
||||
return self.GenerateSaveChoice(dataTmp)
|
||||
@cherrypy.expose
|
||||
|
||||
#-------------------------------------------------------
|
||||
def delete(self, cat=None, id=None):
|
||||
#-------------------------------------------------------
|
||||
print("Delete",cat,id)
|
||||
return self.GenerateDelete(cat, id)
|
||||
@cherrypy.expose
|
||||
|
||||
#-------------------------------------------------------
|
||||
def default(self, *arguments, **kwargs):
|
||||
#-------------------------------------------------------
|
||||
msg_s = "unbekannte Anforderung: " + \
|
||||
str(arguments) + \
|
||||
''+ \
|
||||
str(kwargs)
|
||||
raise cherrypy.HTTPError(404, msg_s)
|
||||
default.exposed= True
|
||||
|
||||
#-------------------------------------------------------
|
||||
# Functions
|
||||
#-------------------------------------------------------
|
||||
|
||||
#-------------------------------------------------------
|
||||
def GenerateIndex(self):
|
||||
#-------------------------------------------------------
|
||||
return self.view.CreateIndex()
|
||||
|
||||
#-------------------------------------------------------
|
||||
def GenerateList(self, category):
|
||||
#-------------------------------------------------------
|
||||
self.db.ReadAll()
|
||||
data = {}
|
||||
data['content'] = {}
|
||||
data['headings'] = {}
|
||||
data['category'] = category
|
||||
data['content'] = self.db.data[category]
|
||||
if(len(data['content']) != 0):
|
||||
print(len(data['content']))
|
||||
contentFirst = list(data['content'].keys())[0]
|
||||
data['headings'] = list(data['content'][contentFirst].keys())
|
||||
print(data)
|
||||
return self.view.CreateList(data)
|
||||
|
||||
#-------------------------------------------------------
|
||||
def GenerateListChoice(self):
|
||||
#-------------------------------------------------------
|
||||
self.db.ReadAll()
|
||||
data = {}
|
||||
data['content'] = {}
|
||||
offerings = self.db.data['Angebote']
|
||||
for key, value in offerings.items():
|
||||
for key2, value2 in value.items():
|
||||
if(key2 == 'Status'):
|
||||
if(value2 == 'Angebot'):
|
||||
data['content'][key] = value
|
||||
|
||||
print(data)
|
||||
return self.view.CreateListChoice(data)
|
||||
|
||||
#-------------------------------------------------------
|
||||
def GenerateDetail(self, category, id=None):
|
||||
#-------------------------------------------------------
|
||||
self.db.ReadAll()
|
||||
data = {}
|
||||
data['category'] = category
|
||||
print("Detail",category,id)
|
||||
if(id != None):
|
||||
data['id'] = id
|
||||
data['content'] = self.db.ReadEntry(category, id)
|
||||
else:
|
||||
data['id'] = None
|
||||
data['content'] = self.db.GetDefault(category)
|
||||
print(data['content'])
|
||||
if(category == 'Angebote'):
|
||||
print("Angebote")
|
||||
data['Firmen'] = self.db.data['Firmen']
|
||||
print(data, "\n")
|
||||
return self.view.CreateDetail(data)
|
||||
|
||||
#-------------------------------------------------------
|
||||
def GenerateDetailChoice(self, id):
|
||||
#-------------------------------------------------------
|
||||
self.db.ReadAll()
|
||||
data = {}
|
||||
data['id'] = id
|
||||
data = self.db.data['Angebote'][id]
|
||||
data['Studenten'] = self.db.data['Studenten']
|
||||
data['Lehrender'] = self.db.data['Lehrender']
|
||||
print(data, "\n")
|
||||
return self.view.CreateDetailChoice(data)
|
||||
|
||||
#-------------------------------------------------------
|
||||
def GenerateListEval(self, cat):
|
||||
#-------------------------------------------------------
|
||||
self.db.ReadAll()
|
||||
data = {}
|
||||
Studenten = self.db.data['Studenten']
|
||||
Lehrender = self.db.data['Lehrender']
|
||||
Firmen = self.db.data['Firmen']
|
||||
Angebote = self.db.data['Angebote']
|
||||
|
||||
data['category'] = cat
|
||||
if(cat == 'Firmen'):
|
||||
for keyFirma, valueFirma in sorted(Firmen.items()):
|
||||
data[valueFirma['Name']] = {}
|
||||
data[valueFirma['Name']]['Name'] = valueFirma['Name']
|
||||
data[valueFirma['Name']]['Angebote'] = {}
|
||||
data[valueFirma['Name']]['Angebote']['Angebot'] = {}
|
||||
data[valueFirma['Name']]['Angebote']['aktuell'] = {}
|
||||
data[valueFirma['Name']]['Angebote']['abgeschlossen'] = {}
|
||||
for keyAngebote, valueAngebote in Angebote.items():
|
||||
if(valueAngebote['Firma'] == valueFirma['Name']):
|
||||
data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']] = {}
|
||||
data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']]['Name'] = valueAngebote['Name']
|
||||
if(valueAngebote['Student'] != ''):
|
||||
data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']]['Student'] = Studenten[valueAngebote['Student']]['Name']
|
||||
else:
|
||||
data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']]['Student'] = ''
|
||||
if(valueAngebote['Lehrender'] != ''):
|
||||
data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']]['Lehrender'] = Lehrender[valueAngebote['Lehrender']]['Name']
|
||||
else:
|
||||
data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']]['Lehrender'] = ''
|
||||
data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']]['ZeitraumVon'] = valueAngebote['ZeitraumVon']
|
||||
data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']]['ZeitraumBis'] = valueAngebote['ZeitraumBis']
|
||||
print(data)
|
||||
return self.view.CreateListEval(data)
|
||||
elif(cat == 'Studenten'):
|
||||
for keyStudent, valueStudent in Studenten.items():
|
||||
data[valueStudent['Name']] = {}
|
||||
data[valueStudent['Name']]['Angebote'] = {}
|
||||
data[valueStudent['Name']]['Angebote']['Angebot'] = {}
|
||||
data[valueStudent['Name']]['Angebote']['aktuell'] = {}
|
||||
data[valueStudent['Name']]['Angebote']['abgeschlossen'] = {}
|
||||
for keyAngebot, valueAngebot in Angebote.items():
|
||||
if(valueAngebot['Student'] == valueStudent['id']):
|
||||
data[valueStudent['Name']]['Angebote'][valueAngebot['Status']][keyAngebot] = {}
|
||||
data[valueStudent['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['Lehrender'] = Lehrender[valueAngebot['Lehrender']]['Name']
|
||||
data[valueStudent['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['Status'] = valueAngebot['Status']
|
||||
data[valueStudent['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['Praxisphase'] = valueAngebot['Name']
|
||||
data[valueStudent['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['Firma'] = valueAngebot['Firma']
|
||||
data[valueStudent['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['ZeitraumVon'] = valueAngebot['ZeitraumVon']
|
||||
data[valueStudent['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['ZeitraumBis'] = valueAngebot['ZeitraumBis']
|
||||
elif(cat == 'Lehrender'):
|
||||
for keyLehrende, valueLehrende in Lehrender.items():
|
||||
data[valueLehrende['Name']] = {}
|
||||
data[valueLehrende['Name']]['Angebote'] = {}
|
||||
data[valueLehrende['Name']]['Angebote']['Angebot'] = {}
|
||||
data[valueLehrende['Name']]['Angebote']['aktuell'] = {}
|
||||
data[valueLehrende['Name']]['Angebote']['abgeschlossen'] = {}
|
||||
for keyAngebot, valueAngebot in Angebote.items():
|
||||
if(valueAngebot['Lehrender'] == valueLehrende['id']):
|
||||
data[valueLehrende['Name']]['Angebote'][valueAngebot['Status']][keyAngebot] = {}
|
||||
data[valueLehrende['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['Student'] = Studenten[valueAngebot['Student']]['Name']
|
||||
data[valueLehrende['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['Status'] = valueAngebot['Status']
|
||||
data[valueLehrende['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['Praxisphase'] = valueAngebot['Name']
|
||||
data[valueLehrende['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['Firma'] = valueAngebot['Firma']
|
||||
data[valueLehrende['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['ZeitraumVon'] = valueAngebot['ZeitraumVon']
|
||||
data[valueLehrende['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['ZeitraumBis'] = valueAngebot['ZeitraumBis']
|
||||
|
||||
return self.view.CreateListEval(data)
|
||||
|
||||
|
||||
#-------------------------------------------------------
|
||||
def GenerateSave(self, dataTmp, category):
|
||||
#-------------------------------------------------------
|
||||
if(category == None):
|
||||
return self.view.CreateIndex()
|
||||
else:
|
||||
self.db.Save(dataTmp, category)
|
||||
return self.GenerateList(category)
|
||||
|
||||
#-------------------------------------------------------
|
||||
def GenerateSaveChoice(self, dataTmp):
|
||||
#-------------------------------------------------------
|
||||
if(dataTmp['Student'] != ''):
|
||||
angebote = self.db.CheckOfferings(dataTmp['Student'])
|
||||
print(angebote)
|
||||
if(angebote == 0):
|
||||
print("Save")
|
||||
self.db.Save(dataTmp, 'Angebote')
|
||||
return self.GenerateListChoice()
|
||||
|
||||
#-------------------------------------------------------
|
||||
def GenerateDelete(self, category, id):
|
||||
#-------------------------------------------------------
|
||||
if(category == None or id == None):
|
||||
return self.view.CreateIndex()
|
||||
else:
|
||||
self.db.Delete(category, id)
|
||||
return self.GenerateList(category)
|
||||
|
||||
#EOF
|
189
Praktikum2/ppm1/app/database.py
Normal file
189
Praktikum2/ppm1/app/database.py
Normal file
@ -0,0 +1,189 @@
|
||||
# coding: utf-8
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import codecs
|
||||
import json
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
#----------------------------------------------------------
|
||||
class Database_cl(object):
|
||||
#----------------------------------------------------------
|
||||
# da es hier nur darum geht, die Daten dauerhaft zu speichern,
|
||||
# wird ein sehr einfacher Ansatz verwendet:
|
||||
# - es können Daten zu genau 15 Teams gespeichert werden
|
||||
# - je Team werden 2 Teilnehmer mit Namen, Vornamen und Matrikelnummer
|
||||
# berücksichtigt
|
||||
# - die Daten werden als eine JSON-Datei abgelegt
|
||||
|
||||
|
||||
#-------------------------------------------------------
|
||||
def __init__(self):
|
||||
#-------------------------------------------------------
|
||||
self.data = {}
|
||||
self.data['Studenten'] = {}
|
||||
self.data['Lehrender'] = {}
|
||||
self.data['Firmen'] = {}
|
||||
self.data['Angebote'] = {}
|
||||
self.ReadAll()
|
||||
|
||||
|
||||
#-------------------------------------------------------
|
||||
def Read(self, category):
|
||||
#-------------------------------------------------------
|
||||
path = 'data/' + category
|
||||
if not(os.path.exists(path)):
|
||||
os.makedirs(path)
|
||||
categoryDir = os.listdir(path)
|
||||
for fileName in categoryDir:
|
||||
if fileName.endswith('.json') and fileName != 'last.json':
|
||||
file = codecs.open(os.path.join('data', category, fileName), 'rU', 'utf-8')
|
||||
fileContent = file.read()
|
||||
id = fileName[:-5]
|
||||
self.data[category][id] = json.loads(fileContent)
|
||||
|
||||
#-------------------------------------------------------
|
||||
def ReadAll(self):
|
||||
#-------------------------------------------------------
|
||||
self.Read('Studenten')
|
||||
self.Read('Lehrender')
|
||||
self.Read('Firmen')
|
||||
self.Read('Angebote')
|
||||
|
||||
#-------------------------------------------------------
|
||||
def ReadEntry(self, category = None, id = None):
|
||||
#-------------------------------------------------------
|
||||
print("ReadEntry: ", category, id)
|
||||
self.Read(category)
|
||||
data = None
|
||||
if id == None:
|
||||
data = self.data
|
||||
else:
|
||||
if id in self.data[category]:
|
||||
data = self.data[category][id]
|
||||
|
||||
print(data, "\n")
|
||||
return data
|
||||
|
||||
#-------------------------------------------------------
|
||||
def Save(self, data, category):
|
||||
#-------------------------------------------------------
|
||||
status_b = False
|
||||
id = data['id']
|
||||
print("ID: ", id, "\n")
|
||||
if(id != "None"):
|
||||
if id in self.data[category]:
|
||||
file = codecs.open(os.path.join('data', category, id+'.json'), 'w', 'utf-8')
|
||||
file.write(json.dumps(data, indent=3, ensure_ascii=True))
|
||||
file.close()
|
||||
self.Read(category)
|
||||
status_b = True
|
||||
else:
|
||||
data['id'] = self.IdNext(category)
|
||||
file = codecs.open(os.path.join('data', category, data['id']+'.json'), 'w', 'utf-8')
|
||||
file.write(json.dumps(data, indent=3, ensure_ascii=True))
|
||||
file.close()
|
||||
self.Read(category)
|
||||
status_b = True
|
||||
|
||||
return status_b
|
||||
|
||||
#-------------------------------------------------------
|
||||
def Delete(self, category, id):
|
||||
#-------------------------------------------------------
|
||||
status_b = False
|
||||
if(category == 'Studenten'):
|
||||
for angebote in self.data['Angebote']:
|
||||
if(self.data['Angebote'][angebote]['Student'] == id):
|
||||
try:
|
||||
os.remove(os.path.join('data', 'Angebote', angebote+'.json'))
|
||||
except OSError:
|
||||
pass
|
||||
elif(category == 'Lehrender'):
|
||||
for angebote in self.data['Angebote']:
|
||||
if(self.data['Angebote'][angebote]['Lehrender'] == id):
|
||||
try:
|
||||
os.remove(os.path.join('data', 'Angebote', angebote+'.json'))
|
||||
except OSError:
|
||||
pass
|
||||
elif(category == 'Firmen'):
|
||||
for firmen in self.data['Firmen']:
|
||||
if(firmen == id):
|
||||
fn = self.data['Firmen'][firmen]['Name']
|
||||
for angebote in self.data['Angebote']:
|
||||
if(self.data['Angebote'][angebote]['Firma'] == fn):
|
||||
try:
|
||||
os.remove(os.path.join('data', 'Angebote', angebote+'.json'))
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
if id in self.data[category]:
|
||||
os.remove(os.path.join('data', category, id+'.json'))
|
||||
del self.data[category][id]
|
||||
|
||||
return status_b
|
||||
|
||||
#-------------------------------------------------------
|
||||
def CheckOfferings(self, id):
|
||||
#-------------------------------------------------------
|
||||
print("Offerings: ", id)
|
||||
for offerings in self.data['Angebote']:
|
||||
if(self.data['Angebote'][offerings]['Student'] != id):
|
||||
return 0
|
||||
else:
|
||||
return 1
|
||||
|
||||
#-------------------------------------------------------
|
||||
def CheckDates(self):
|
||||
#-------------------------------------------------------
|
||||
now = datetime.now()
|
||||
for offerings in self.data['Angebote']:
|
||||
if(self.data['Angebote'][offerings]['ZeitraumBis'] != ''):
|
||||
zeitraumBis = datetime.strptime(self.data['Angebote'][offerings]['ZeitraumBis'], "%d.%m.%Y")
|
||||
if(zeitraumBis <= now):
|
||||
self.data['Angebote'][offerings]['Status'] = 'abgeschlossen'
|
||||
data = {}
|
||||
data['Status'] = 'abgeschlossen'
|
||||
data['id'] = offerings
|
||||
data['Name'] = self.data['Angebote'][offerings]['Name']
|
||||
data['Firma'] = self.data['Angebote'][offerings]['Firma']
|
||||
data['Beschreibung'] = self.data['Angebote'][offerings]['Beschreibung']
|
||||
data['Voraussetzungen'] = self.data['Angebote'][offerings]['Voraussetzungen']
|
||||
data['Firmenbetreuer'] = self.data['Angebote'][offerings]['Firmenbetreuer']
|
||||
data['Lehrender'] = self.data['Angebote'][offerings]['Lehrender']
|
||||
data['ZeitraumVon'] = self.data['Angebote'][offerings]['ZeitraumVon']
|
||||
data['ZeitraumBis'] = self.data['Angebote'][offerings]['ZeitraumBis']
|
||||
data['Student'] = self.data['Angebote'][offerings]['Student']
|
||||
self.Save(data, 'Angebote')
|
||||
|
||||
#-------------------------------------------------------
|
||||
def GetDefault(self, category):
|
||||
#-------------------------------------------------------
|
||||
if(category == 'Studenten'):
|
||||
return {'Name':'', 'Vorname':'', 'Matrikelnummer':''}
|
||||
elif(category == 'Lehrender'):
|
||||
return {'Titel':'', 'Name':'', 'Vorname':'', 'Lehrgebiet':''}
|
||||
elif(category == 'Firmen'):
|
||||
return {'Name':'', 'Branche':'', 'Schwerpunkt':'', 'Sitz':'', 'Anzahl Mitarbeiter':''}
|
||||
elif(category == 'Angebote'):
|
||||
return {'Name':'', 'Firma':'', 'Beschreibung':'', 'Voraussetzungen':'', 'Firmenbetreuer':'', 'Status':'Angebot', 'Lehrender':'', 'ZeitraumVon':'', 'ZeitraumBis':'', 'Student':''}
|
||||
|
||||
#-------------------------------------------------------
|
||||
def IdNext(self, category):
|
||||
#-------------------------------------------------------
|
||||
path = 'data/' + category + '/last.json'
|
||||
if(os.path.isfile(path)):
|
||||
file = open(os.path.join('data', category, 'last.json'), 'r+')
|
||||
last = file.read()
|
||||
last = str(int(last)+1)
|
||||
file.seek(0)
|
||||
file.write(last)
|
||||
file.close()
|
||||
else:
|
||||
file = open(os.path.join('data', category, 'last.json'), 'w+')
|
||||
last = str(int(0))
|
||||
file.write(last)
|
||||
file.close()
|
||||
return last
|
||||
|
||||
# EOF
|
52
Praktikum2/ppm1/app/view.py
Normal file
52
Praktikum2/ppm1/app/view.py
Normal file
@ -0,0 +1,52 @@
|
||||
import os.path
|
||||
from mako.template import Template
|
||||
from mako.lookup import TemplateLookup
|
||||
|
||||
#----------------------------------------------------------
|
||||
class View_cl(object):
|
||||
#----------------------------------------------------------
|
||||
|
||||
#-------------------------------------------------------
|
||||
def __init__(self):
|
||||
#-------------------------------------------------------
|
||||
self.path = 'templates'
|
||||
self.lookup = TemplateLookup(directories=['/'])
|
||||
|
||||
#-------------------------------------------------------
|
||||
def Create(self, template, data):
|
||||
#-------------------------------------------------------
|
||||
print("CreateView\n")
|
||||
template = Template(filename=os.path.join(self.path, template), output_encoding='utf-8', lookup=self.lookup)
|
||||
return template.render(data = data)
|
||||
|
||||
#-------------------------------------------------------
|
||||
def CreateIndex(self):
|
||||
#-------------------------------------------------------
|
||||
print("CreateIndex\n")
|
||||
data = None
|
||||
return self.Create('index.tpl', data)
|
||||
|
||||
#-------------------------------------------------------
|
||||
def CreateList(self, data):
|
||||
#-------------------------------------------------------
|
||||
return self.Create('list.tpl', data)
|
||||
|
||||
#-------------------------------------------------------
|
||||
def CreateListChoice(self, data):
|
||||
#-------------------------------------------------------
|
||||
return self.Create('listChoice.tpl', data)
|
||||
|
||||
#-------------------------------------------------------
|
||||
def CreateListEval(self, data):
|
||||
#-------------------------------------------------------
|
||||
return self.Create('listEval.tpl', data)
|
||||
|
||||
#-------------------------------------------------------
|
||||
def CreateDetail(self, data):
|
||||
#-------------------------------------------------------
|
||||
return self.Create('detail.tpl', data)
|
||||
|
||||
#-------------------------------------------------------
|
||||
def CreateDetailChoice(self, data):
|
||||
#-------------------------------------------------------
|
||||
return self.Create('detailChoice.tpl', data)
|
13
Praktikum2/ppm1/data/Angebote/23.json
Normal file
13
Praktikum2/ppm1/data/Angebote/23.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"Name": "Angebot IBM 1",
|
||||
"ZeitraumBis": "01.01.2018",
|
||||
"id": "23",
|
||||
"Firmenbetreuer": "Sepp Meine",
|
||||
"Firma": "IBM",
|
||||
"Voraussetzungen": "Keine",
|
||||
"Lehrender": "7",
|
||||
"Status": "aktuell",
|
||||
"Beschreibung": "Praxisphasenplatz bei IBM",
|
||||
"ZeitraumVon": "01.01.2017",
|
||||
"Student": "9"
|
||||
}
|
13
Praktikum2/ppm1/data/Angebote/26.json
Normal file
13
Praktikum2/ppm1/data/Angebote/26.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"id": "26",
|
||||
"ZeitraumVon": "02.02.2019",
|
||||
"Firma": "Apple",
|
||||
"Student": "10",
|
||||
"Beschreibung": "Beschreibung",
|
||||
"Name": "Name",
|
||||
"Lehrender": "5",
|
||||
"Firmenbetreuer": "Firmenbetreuer3",
|
||||
"Voraussetzungen": "Kein",
|
||||
"Status": "aktuell",
|
||||
"ZeitraumBis": "02.02.2020"
|
||||
}
|
13
Praktikum2/ppm1/data/Angebote/27.json
Normal file
13
Praktikum2/ppm1/data/Angebote/27.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"id": "27",
|
||||
"Voraussetzungen": "Keine",
|
||||
"Lehrender": "5",
|
||||
"Status": "abgeschlossen",
|
||||
"Firmenbetreuer": "Horst",
|
||||
"Beschreibung": "Praxisphase Apple",
|
||||
"ZeitraumVon": "02.02.2002",
|
||||
"Student": "11",
|
||||
"Name": "Angebot Apple 2",
|
||||
"Firma": "Apple",
|
||||
"ZeitraumBis": "02.02.2003"
|
||||
}
|
13
Praktikum2/ppm1/data/Angebote/30.json
Normal file
13
Praktikum2/ppm1/data/Angebote/30.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ZeitraumBis": "",
|
||||
"Firmenbetreuer": "firmenbetreuer",
|
||||
"id": "30",
|
||||
"ZeitraumVon": "",
|
||||
"Name": "name",
|
||||
"Beschreibung": "beschreibung",
|
||||
"Student": "",
|
||||
"Lehrender": "",
|
||||
"Status": "Angebot",
|
||||
"Voraussetzungen": "voraussetzungen",
|
||||
"Firma": "IBM"
|
||||
}
|
1
Praktikum2/ppm1/data/Angebote/last.json
Normal file
1
Praktikum2/ppm1/data/Angebote/last.json
Normal file
@ -0,0 +1 @@
|
||||
27
|
8
Praktikum2/ppm1/data/Firmen/4.json
Normal file
8
Praktikum2/ppm1/data/Firmen/4.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"id": "4",
|
||||
"Branche": "IT",
|
||||
"Sitz": "Cupertino",
|
||||
"Schwerpunkt": "Informatik",
|
||||
"Anzahl Mitarbeiter": "110000",
|
||||
"Name": "Apple"
|
||||
}
|
8
Praktikum2/ppm1/data/Firmen/5.json
Normal file
8
Praktikum2/ppm1/data/Firmen/5.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"id": "5",
|
||||
"Branche": "IT",
|
||||
"Sitz": "Redmond",
|
||||
"Schwerpunkt": "Informatik",
|
||||
"Anzahl Mitarbeiter": "114000",
|
||||
"Name": "Microsoft"
|
||||
}
|
8
Praktikum2/ppm1/data/Firmen/6.json
Normal file
8
Praktikum2/ppm1/data/Firmen/6.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"id": "6",
|
||||
"Branche": "IT",
|
||||
"Sitz": "Armonk",
|
||||
"Schwerpunkt": "Elektrotechnik",
|
||||
"Anzahl Mitarbeiter": "377000",
|
||||
"Name": "IBM"
|
||||
}
|
1
Praktikum2/ppm1/data/Firmen/last.json
Normal file
1
Praktikum2/ppm1/data/Firmen/last.json
Normal file
@ -0,0 +1 @@
|
||||
6
|
7
Praktikum2/ppm1/data/Lehrender/5.json
Normal file
7
Praktikum2/ppm1/data/Lehrender/5.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"Titel": "Prof",
|
||||
"id": "5",
|
||||
"Lehrgebiet": "Informatik",
|
||||
"Name": "Heiner",
|
||||
"Vorname": "Theodor"
|
||||
}
|
7
Praktikum2/ppm1/data/Lehrender/6.json
Normal file
7
Praktikum2/ppm1/data/Lehrender/6.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"Titel": "Prof Dr",
|
||||
"id": "6",
|
||||
"Lehrgebiet": "Elektrotechnik",
|
||||
"Name": "Anton",
|
||||
"Vorname": "Emanuel"
|
||||
}
|
7
Praktikum2/ppm1/data/Lehrender/7.json
Normal file
7
Praktikum2/ppm1/data/Lehrender/7.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"Titel": "Prof",
|
||||
"id": "7",
|
||||
"Lehrgebiet": "Informatik",
|
||||
"Name": "Adalbert",
|
||||
"Vorname": "Bastian"
|
||||
}
|
7
Praktikum2/ppm1/data/Lehrender/8.json
Normal file
7
Praktikum2/ppm1/data/Lehrender/8.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"Titel": "Dr",
|
||||
"id": "8",
|
||||
"Lehrgebiet": "Elektrotechnik",
|
||||
"Name": "Leberecht",
|
||||
"Vorname": "Egon"
|
||||
}
|
1
Praktikum2/ppm1/data/Lehrender/last.json
Normal file
1
Praktikum2/ppm1/data/Lehrender/last.json
Normal file
@ -0,0 +1 @@
|
||||
13
|
6
Praktikum2/ppm1/data/Studenten/10.json
Normal file
6
Praktikum2/ppm1/data/Studenten/10.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"Vorname": "Timo",
|
||||
"Name": "Ben",
|
||||
"Matrikelnummer": "3",
|
||||
"id": "10"
|
||||
}
|
6
Praktikum2/ppm1/data/Studenten/11.json
Normal file
6
Praktikum2/ppm1/data/Studenten/11.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"Vorname": "Korbinian",
|
||||
"Name": "Moritz",
|
||||
"Matrikelnummer": "6",
|
||||
"id": "11"
|
||||
}
|
6
Praktikum2/ppm1/data/Studenten/12.json
Normal file
6
Praktikum2/ppm1/data/Studenten/12.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"Vorname": "Alfons",
|
||||
"Name": "Meine",
|
||||
"Matrikelnummer": "4",
|
||||
"id": "12"
|
||||
}
|
6
Praktikum2/ppm1/data/Studenten/13.json
Normal file
6
Praktikum2/ppm1/data/Studenten/13.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"id": "13",
|
||||
"Name": "Edmund",
|
||||
"Vorname": "Adalbert",
|
||||
"Matrikelnummer": "1"
|
||||
}
|
6
Praktikum2/ppm1/data/Studenten/9.json
Normal file
6
Praktikum2/ppm1/data/Studenten/9.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"Vorname": "Gregor",
|
||||
"Name": "Klemens",
|
||||
"Matrikelnummer": "2",
|
||||
"id": "9"
|
||||
}
|
1
Praktikum2/ppm1/data/Studenten/last.json
Normal file
1
Praktikum2/ppm1/data/Studenten/last.json
Normal file
@ -0,0 +1 @@
|
||||
14
|
127
Praktikum2/ppm1/doc/documentation.html
Normal file
127
Praktikum2/ppm1/doc/documentation.html
Normal file
@ -0,0 +1,127 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title></title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="web-praktikum-gruppe-a">Web-Praktikum Gruppe A</h1>
|
||||
<h2 id="kai-wansart-und-felix-hoster">Kai Wansart und Felix Hoster</h2>
|
||||
<h3 id="section">16.11.2016</h3>
|
||||
<h2 id="beschreibung-der-lösung">Beschreibung der Lösung</h2>
|
||||
<h3 id="aufgabe-der-anwendung">Aufgabe der Anwendung:</h3>
|
||||
<ul>
|
||||
<li>eine Ünterstützung der Betreuung von Praxisphasen mit einer Web-Anwendung zu erstellen</li>
|
||||
<li>Praxisphasen werden von externen Partnern (Firmen) angeboten</li>
|
||||
<li>Studenten können diese Angebote nutzen, wenn sie einen Lehrenden als Betreuer finden</li>
|
||||
</ul>
|
||||
<h4 id="übersicht-der-fachlichen-funktion">Übersicht der fachlichen Funktion:</h4>
|
||||
<ul>
|
||||
<li>Datenpflege Studenten:
|
||||
<ul>
|
||||
<li>Eine Liste mit allen erstellten Studenten (Name, Vorname, Matrikelnummer)</li>
|
||||
</ul></li>
|
||||
<li>Datenpflege Lehrende:
|
||||
<ul>
|
||||
<li>Eine Übersicht mit allen Lehrenden (Name, Titel, Lehrgebiet)</li>
|
||||
</ul></li>
|
||||
<li>Datenpflege Firmenverzeichniss:
|
||||
<ul>
|
||||
<li>Eine Liste mit einer kleinen Übersicht über einzelne Firmen (Schwerpunkt, Sitz, Name, Branche, Mitarbeiteranzahl)</li>
|
||||
</ul></li>
|
||||
<li>Datenpflege Praxisphase:
|
||||
<ul>
|
||||
<li>Erhält man eine kurze Übersicht über Angebote für die Studenten (Firmenbetreuer, Beschreibung, Name, Voraussetzung, Firma)</li>
|
||||
</ul></li>
|
||||
<li>Auswahl Praxisphasen:
|
||||
<ul>
|
||||
<li>Dort können die Studenten mit einem Professor sich eine Praxisphase aussuchen</li>
|
||||
</ul></li>
|
||||
<li>Auswertung Firma:
|
||||
<ul>
|
||||
<li>Hier werden die Firmen bewertet, die ein Angebot für die Praxisphase bewertet</li>
|
||||
</ul></li>
|
||||
<li>Auswertung Praxisphasen nach Studenten:
|
||||
<ul>
|
||||
<li>Hier sieht man die Bewertung der Studenten über die einzelnen Angebote</li>
|
||||
</ul></li>
|
||||
<li>Auswertung Praxisphase nach Betreuern:
|
||||
<ul>
|
||||
<li>Hier sieht man die Bewertung der Praxisphasen - Betreuer</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<h2 id="beschreibung-des-servers">Beschreibung des Servers</h2>
|
||||
<h4 id="zweck">Zweck</h4>
|
||||
<ul>
|
||||
<li>Verwaltung von Praxisphasen, für Studenten, Lehrende, und Firmen</li>
|
||||
<li>Anbieten von Praxisphasenangeboten</li>
|
||||
<li>Auswertung von aktuellen und vergangenen Praxisphasenangeboten</li>
|
||||
</ul>
|
||||
<h4 id="aufbau-bestandteile-der-komponente">Aufbau (Bestandteile der Komponente)</h4>
|
||||
<ul>
|
||||
<li>Application
|
||||
<ul>
|
||||
<li>Annahme von Anfragen durch den Webbrowser</li>
|
||||
<li>Weiterleitung an die jeweiligen Komponenten</li>
|
||||
</ul></li>
|
||||
<li>Database
|
||||
<ul>
|
||||
<li>Einlesen, Speicherung, Bearbeitung und Löschung von Datensätzen</li>
|
||||
</ul></li>
|
||||
<li>View
|
||||
<ul>
|
||||
<li>Verarbeiten der Templates mit den gegebenen Daten</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<h4 id="zusammenwirken-mit-anderen-komponenten">Zusammenwirken mit anderen Komponenten</h4>
|
||||
<h4 id="api-programmierschnittstellen-die-die-leistung-der-komponente-anbieten">API (Programmierschnittstellen), die die Leistung der Komponente anbieten</h4>
|
||||
<ul>
|
||||
<li>index
|
||||
<ul>
|
||||
<li>Startseite</li>
|
||||
</ul></li>
|
||||
<li>category
|
||||
<ul>
|
||||
<li>Darstellung der Kategorien</li>
|
||||
</ul></li>
|
||||
<li>choice
|
||||
<ul>
|
||||
<li>Darstellung der Praxisphasenauswahl</li>
|
||||
</ul></li>
|
||||
<li>eval
|
||||
<ul>
|
||||
<li>Darstellung der Auswertungen</li>
|
||||
</ul></li>
|
||||
<li>detail
|
||||
<ul>
|
||||
<li>Darstellung der Detailansicht für die Kategorien</li>
|
||||
</ul></li>
|
||||
<li>detailchoice
|
||||
<ul>
|
||||
<li>Darstellung der Detailansicht für die Praxisphasenauswahl</li>
|
||||
</ul></li>
|
||||
<li>save
|
||||
<ul>
|
||||
<li>Speichern der Detailansicht für die Kategorien</li>
|
||||
</ul></li>
|
||||
<li>savechoice
|
||||
<ul>
|
||||
<li>Speichern der Detailansicht für die Praxisphasenauswahl</li>
|
||||
</ul></li>
|
||||
<li>delete
|
||||
<ul>
|
||||
<li>Löschen eines Eintrags aus der Datenbank</li>
|
||||
</ul></li>
|
||||
<li>default
|
||||
<ul>
|
||||
<li>Fehlerdarstellung</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
36
Praktikum2/ppm1/doc/documentation.md
Normal file
36
Praktikum2/ppm1/doc/documentation.md
Normal file
@ -0,0 +1,36 @@
|
||||
# Web-Praktikum Gruppe K
|
||||
## Kai Wansart und Felix Hoster
|
||||
### 16.11.2016
|
||||
|
||||
## Beschreibung der Lösung
|
||||
### Aufgabe der Anwendung:
|
||||
Die Praktikumsaufgabe war, eine Ünterstützung der Betreuung von Praxisphasen mit einer Web-Anwendung zu erstellen. Praxisphasen werden
|
||||
von externen Partnern (Firmen) angeboten, Studenten können diese Angebote nutzen, wenn sie einen Lehrenden als Betreuer
|
||||
finden
|
||||
|
||||
#### Übersicht der fachlichen Funktion
|
||||
- Datenpflege Studenten: Eine Liste mit allen erstellten Studenten (Name, Vorname, Matrikelnummer)
|
||||
- Datenpflege Lehrende: Eine Übersicht mit allen Lehrenden (Name, Titel, Lehrgebiet)
|
||||
- Datenpflege Firmenverzeichniss: Eine Liste mit einer kleinen Übersicht über einzelne Firmen (Schwerpunkt, Sitz, Name, Branche, Mitarbeiteranzahl)
|
||||
- Datenpflege Praxisphase: Erhält man eine kurze Übersicht über Angebote für die Studenten (Firmenbetreuer, Beschreibung, Name, Voraussetzung, Firma)
|
||||
- Auswahl Praxisphasen: Dort können die Studenten mit einem Professor sich eine Praxisphase aussuchen
|
||||
- Auswertung Firma: Hier werden die Firmen bewertet, die ein Angebot für die Praxisphase bewertet
|
||||
- Auswertung Praxisphasen nach Studenten: Hier sieht man die Bewertung der Studenten über die einzelnen Angebote
|
||||
- Auswertung Praxisphase nach Betreuern: Hier sieht man die Bewertung der Praxisphasen - Betreuer
|
||||
|
||||
|
||||
## Beschreibung des Servers
|
||||
#### Zweck
|
||||
|
||||
#### Aufbau (Bestandteile der Komponente)
|
||||
|
||||
#### Zusammenwirken mit anderen Komponenten
|
||||
|
||||
#### API (Programmierschnittstellen), die die Leistung der Komponente anbieten
|
||||
|
||||
## Datenablage
|
||||
Die Daten werden mittels der Kategorie abgespeichert, die als Variable behandelt wird. Mit dieser Variable wird die Datei immer wieder neu gespeichert, wenn etwas gelöscht bzw. geändert wird. Das Format der Datei ist eine JSON-Datei, die im Ordner 'Data' und der darauffolgenden Kategorie abgespeichert wird.
|
||||
|
||||
## Konfiguration
|
||||
|
||||
## Durchführung und Ergebnis der geforderten Prüfungen
|
45
Praktikum2/ppm1/server.py
Normal file
45
Praktikum2/ppm1/server.py
Normal file
@ -0,0 +1,45 @@
|
||||
#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': './static'
|
||||
}
|
||||
}
|
||||
|
||||
# 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
|
46
Praktikum2/ppm1/static/functions.js
Normal file
46
Praktikum2/ppm1/static/functions.js
Normal file
@ -0,0 +1,46 @@
|
||||
var table = document.getElementById('idList');
|
||||
var selected = table.getElementsByClassName('selected');
|
||||
var selectedId = 'None';
|
||||
table.onclick = highlight;
|
||||
|
||||
function select(category, mode) {
|
||||
var id = selectedId;
|
||||
if (id == 'None')
|
||||
{
|
||||
alert("Kein Eintrag ausgewaehlt!");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(mode == 0) {
|
||||
window.location.href = '/detail/?cat=' + category + '&id=' + id;
|
||||
}
|
||||
if(mode == 1) {
|
||||
var result = confirm("Sind Sie sicher, dass der Eintrag gelöscht werden soll?");
|
||||
if(result) {
|
||||
window.location.href = '/delete/?cat=' + category + '&id=' + id;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(mode == 2) {
|
||||
var result = confirm("Sind Sie sicher, dass das Angebot angenommen werden soll?");
|
||||
if(result) {
|
||||
window.location.href = '/detailchoice/?id=' + id;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function highlight(e) {
|
||||
if (selected[0]) selected[0].className = '';
|
||||
e.target.parentNode.className = 'selected';
|
||||
var tr = e.target.parentNode;
|
||||
selectedId = tr.getAttribute('id');
|
||||
}
|
33
Praktikum2/ppm1/static/functionsAngebote.js
Normal file
33
Praktikum2/ppm1/static/functionsAngebote.js
Normal file
@ -0,0 +1,33 @@
|
||||
window.onload = function () {
|
||||
document.getElementById("idList").onclick = function (event_opl) {
|
||||
if (event_opl.target.tagName.toLowerCase() == 'td') {
|
||||
id = event_opl.target.parentNode.id;
|
||||
if (id != "") {
|
||||
document.getElementById(id).className = "";
|
||||
}
|
||||
|
||||
|
||||
console.log(id);
|
||||
document.getElementById(id).className = "selected";
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById("New").onclick = function (event_opl) {
|
||||
window.location.href = "/detail/?cat=Angebote" ;
|
||||
}
|
||||
|
||||
|
||||
document.getElementById("Modify").onclick = function (event_opl) {
|
||||
if (id != "")
|
||||
window.location.href = "/detail/?cat=Angebote&id=" + id;
|
||||
}
|
||||
|
||||
document.getElementById("Delete").onclick = function (event_opl) {
|
||||
if (id != "")
|
||||
if (confirm("Soll der Eintrag wirklich geloescht werden?")) {
|
||||
window.location.href = "/delete/?cat=Angebote&id=" + id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
19
Praktikum2/ppm1/static/functionsChoice.js
Normal file
19
Praktikum2/ppm1/static/functionsChoice.js
Normal file
@ -0,0 +1,19 @@
|
||||
window.onload = function () {
|
||||
document.getElementById("idList").onclick = function (event_opl) {
|
||||
if (event_opl.target.tagName.toLowerCase() == 'td') {
|
||||
id = event_opl.target.parentNode.id;
|
||||
if (id != "") {
|
||||
document.getElementById(id).className = "";
|
||||
}
|
||||
|
||||
|
||||
console.log(id);
|
||||
document.getElementById(id).className = "selected";
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById("Annehmen").onclick = function (event_opl) {
|
||||
if (id != "")
|
||||
window.location.href = "/detailchoice/?id=" + id;
|
||||
}
|
||||
}
|
33
Praktikum2/ppm1/static/functionsFirmen.js
Normal file
33
Praktikum2/ppm1/static/functionsFirmen.js
Normal file
@ -0,0 +1,33 @@
|
||||
window.onload = function () {
|
||||
document.getElementById("idList").onclick = function (event_opl) {
|
||||
if (event_opl.target.tagName.toLowerCase() == 'td') {
|
||||
id = event_opl.target.parentNode.id;
|
||||
if (id != "") {
|
||||
document.getElementById(id).className = "";
|
||||
}
|
||||
|
||||
|
||||
console.log(id);
|
||||
document.getElementById(id).className = "selected";
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById("New").onclick = function (event_opl) {
|
||||
window.location.href = "/detail/?cat=Firmen" ;
|
||||
}
|
||||
|
||||
|
||||
document.getElementById("Modify").onclick = function (event_opl) {
|
||||
if (id != "")
|
||||
window.location.href = "/detail/?cat=Firmen&id=" + id;
|
||||
}
|
||||
|
||||
document.getElementById("Delete").onclick = function (event_opl) {
|
||||
if (id != "")
|
||||
if (confirm("Soll der Eintrag wirklich geloescht werden?")) {
|
||||
window.location.href = "/delete/?cat=Firmen&id=" + id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
33
Praktikum2/ppm1/static/functionsLehrender.js
Normal file
33
Praktikum2/ppm1/static/functionsLehrender.js
Normal file
@ -0,0 +1,33 @@
|
||||
window.onload = function () {
|
||||
document.getElementById("idList").onclick = function (event_opl) {
|
||||
if (event_opl.target.tagName.toLowerCase() == 'td') {
|
||||
id = event_opl.target.parentNode.id;
|
||||
if (id != "") {
|
||||
document.getElementById(id).className = "";
|
||||
}
|
||||
|
||||
|
||||
console.log(id);
|
||||
document.getElementById(id).className = "selected";
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById("New").onclick = function (event_opl) {
|
||||
window.location.href = "/detail/?cat=Lehrender" ;
|
||||
}
|
||||
|
||||
|
||||
document.getElementById("Modify").onclick = function (event_opl) {
|
||||
if (id != "")
|
||||
window.location.href = "/detail/?cat=Lehrender&id=" + id;
|
||||
}
|
||||
|
||||
document.getElementById("Delete").onclick = function (event_opl) {
|
||||
if (id != "")
|
||||
if (confirm("Soll der Eintrag wirklich geloescht werden?")) {
|
||||
window.location.href = "/delete/?cat=Lehrender&id=" + id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
33
Praktikum2/ppm1/static/functionsStudenten.js
Normal file
33
Praktikum2/ppm1/static/functionsStudenten.js
Normal file
@ -0,0 +1,33 @@
|
||||
window.onload = function () {
|
||||
document.getElementById("idList").onclick = function (event_opl) {
|
||||
if (event_opl.target.tagName.toLowerCase() == 'td') {
|
||||
id = event_opl.target.parentNode.id;
|
||||
if (id != "") {
|
||||
document.getElementById(id).className = "";
|
||||
}
|
||||
|
||||
|
||||
console.log(id);
|
||||
document.getElementById(id).className = "selected";
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById("New").onclick = function (event_opl) {
|
||||
window.location.href = "/detail/?cat=Studenten" ;
|
||||
}
|
||||
|
||||
|
||||
document.getElementById("Modify").onclick = function (event_opl) {
|
||||
if (id != "")
|
||||
window.location.href = "/detail/?cat=Studenten&id=" + id;
|
||||
}
|
||||
|
||||
document.getElementById("Delete").onclick = function (event_opl) {
|
||||
if (id != "")
|
||||
if (confirm("Soll der Eintrag wirklich geloescht werden?")) {
|
||||
window.location.href = "/delete/?cat=Studenten&id=" + id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
BIN
Praktikum2/ppm1/static/img/logo.png
Normal file
BIN
Praktikum2/ppm1/static/img/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 97 KiB |
1
Praktikum2/ppm1/static/style.css
Normal file
1
Praktikum2/ppm1/static/style.css
Normal file
@ -0,0 +1 @@
|
||||
body{font-family:"Open Sans",sans-serif;font-size:12pt;padding:0;margin:0;}.clSiteHeader{position:absolute;top:0;left:0;right:0;height:100px;line-height:100px;margin:0;padding:5px;font-size:40pt;text-align:center;text-shadow:black 3px 2px;font-family:"Open Sans",sans-serif;background-color:#084791;border:none;border-radius:60px;}.clSiteHeader a{text-decoration:none;color:white;}.clSiteHeader:hover{background-color:#0D71E4;cursor:pointer;}.clSiteHeader a:visited,a:active{color:white;text-decoration:none;}.clContent{position:absolute;top:150px;left:0;right:0;bottom:0;margin:0;padding:5px;background-repeat:no-repeat;background-position:bottom left;}.clContentHeader{position:absolute;top:20px;left:0;right:0;height:30px;line-height:30px;margin:0;padding:5px;font-size:18pt;text-align:center;}.clContentArea{position:absolute;top:80px;left:0;right:0;bottom:0px;margin:10px 0;margin-left:10px;padding:5px;background-attachment:#819FF7;}.clButtonArea{position:absolute;left:0;right:0;bottom:0;height:80px;line-height:80px;margin:0;padding:5px;text-align:center;background-color:#FFFFFF;}.clButtonArea a,input[type="submit"]{margin:0 5px;padding:3px 6px;font-size:14pt;text-decoration:none;border:2px solid;color:white;background-color:#084791;}.clButtonArea a:hover{color:white;background-color:#0D71E4;cursor:pointer;}.clButtonArea a:visited,a:active{color:white;}.clNavButton{display:inline-block;text-align:center;background-color:#084791;border:1px solid black;color:white;padding:15px 32px;text-decoration:none;font-size:16px;cursor:pointer;float:left;clear:left;width:20%;margin-left:38%;margin-right:30%;}.clNavButton:hover{background-color:#0D71E4;}#idList{table-layout:fixed;width:auto;border:2px solid;border-collapse:collapse;margin:auto;}#idList th{text-align:center;padding-left:5px;background-color:white;padding:3px;border:2px solid;}#idList td{padding:3px;border:2px solid;cursor:pointer;}#idForm .clContentArea{width:500px;margin:auto;}.selected{background-color:#0D71E4;color:white;}.clFormRow{position:relative;height:30px;margin-bottom:10px;}.clFormRow label{position:absolute;top:0;left:0;width:240px;text-align:center;}.clFormRow input{position:absolute;top:0;left:250px;width:250px;}.clFormRow select{position:absolute;top:0;left:250px;width:250px;}h3{text-align:center;}
|
75
Praktikum2/ppm1/templates/detail.tpl
Normal file
75
Praktikum2/ppm1/templates/detail.tpl
Normal file
@ -0,0 +1,75 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
Praxisphasenmanager (PPM)
|
||||
</title>
|
||||
<meta charset="UTF-8" />
|
||||
<style type="text/css">
|
||||
@import url("/style.css");
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="idSiteHeader" class="clSiteHeader">
|
||||
<a href="/index" title="Zurück zur Startseite">Praxisphasenmanager (PPM)</a>
|
||||
</h1>
|
||||
|
||||
<form id="idForm" class="clContent" action="/save/?cat=${data['category']}" method="POST">
|
||||
<h2 id="idContentHeader" class="clContentHeader">
|
||||
${data['category']}: Ihre Daten
|
||||
</h2>
|
||||
<div id="idContentArea" class="clContentArea">
|
||||
<input type="hidden" value="${data['id']}" id="id" name="id" />
|
||||
|
||||
% if data['category'] != 'Angebote':
|
||||
% for field in data['content']:
|
||||
% if field!='id' and field!='Status':
|
||||
<div class="clFormRow">
|
||||
<label for="${field}">${field}</label>
|
||||
<input type="text" value=
|
||||
% if data['content'][field] != field:
|
||||
"${data['content'][field]}" id="${field}" name="${field}" />
|
||||
% else:
|
||||
"" id="${field}" name="${field}" />
|
||||
% endif
|
||||
</div>
|
||||
% endif
|
||||
% endfor
|
||||
% else:
|
||||
<input type="hidden" value="Angebot" id="Status" name="Status" />
|
||||
<input type="hidden" value="" id="Zeitraum" name="ZeitraumVon" />
|
||||
<input type="hidden" value="" id="Zeitraum" name="ZeitraumBis" />
|
||||
<input type="hidden" value="" id="Student" name="Student" />
|
||||
<input type="hidden" value="" id="Lehrender" name="Lehrender" />
|
||||
% for field in data['content']:
|
||||
% if field!='id' and field!='Status' and field!='ZeitraumVon' and field!='ZeitraumBis' and field!='Lehrender' and field!='Student':
|
||||
<div class="clFormRow">
|
||||
<label for="${field}">${field}</label>
|
||||
% if field!='Firma':
|
||||
<input type="text" value=
|
||||
% if data['content'][field] != field:
|
||||
"${data['content'][field]}" id="${field}" name="${field}" />
|
||||
% else:
|
||||
"" id="${field}" name="${field}" />
|
||||
% endif
|
||||
% else:
|
||||
<select name="Firma" form="idForm">
|
||||
% for option in data['Firmen']:
|
||||
<option value="${data['Firmen'][option]['Name']}">${data['Firmen'][option]['Name']}</option>
|
||||
% endfor
|
||||
</select>
|
||||
% endif
|
||||
</div>
|
||||
% endif
|
||||
% endfor
|
||||
% endif
|
||||
|
||||
<div id="idButtonArea" class="clButtonArea">
|
||||
<a href="/index" title="Zurück zur Startseite">Zurück zur Startseite</a>
|
||||
<a href="/category/?cat=${data['category']}" title="Zurueck zur Startseite">Zurück zur übersicht</a>
|
||||
<input type="submit" value="Speichern" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
66
Praktikum2/ppm1/templates/detailChoice.tpl
Normal file
66
Praktikum2/ppm1/templates/detailChoice.tpl
Normal file
@ -0,0 +1,66 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
Praxisphasenmanager (PPM)
|
||||
</title>
|
||||
<meta charset="UTF-8" />
|
||||
<style type="text/css">
|
||||
@import url("/style.css");
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="idSiteHeader" class="clSiteHeader">
|
||||
<a href="/index" title="Zurück zur Startseite">Praxisphasenmanager (PPM)</a>
|
||||
</h1>
|
||||
|
||||
<form id="idForm" class="clContent" action="/saveChoice" method="POST">
|
||||
<h2 id="idContentHeader" class="clContentHeader">
|
||||
Praxisphasenangebots Auswahl
|
||||
</h2>
|
||||
<div id="idContentArea" class="clContentArea">
|
||||
<input type="hidden" value="${data['id']}" id="id" name="id" />
|
||||
<input type="hidden" value="${data['Name']}" id="Name" name="Name" />
|
||||
<input type="hidden" value="${data['Firma']}" id="Firma" name="Firma" />
|
||||
<input type="hidden" value="${data['Beschreibung']}" id="Beschreibung" name="Beschreibung" />
|
||||
<input type="hidden" value="${data['Voraussetzungen']}" id="Voraussetzungen" name="Voraussetzungen" />
|
||||
<input type="hidden" value="${data['Firmenbetreuer']}" id="Firmenbetreuer" name="Firmenbetreuer" />
|
||||
<input type="hidden" value="aktuell" id="Status" name="Status" />
|
||||
|
||||
<div class="clFormRow">
|
||||
<label for="Student">Student</label>
|
||||
<select name="Student" form="idForm">
|
||||
% for option in data['Studenten']:
|
||||
<option value="${data['Studenten'][option]['id']}">${data['Studenten'][option]['Name']}</option>
|
||||
% endfor
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="clFormRow">
|
||||
<label for="Lehrender">Lehrender</label>
|
||||
<select name="Lehrender" form="idForm">
|
||||
% for option in data['Lehrender']:
|
||||
<option value="${data['Lehrender'][option]['id']}">${data['Lehrender'][option]['Name']}</option>
|
||||
% endfor
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="clFormRow">
|
||||
<label for="ZeitraumVon">Zeitraum: Von (D.M.Y)</label>
|
||||
<input type="text" value="" id="ZeitraumVon" name="ZeitraumVon" />
|
||||
</div>
|
||||
|
||||
<div class="clFormRow">
|
||||
<label for="ZeitraumBis">Zeitraum: Bis (D.M.Y)</label>
|
||||
<input type="text" value="" id="ZeitraumBis" name="ZeitraumBis" />
|
||||
</div>
|
||||
|
||||
<div id="idButtonArea" class="clButtonArea">
|
||||
<a href="/index" title="Zurück zur Startseite">Zurück zur Startseite</a>
|
||||
<a href="/choice" title="Zurück zur übersicht">Zurück zur übersicht</a>
|
||||
<input type="submit" value="Speichern" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
36
Praktikum2/ppm1/templates/index.tpl
Normal file
36
Praktikum2/ppm1/templates/index.tpl
Normal file
@ -0,0 +1,36 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
Praxisphasenmanager (PPM)
|
||||
</title>
|
||||
<meta charset="UTF-8" />
|
||||
<style type="text/css">
|
||||
@import url("/style.css");
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="idSiteHeader" class="clSiteHeader">
|
||||
<a href="/index" title="Zurück zur Startseite">Praxisphasenmanager (PPM)</a>
|
||||
</h1>
|
||||
<div class="clContent">
|
||||
<h2 id="idContentHeader" class="clContentHeader">Module</h2>
|
||||
<div class="clContentArea">
|
||||
<a href="/category/?cat=Studenten" class="clNavButton">Datenpflege: Studenten</a>
|
||||
<a href="/category/?cat=Lehrender" class="clNavButton">Datenpflege: Lehrender</a>
|
||||
<a href="/category/?cat=Firmen" class="clNavButton">Datenpflege: Firmenverzeichnis</a>
|
||||
<a href="/category/?cat=Angebote" class="clNavButton">Datenpflege: Praxisphasen</a>
|
||||
|
||||
<a href="/choice" class="clNavButton">Auswahl: Praxisphasen</a>
|
||||
|
||||
<a href="/eval/?cat=Studenten" class="clNavButton">Auswertung: Studenten</a>
|
||||
<a href="/eval/?cat=Lehrender" class="clNavButton">Auswertung: Lehrenden</a>
|
||||
<a href="/eval/?cat=Firmen" class="clNavButton">Auswertung: Firmen</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<footer>
|
||||
<!--<script type="text/javascript" src="/functions.js"></script>-->
|
||||
</footer>
|
||||
</html>
|
76
Praktikum2/ppm1/templates/list.tpl
Normal file
76
Praktikum2/ppm1/templates/list.tpl
Normal file
@ -0,0 +1,76 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
Praxisphasenmanager (PPM)
|
||||
</title>
|
||||
<meta charset="UTF-8" />
|
||||
<style type="text/css">
|
||||
@import url("/style.css");
|
||||
</style>
|
||||
<script src="/functions${data['category']}.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 id="idSiteHeader" class="clSiteHeader">
|
||||
<a href="/index" title="Zurück zur Startseite">Praxisphasenmanager (PPM)</a>
|
||||
</h1>
|
||||
<div id="idContent" class="clContent">
|
||||
<h2 id="idContentHeader" class="clContentHeader">
|
||||
Übersicht: ${data['category']}
|
||||
</h2>
|
||||
<div id="idContentArea" class="clContentArea">
|
||||
|
||||
<table id="idList">
|
||||
<tr>
|
||||
% if data['content']!= None:
|
||||
% for heading in data['headings']:
|
||||
% if heading!='id' and heading!='Status' and heading!='ZeitraumVon' and heading!='ZeitraumBis' and heading!='Student' and heading!='Lehrender':
|
||||
<th>${heading}</th>
|
||||
% endif
|
||||
% endfor
|
||||
% else:
|
||||
<td>Bisher kein Inhalt</td>
|
||||
% endif
|
||||
</tr>
|
||||
% if data['content']!= None:
|
||||
|
||||
% for entries in data['content']:
|
||||
<tr id=${entries}>
|
||||
% if data['category'] == 'Angebote':
|
||||
% if data['content'][entries]['Status'] == 'Angebot':
|
||||
% for entry in data['content'][entries]:
|
||||
% if entry!='id' and entry!='Status' and entry!='ZeitraumVon' and entry!='ZeitraumBis' and entry!='Student' and entry!='Lehrender':
|
||||
<td id=${entries}>${data['content'][entries][entry]}</td>
|
||||
% endif
|
||||
% endfor
|
||||
% endif
|
||||
% else:
|
||||
% for entry in data['content'][entries]:
|
||||
% if entry!='id':
|
||||
<td id=${entries}>${data['content'][entries][entry]}</td>
|
||||
% endif
|
||||
% endfor
|
||||
% endif
|
||||
</tr id=${entries}>
|
||||
% endfor
|
||||
|
||||
% endif
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="idButtonArea" class="clButtonArea">
|
||||
<a href="/index" class="clButton">Startseite</a>
|
||||
|
||||
<a class="clButton" id="New">Neu</a>
|
||||
<a class="clButton" id="Modify">Bearbeiten</a>
|
||||
<a class="clButton" id="Delete">Loeschen</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<footer>
|
||||
|
||||
</footer>
|
||||
</html>
|
56
Praktikum2/ppm1/templates/listChoice.tpl
Normal file
56
Praktikum2/ppm1/templates/listChoice.tpl
Normal file
@ -0,0 +1,56 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
Praxisphasenmanager (PPM)
|
||||
</title>
|
||||
<meta charset="UTF-8" />
|
||||
<style type="text/css">
|
||||
@import url("/style.css");
|
||||
</style>
|
||||
<script src="/functionsChoice.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 id="idSiteHeader" class="clSiteHeader">
|
||||
<a href="/index" title="Zurück zur Startseite">Praxisphasenmanager (PPM)</a>
|
||||
</h1>
|
||||
<div id="idContent" class="clContent">
|
||||
<h2 id="idContentHeader" class="clContentHeader">
|
||||
Übersicht Praxisphasen Auswahl
|
||||
</h2>
|
||||
<div id="idContentArea" class="clContentArea">
|
||||
|
||||
<table id="idList">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Firma</th>
|
||||
<th>Beschreibung</th>
|
||||
<th>Voraussetzungen</th>
|
||||
<th>Firmenbetreuer</th>
|
||||
</tr>
|
||||
% if data['content']!= None:
|
||||
% for entries in data['content']:
|
||||
<tr id=${entries}>
|
||||
<td id=${entries}>${data['content'][entries]['Name']}</td>
|
||||
<td id=${entries}>${data['content'][entries]['Firma']}</td>
|
||||
<td id=${entries}>${data['content'][entries]['Beschreibung']}</td>
|
||||
<td id=${entries}>${data['content'][entries]['Voraussetzungen']}</td>
|
||||
<td id=${entries}>${data['content'][entries]['Firmenbetreuer']}</td>
|
||||
</tr id=${entries}>
|
||||
% endfor
|
||||
|
||||
% endif
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="idButtonArea" class="clButtonArea">
|
||||
<a href="/index" class="clButton">Startseite</a>
|
||||
<a class="clButton" id="Annehmen">Annehmen</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<footer>
|
||||
</footer>
|
||||
</html>
|
146
Praktikum2/ppm1/templates/listEval.tpl
Normal file
146
Praktikum2/ppm1/templates/listEval.tpl
Normal file
@ -0,0 +1,146 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
Praxisphasenmanager (PPM)
|
||||
</title>
|
||||
<meta charset="UTF-8" />
|
||||
<style type="text/css">
|
||||
@import url("/style.css");
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 id="idSiteHeader" class="clSiteHeader">
|
||||
<a href="/index" title="Zurück zur Startseite">Praxisphasenmanager (PPM)</a>
|
||||
</h1>
|
||||
<div id="idContent" class="clContent">
|
||||
<h2 id="idContentHeader" class="clContentHeader">
|
||||
Übersicht: ${data['category']}
|
||||
</h2>
|
||||
<div id="idContentArea" class="clContentArea">
|
||||
% if data['category'] == 'Firmen':
|
||||
% for firmen in data:
|
||||
% if firmen != 'category':
|
||||
<h3>${firmen}</h3>
|
||||
<table id="idList">
|
||||
<tr>
|
||||
<th>Status</th>
|
||||
<th>Student</th>
|
||||
<th>Lehrender</th>
|
||||
<th>Zeitraum: Von</th>
|
||||
<th>Zeitraum: Bis</th>
|
||||
</tr>
|
||||
% for aktuell in data[firmen]['Angebote']['aktuell']:
|
||||
<tr>
|
||||
<td>Aktuell</td>
|
||||
<td>${data[firmen]['Angebote']['aktuell'][aktuell]['Student']}</td>
|
||||
<td>${data[firmen]['Angebote']['aktuell'][aktuell]['Lehrender']}</td>
|
||||
<td>${data[firmen]['Angebote']['aktuell'][aktuell]['ZeitraumVon']}</td>
|
||||
<td>${data[firmen]['Angebote']['aktuell'][aktuell]['ZeitraumBis']}</td>
|
||||
</tr>
|
||||
% endfor
|
||||
% for abgeschlossen in data[firmen]['Angebote']['abgeschlossen']:
|
||||
<tr>
|
||||
<td>Abgeschlossen</td>
|
||||
<td>${data[firmen]['Angebote']['abgeschlossen'][abgeschlossen]['Student']}</td>
|
||||
<td>${data[firmen]['Angebote']['abgeschlossen'][abgeschlossen]['Lehrender']}</td>
|
||||
<td>${data[firmen]['Angebote']['abgeschlossen'][abgeschlossen]['ZeitraumVon']}</td>
|
||||
<td>${data[firmen]['Angebote']['abgeschlossen'][abgeschlossen]['ZeitraumBis']}</td>
|
||||
</tr>
|
||||
% endfor
|
||||
</table>
|
||||
% endif
|
||||
% endfor
|
||||
% endif
|
||||
|
||||
% if data['category'] == 'Studenten':
|
||||
% for studenten in data:
|
||||
% if studenten != 'category':
|
||||
<h3>${studenten}</h3>
|
||||
<table id="idList">
|
||||
<tr>
|
||||
<th>Lehrender</th>
|
||||
<th>Firma</th>
|
||||
<th>Praxisphase</th>
|
||||
<th>Status</th>
|
||||
<th>Zeitraum: Von</th>
|
||||
<th>Zeitraum: Bis</th>
|
||||
</tr>
|
||||
% for angebote in data[studenten]['Angebote']['aktuell']:
|
||||
<tr>
|
||||
<td>${data[studenten]['Angebote']['aktuell'][angebote]['Lehrender']}</td>
|
||||
<td>${data[studenten]['Angebote']['aktuell'][angebote]['Firma']}</td>
|
||||
<td>${data[studenten]['Angebote']['aktuell'][angebote]['Praxisphase']}</td>
|
||||
<td>${data[studenten]['Angebote']['aktuell'][angebote]['Status']}</td>
|
||||
<td>${data[studenten]['Angebote']['aktuell'][angebote]['ZeitraumVon']}</td>
|
||||
<td>${data[studenten]['Angebote']['aktuell'][angebote]['ZeitraumBis']}</td>
|
||||
</tr>
|
||||
% endfor
|
||||
% for angebote in data[studenten]['Angebote']['abgeschlossen']:
|
||||
<tr>
|
||||
<td>${data[studenten]['Angebote']['abgeschlossen'][angebote]['Lehrender']}</td>
|
||||
<td>${data[studenten]['Angebote']['abgeschlossen'][angebote]['Firma']}</td>
|
||||
<td>${data[studenten]['Angebote']['abgeschlossen'][angebote]['Praxisphase']}</td>
|
||||
<td>${data[studenten]['Angebote']['abgeschlossen'][angebote]['Status']}</td>
|
||||
<td>${data[studenten]['Angebote']['abgeschlossen'][angebote]['ZeitraumVon']}</td>
|
||||
<td>${data[studenten]['Angebote']['abgeschlossen'][angebote]['ZeitraumBis']}</td>
|
||||
</tr>
|
||||
% endfor
|
||||
|
||||
|
||||
</table>
|
||||
% endif
|
||||
% endfor
|
||||
% endif
|
||||
|
||||
% if data['category'] == 'Lehrender':
|
||||
% for Lehrender in data:
|
||||
% if Lehrender != 'category':
|
||||
<h3>${Lehrender}</h3>
|
||||
<table id="idList">
|
||||
<tr>
|
||||
<th>Student</th>
|
||||
<th>Firma</th>
|
||||
<th>Praxisphase</th>
|
||||
<th>Status</th>
|
||||
<th>Zeitraum: Von</th>
|
||||
<th>Zeitraum: Bis</th>
|
||||
</tr>
|
||||
% if data[Lehrender] != NULL:
|
||||
% for angebote in data[Lehrender]['Angebote']['aktuell']:
|
||||
<tr>
|
||||
<td>${data[Lehrender]['Angebote']['aktuell'][angebote]['Student']}</td>
|
||||
<td>${data[Lehrender]['Angebote']['aktuell'][angebote]['Firma']}</td>
|
||||
<td>${data[Lehrender]['Angebote']['aktuell'][angebote]['Praxisphase']}</td>
|
||||
<td>${data[Lehrender]['Angebote']['aktuell'][angebote]['Status']}</td>
|
||||
<td>${data[Lehrender]['Angebote']['aktuell'][angebote]['ZeitraumVon']}</td>
|
||||
<td>${data[Lehrender]['Angebote']['aktuell'][angebote]['ZeitraumBis']}</td>
|
||||
</tr>
|
||||
% endfor
|
||||
% for angebote in data[Lehrender]['Angebote']['abgeschlossen']:
|
||||
<tr>
|
||||
<td>${data[Lehrender]['Angebote']['abgeschlossen'][angebote]['Student']}</td>
|
||||
<td>${data[Lehrender]['Angebote']['abgeschlossen'][angebote]['Firma']}</td>
|
||||
<td>${data[Lehrender]['Angebote']['abgeschlossen'][angebote]['Praxisphase']}</td>
|
||||
<td>${data[Lehrender]['Angebote']['abgeschlossen'][angebote]['Status']}</td>
|
||||
<td>${data[Lehrender]['Angebote']['abgeschlossen'][angebote]['ZeitraumVon']}</td>
|
||||
<td>${data[Lehrender]['Angebote']['abgeschlossen'][angebote]['ZeitraumBis']}</td>
|
||||
</tr>
|
||||
% endfor
|
||||
% endif
|
||||
</table>
|
||||
% endif
|
||||
% endfor
|
||||
% endif
|
||||
</div>
|
||||
|
||||
<div id="idButtonArea" class="clButtonArea">
|
||||
<a href="/index" class="clButton">Startseite</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<footer>
|
||||
<!--<script src="/functions.js" type="text/javascript"></script>-->
|
||||
</footer>
|
||||
</html>
|
BIN
Praktikum2/ppm2/.vs/ppm2/v14/.suo
Normal file
BIN
Praktikum2/ppm2/.vs/ppm2/v14/.suo
Normal file
Binary file not shown.
BIN
Praktikum2/ppm2/app/__pycache__/application.cpython-35.pyc
Normal file
BIN
Praktikum2/ppm2/app/__pycache__/application.cpython-35.pyc
Normal file
Binary file not shown.
BIN
Praktikum2/ppm2/app/__pycache__/category.cpython-35.pyc
Normal file
BIN
Praktikum2/ppm2/app/__pycache__/category.cpython-35.pyc
Normal file
Binary file not shown.
BIN
Praktikum2/ppm2/app/__pycache__/choice.cpython-35.pyc
Normal file
BIN
Praktikum2/ppm2/app/__pycache__/choice.cpython-35.pyc
Normal file
Binary file not shown.
BIN
Praktikum2/ppm2/app/__pycache__/database.cpython-35.pyc
Normal file
BIN
Praktikum2/ppm2/app/__pycache__/database.cpython-35.pyc
Normal file
Binary file not shown.
BIN
Praktikum2/ppm2/app/__pycache__/eval.cpython-35.pyc
Normal file
BIN
Praktikum2/ppm2/app/__pycache__/eval.cpython-35.pyc
Normal file
Binary file not shown.
BIN
Praktikum2/ppm2/app/__pycache__/template.cpython-35.pyc
Normal file
BIN
Praktikum2/ppm2/app/__pycache__/template.cpython-35.pyc
Normal file
Binary file not shown.
BIN
Praktikum2/ppm2/app/__pycache__/templates.cpython-35.pyc
Normal file
BIN
Praktikum2/ppm2/app/__pycache__/templates.cpython-35.pyc
Normal file
Binary file not shown.
BIN
Praktikum2/ppm2/app/__pycache__/view.cpython-35.pyc
Normal file
BIN
Praktikum2/ppm2/app/__pycache__/view.cpython-35.pyc
Normal file
Binary file not shown.
332
Praktikum2/ppm2/app/application.py.old
Normal file
332
Praktikum2/ppm2/app/application.py.old
Normal file
@ -0,0 +1,332 @@
|
||||
import json
|
||||
import cherrypy
|
||||
from app import database
|
||||
from app import view
|
||||
|
||||
#----------------------------------------------------------
|
||||
class Application_cl(object):
|
||||
#----------------------------------------------------------
|
||||
exposed = True
|
||||
|
||||
#----------------------------------------------------------
|
||||
def __init__(self):
|
||||
#----------------------------------------------------------
|
||||
self.db_o = database.Database_cl()
|
||||
self.view_o = view.View_cl()
|
||||
|
||||
#----------------------------------------------------------
|
||||
def GET(self, cat=None, id=None):
|
||||
#----------------------------------------------------------
|
||||
|
||||
return json.dumps(retVal)
|
||||
|
||||
#----------------------------------------------------------
|
||||
def PUT(self, **data):
|
||||
#----------------------------------------------------------
|
||||
|
||||
return json.dumps(retVal)
|
||||
|
||||
#----------------------------------------------------------
|
||||
def POST(self, cat, id, **data_opl):
|
||||
#----------------------------------------------------------
|
||||
|
||||
return json.dumps(retVal)
|
||||
|
||||
#----------------------------------------------------------
|
||||
def DELETE(self, cat, id):
|
||||
#----------------------------------------------------------
|
||||
|
||||
return json.dumps(retVal)
|
||||
|
||||
#----------------------------------------------------------
|
||||
def default(self, *arguments, **kwargs):
|
||||
#----------------------------------------------------------
|
||||
msg_s = "unbekannte Anforderung: " + \
|
||||
str(arguments) + \
|
||||
' ' + \
|
||||
str(kwargs)
|
||||
raise cherrypy.HTTPError(404, msg_s)
|
||||
|
||||
# /* import cherrypy
|
||||
# from .database import Database_cl
|
||||
# from .view import View_cl
|
||||
# import collections
|
||||
# orderedDict = collections.OrderedDict()
|
||||
# from collections import OrderedDict
|
||||
|
||||
# #----------------------------------------------------------
|
||||
# class Application_cl(object):
|
||||
# #----------------------------------------------------------
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# # Request Processing
|
||||
# #-------------------------------------------------------
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def __init__(self):
|
||||
# #-------------------------------------------------------
|
||||
# # spezielle Initialisierung können hier eingetragen werden
|
||||
# self.db = Database_cl()
|
||||
# self.view = View_cl()
|
||||
# @cherrypy.expose
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def index(self):
|
||||
# #-------------------------------------------------------
|
||||
# print("Index\n")
|
||||
# return self.GenerateIndex()
|
||||
# @cherrypy.expose
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def category(self, cat=None):
|
||||
# #-------------------------------------------------------
|
||||
# print("Category: ", cat, "\n")
|
||||
# if(cat==None):
|
||||
# return self.GenerateIndex()
|
||||
# else:
|
||||
# return self.GenerateList(cat)
|
||||
# @cherrypy.expose
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def choice(self):
|
||||
# #-------------------------------------------------------
|
||||
# print("Choice \n")
|
||||
# return self.GenerateListChoice()
|
||||
# @cherrypy.expose
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def eval(self, cat):
|
||||
# #-------------------------------------------------------
|
||||
# print("Eval \n")
|
||||
# self.db.CheckDates()
|
||||
# return self.GenerateListEval(cat)
|
||||
# @cherrypy.expose
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def detail(self, cat=None, id=None):
|
||||
# #-------------------------------------------------------
|
||||
# if(cat!=None):
|
||||
# if(id!=None):
|
||||
# print("Cat=", cat, " id=", id)
|
||||
# return self.GenerateDetail(cat, id)
|
||||
# else:
|
||||
# print("ID=None Cat=", cat)
|
||||
# return self.GenerateDetail(cat)
|
||||
# else:
|
||||
# return self.GenerateIndex()
|
||||
# @cherrypy.expose
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def detailchoice(self, id):
|
||||
# #-------------------------------------------------------
|
||||
# print("id=", id)
|
||||
# return self.GenerateDetailChoice(id)
|
||||
|
||||
# @cherrypy.expose
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def save(self, cat=None, **data):
|
||||
# #-------------------------------------------------------
|
||||
# print("Save: ", cat)
|
||||
# dataTmp = data
|
||||
# return self.GenerateSave(dataTmp, cat)
|
||||
# @cherrypy.expose
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def saveChoice(self, **data):
|
||||
# #-------------------------------------------------------
|
||||
# print("Save: Choice")
|
||||
# dataTmp = data
|
||||
# return self.GenerateSaveChoice(dataTmp)
|
||||
# @cherrypy.expose
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def delete(self, cat=None, id=None):
|
||||
# #-------------------------------------------------------
|
||||
# print("Delete",cat,id)
|
||||
# return self.GenerateDelete(cat, id)
|
||||
# @cherrypy.expose
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def default(self, *arguments, **kwargs):
|
||||
# #-------------------------------------------------------
|
||||
# msg_s = "unbekannte Anforderung: " + \
|
||||
# str(arguments) + \
|
||||
# ''+ \
|
||||
# str(kwargs)
|
||||
# raise cherrypy.HTTPError(404, msg_s)
|
||||
# default.exposed= True
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# # Functions
|
||||
# #-------------------------------------------------------
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def GenerateIndex(self):
|
||||
# #-------------------------------------------------------
|
||||
# return self.view.CreateIndex()
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def GenerateList(self, category):
|
||||
# #-------------------------------------------------------
|
||||
# self.db.ReadAll()
|
||||
# data = {}
|
||||
# data['content'] = {}
|
||||
# data['headings'] = {}
|
||||
# data['category'] = category
|
||||
# data['content'] = self.db.data[category]
|
||||
# if(len(data['content']) != 0):
|
||||
# print(len(data['content']))
|
||||
# contentFirst = list(data['content'].keys())[0]
|
||||
# data['headings'] = list(data['content'][contentFirst].keys())
|
||||
# print(data)
|
||||
# return self.view.CreateList(data)
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def GenerateListChoice(self):
|
||||
# #-------------------------------------------------------
|
||||
# self.db.ReadAll()
|
||||
# data = {}
|
||||
# data['content'] = {}
|
||||
# offerings = self.db.data['Angebote']
|
||||
# for key, value in offerings.items():
|
||||
# for key2, value2 in value.items():
|
||||
# if(key2 == 'Status'):
|
||||
# if(value2 == 'Angebot'):
|
||||
# data['content'][key] = value
|
||||
|
||||
# print(data)
|
||||
# return self.view.CreateListChoice(data)
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def GenerateDetail(self, category, id=None):
|
||||
# #-------------------------------------------------------
|
||||
# self.db.ReadAll()
|
||||
# data = {}
|
||||
# data['category'] = category
|
||||
# print("Detail",category,id)
|
||||
# if(id != None):
|
||||
# data['id'] = id
|
||||
# data['content'] = self.db.ReadEntry(category, id)
|
||||
# else:
|
||||
# data['id'] = None
|
||||
# data['content'] = self.db.GetDefault(category)
|
||||
# print(data['content'])
|
||||
# if(category == 'Angebote'):
|
||||
# print("Angebote")
|
||||
# data['Firmen'] = self.db.data['Firmen']
|
||||
# print(data, "\n")
|
||||
# return self.view.CreateDetail(data)
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def GenerateDetailChoice(self, id):
|
||||
# #-------------------------------------------------------
|
||||
# self.db.ReadAll()
|
||||
# data = {}
|
||||
# data['id'] = id
|
||||
# data = self.db.data['Angebote'][id]
|
||||
# data['Studenten'] = self.db.data['Studenten']
|
||||
# data['Lehrender'] = self.db.data['Lehrender']
|
||||
# print(data, "\n")
|
||||
# return self.view.CreateDetailChoice(data)
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def GenerateListEval(self, cat):
|
||||
# #-------------------------------------------------------
|
||||
# self.db.ReadAll()
|
||||
# data = {}
|
||||
# Studenten = self.db.data['Studenten']
|
||||
# Lehrender = self.db.data['Lehrender']
|
||||
# Firmen = self.db.data['Firmen']
|
||||
# Angebote = self.db.data['Angebote']
|
||||
|
||||
# data['category'] = cat
|
||||
# if(cat == 'Firmen'):
|
||||
# for keyFirma, valueFirma in sorted(Firmen.items()):
|
||||
# data[valueFirma['Name']] = {}
|
||||
# data[valueFirma['Name']]['Name'] = valueFirma['Name']
|
||||
# data[valueFirma['Name']]['Angebote'] = {}
|
||||
# data[valueFirma['Name']]['Angebote']['Angebot'] = {}
|
||||
# data[valueFirma['Name']]['Angebote']['aktuell'] = {}
|
||||
# data[valueFirma['Name']]['Angebote']['abgeschlossen'] = {}
|
||||
# for keyAngebote, valueAngebote in Angebote.items():
|
||||
# if(valueAngebote['Firma'] == valueFirma['Name']):
|
||||
# data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']] = {}
|
||||
# data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']]['Name'] = valueAngebote['Name']
|
||||
# if(valueAngebote['Student'] != ''):
|
||||
# data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']]['Student'] = Studenten[valueAngebote['Student']]['Name']
|
||||
# else:
|
||||
# data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']]['Student'] = ''
|
||||
# if(valueAngebote['Lehrender'] != ''):
|
||||
# data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']]['Lehrender'] = Lehrender[valueAngebote['Lehrender']]['Name']
|
||||
# else:
|
||||
# data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']]['Lehrender'] = ''
|
||||
# data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']]['ZeitraumVon'] = valueAngebote['ZeitraumVon']
|
||||
# data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']]['ZeitraumBis'] = valueAngebote['ZeitraumBis']
|
||||
# print(data)
|
||||
# return self.view.CreateListEval(data)
|
||||
# elif(cat == 'Studenten'):
|
||||
# for keyStudent, valueStudent in Studenten.items():
|
||||
# data[valueStudent['Name']] = {}
|
||||
# data[valueStudent['Name']]['Angebote'] = {}
|
||||
# data[valueStudent['Name']]['Angebote']['Angebot'] = {}
|
||||
# data[valueStudent['Name']]['Angebote']['aktuell'] = {}
|
||||
# data[valueStudent['Name']]['Angebote']['abgeschlossen'] = {}
|
||||
# for keyAngebot, valueAngebot in Angebote.items():
|
||||
# if(valueAngebot['Student'] == valueStudent['id']):
|
||||
# data[valueStudent['Name']]['Angebote'][valueAngebot['Status']][keyAngebot] = {}
|
||||
# data[valueStudent['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['Lehrender'] = Lehrender[valueAngebot['Lehrender']]['Name']
|
||||
# data[valueStudent['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['Status'] = valueAngebot['Status']
|
||||
# data[valueStudent['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['Praxisphase'] = valueAngebot['Name']
|
||||
# data[valueStudent['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['Firma'] = valueAngebot['Firma']
|
||||
# data[valueStudent['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['ZeitraumVon'] = valueAngebot['ZeitraumVon']
|
||||
# data[valueStudent['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['ZeitraumBis'] = valueAngebot['ZeitraumBis']
|
||||
# elif(cat == 'Lehrender'):
|
||||
# for keyLehrende, valueLehrende in Lehrender.items():
|
||||
# data[valueLehrende['Name']] = {}
|
||||
# data[valueLehrende['Name']]['Angebote'] = {}
|
||||
# data[valueLehrende['Name']]['Angebote']['Angebot'] = {}
|
||||
# data[valueLehrende['Name']]['Angebote']['aktuell'] = {}
|
||||
# data[valueLehrende['Name']]['Angebote']['abgeschlossen'] = {}
|
||||
# for keyAngebot, valueAngebot in Angebote.items():
|
||||
# if(valueAngebot['Lehrender'] == valueLehrende['id']):
|
||||
# data[valueLehrende['Name']]['Angebote'][valueAngebot['Status']][keyAngebot] = {}
|
||||
# data[valueLehrende['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['Student'] = Studenten[valueAngebot['Student']]['Name']
|
||||
# data[valueLehrende['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['Status'] = valueAngebot['Status']
|
||||
# data[valueLehrende['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['Praxisphase'] = valueAngebot['Name']
|
||||
# data[valueLehrende['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['Firma'] = valueAngebot['Firma']
|
||||
# data[valueLehrende['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['ZeitraumVon'] = valueAngebot['ZeitraumVon']
|
||||
# data[valueLehrende['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['ZeitraumBis'] = valueAngebot['ZeitraumBis']
|
||||
|
||||
# return self.view.CreateListEval(data)
|
||||
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def GenerateSave(self, dataTmp, category):
|
||||
# #-------------------------------------------------------
|
||||
# if(category == None):
|
||||
# return self.view.CreateIndex()
|
||||
# else:
|
||||
# self.db.Save(dataTmp, category)
|
||||
# return self.GenerateList(category)
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def GenerateSaveChoice(self, dataTmp):
|
||||
# #-------------------------------------------------------
|
||||
# if(dataTmp['Student'] != ''):
|
||||
# angebote = self.db.CheckOfferings(dataTmp['Student'])
|
||||
# print(angebote)
|
||||
# if(angebote == 0):
|
||||
# print("Save")
|
||||
# self.db.Save(dataTmp, 'Angebote')
|
||||
# return self.GenerateListChoice()
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def GenerateDelete(self, category, id):
|
||||
# #-------------------------------------------------------
|
||||
# if(category == None or id == None):
|
||||
# return self.view.CreateIndex()
|
||||
# else:
|
||||
# self.db.Delete(category, id)
|
||||
# return self.GenerateList(category)
|
||||
# #EOF
|
33
Praktikum2/ppm2/app/category.py
Normal file
33
Praktikum2/ppm2/app/category.py
Normal file
@ -0,0 +1,33 @@
|
||||
# coding: utf-8
|
||||
|
||||
import json
|
||||
import cherrypy
|
||||
from app import database
|
||||
|
||||
#-------------------------------------------------------
|
||||
class Category(object):
|
||||
#-------------------------------------------------------
|
||||
|
||||
exposed = True # gilt für alle Methoden
|
||||
|
||||
#-------------------------------------------------------
|
||||
def __init__(self):
|
||||
#-------------------------------------------------------
|
||||
self.db = database.Database()
|
||||
|
||||
#-------------------------------------------------------
|
||||
def GET(self, cat=None):
|
||||
#-------------------------------------------------------
|
||||
data = {}
|
||||
if(cat != None):
|
||||
self.db.ReadAll()
|
||||
data['content'] = {}
|
||||
data['headings'] = {}
|
||||
data['category'] = cat
|
||||
data['content'] = self.db.data[cat]
|
||||
if(len(data['content']) != 0):
|
||||
print(len(data['content']))
|
||||
contentFirst = list(data['content'].keys())[0]
|
||||
data['headings'] = list(data['content'][contentFirst].keys())
|
||||
print(data)
|
||||
return json.dumps(data)
|
31
Praktikum2/ppm2/app/choice.py
Normal file
31
Praktikum2/ppm2/app/choice.py
Normal file
@ -0,0 +1,31 @@
|
||||
# coding: utf-8
|
||||
|
||||
import json
|
||||
import cherrypy
|
||||
from app import database
|
||||
|
||||
#-------------------------------------------------------
|
||||
class Choice(object):
|
||||
#-------------------------------------------------------
|
||||
|
||||
exposed = True # gilt für alle Methoden
|
||||
|
||||
#-------------------------------------------------------
|
||||
def __init__(self):
|
||||
#-------------------------------------------------------
|
||||
self.db = database.Database()
|
||||
|
||||
#-------------------------------------------------------
|
||||
def GET(self):
|
||||
#-------------------------------------------------------
|
||||
self.db.ReadAll()
|
||||
data = {}
|
||||
data['content'] = {}
|
||||
offerings = self.db.data['Angebote']
|
||||
for key, value in offerings.items():
|
||||
for key2, value2 in value.items():
|
||||
if(key2 == 'Status'):
|
||||
if(value2 == 'Angebot'):
|
||||
data['content'][key] = value
|
||||
print(data)
|
||||
return json.dumps(data)
|
189
Praktikum2/ppm2/app/database.py
Normal file
189
Praktikum2/ppm2/app/database.py
Normal file
@ -0,0 +1,189 @@
|
||||
# coding: utf-8
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import codecs
|
||||
import json
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
#----------------------------------------------------------
|
||||
class Database(object):
|
||||
#----------------------------------------------------------
|
||||
# da es hier nur darum geht, die Daten dauerhaft zu speichern,
|
||||
# wird ein sehr einfacher Ansatz verwendet:
|
||||
# - es können Daten zu genau 15 Teams gespeichert werden
|
||||
# - je Team werden 2 Teilnehmer mit Namen, Vornamen und Matrikelnummer
|
||||
# berücksichtigt
|
||||
# - die Daten werden als eine JSON-Datei abgelegt
|
||||
|
||||
|
||||
#-------------------------------------------------------
|
||||
def __init__(self):
|
||||
#-------------------------------------------------------
|
||||
self.data = {}
|
||||
self.data['Studenten'] = {}
|
||||
self.data['Lehrender'] = {}
|
||||
self.data['Firmen'] = {}
|
||||
self.data['Angebote'] = {}
|
||||
self.ReadAll()
|
||||
|
||||
|
||||
#-------------------------------------------------------
|
||||
def Read(self, category):
|
||||
#-------------------------------------------------------
|
||||
path = 'data/' + category
|
||||
if not(os.path.exists(path)):
|
||||
os.makedirs(path)
|
||||
categoryDir = os.listdir(path)
|
||||
for fileName in categoryDir:
|
||||
if fileName.endswith('.json') and fileName != 'last.json':
|
||||
file = codecs.open(os.path.join('data', category, fileName), 'rU', 'utf-8')
|
||||
fileContent = file.read()
|
||||
id = fileName[:-5]
|
||||
self.data[category][id] = json.loads(fileContent)
|
||||
|
||||
#-------------------------------------------------------
|
||||
def ReadAll(self):
|
||||
#-------------------------------------------------------
|
||||
self.Read('Studenten')
|
||||
self.Read('Lehrender')
|
||||
self.Read('Firmen')
|
||||
self.Read('Angebote')
|
||||
|
||||
#-------------------------------------------------------
|
||||
def ReadEntry(self, category = None, id = None):
|
||||
#-------------------------------------------------------
|
||||
print("ReadEntry: ", category, id)
|
||||
self.Read(category)
|
||||
data = None
|
||||
if id == None:
|
||||
data = self.data
|
||||
else:
|
||||
if id in self.data[category]:
|
||||
data = self.data[category][id]
|
||||
|
||||
print(data, "\n")
|
||||
return data
|
||||
|
||||
#-------------------------------------------------------
|
||||
def Save(self, data, category):
|
||||
#-------------------------------------------------------
|
||||
status_b = False
|
||||
id = data['id']
|
||||
print("ID: ", id, "\n")
|
||||
if(id != "None"):
|
||||
if id in self.data[category]:
|
||||
file = codecs.open(os.path.join('data', category, id+'.json'), 'w', 'utf-8')
|
||||
file.write(json.dumps(data, indent=3, ensure_ascii=True))
|
||||
file.close()
|
||||
self.Read(category)
|
||||
status_b = True
|
||||
else:
|
||||
data['id'] = self.IdNext(category)
|
||||
file = codecs.open(os.path.join('data', category, data['id']+'.json'), 'w', 'utf-8')
|
||||
file.write(json.dumps(data, indent=3, ensure_ascii=True))
|
||||
file.close()
|
||||
self.Read(category)
|
||||
status_b = True
|
||||
|
||||
return status_b
|
||||
|
||||
#-------------------------------------------------------
|
||||
def Delete(self, category, id):
|
||||
#-------------------------------------------------------
|
||||
status_b = False
|
||||
if(category == 'Studenten'):
|
||||
for angebote in self.data['Angebote']:
|
||||
if(self.data['Angebote'][angebote]['Student'] == id):
|
||||
try:
|
||||
os.remove(os.path.join('data', 'Angebote', angebote+'.json'))
|
||||
except OSError:
|
||||
pass
|
||||
elif(category == 'Lehrender'):
|
||||
for angebote in self.data['Angebote']:
|
||||
if(self.data['Angebote'][angebote]['Lehrender'] == id):
|
||||
try:
|
||||
os.remove(os.path.join('data', 'Angebote', angebote+'.json'))
|
||||
except OSError:
|
||||
pass
|
||||
elif(category == 'Firmen'):
|
||||
for firmen in self.data['Firmen']:
|
||||
if(firmen == id):
|
||||
fn = self.data['Firmen'][firmen]['Name']
|
||||
for angebote in self.data['Angebote']:
|
||||
if(self.data['Angebote'][angebote]['Firma'] == fn):
|
||||
try:
|
||||
os.remove(os.path.join('data', 'Angebote', angebote+'.json'))
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
if id in self.data[category]:
|
||||
os.remove(os.path.join('data', category, id+'.json'))
|
||||
del self.data[category][id]
|
||||
|
||||
return status_b
|
||||
|
||||
#-------------------------------------------------------
|
||||
def CheckOfferings(self, id):
|
||||
#-------------------------------------------------------
|
||||
print("Offerings: ", id)
|
||||
for offerings in self.data['Angebote']:
|
||||
if(self.data['Angebote'][offerings]['Student'] != id):
|
||||
return 0
|
||||
else:
|
||||
return 1
|
||||
|
||||
#-------------------------------------------------------
|
||||
def CheckDates(self):
|
||||
#-------------------------------------------------------
|
||||
now = datetime.now()
|
||||
for offerings in self.data['Angebote']:
|
||||
if(self.data['Angebote'][offerings]['ZeitraumBis'] != ''):
|
||||
zeitraumBis = datetime.strptime(self.data['Angebote'][offerings]['ZeitraumBis'], "%d.%m.%Y")
|
||||
if(zeitraumBis <= now):
|
||||
self.data['Angebote'][offerings]['Status'] = 'abgeschlossen'
|
||||
data = {}
|
||||
data['Status'] = 'abgeschlossen'
|
||||
data['id'] = offerings
|
||||
data['Name'] = self.data['Angebote'][offerings]['Name']
|
||||
data['Firma'] = self.data['Angebote'][offerings]['Firma']
|
||||
data['Beschreibung'] = self.data['Angebote'][offerings]['Beschreibung']
|
||||
data['Voraussetzungen'] = self.data['Angebote'][offerings]['Voraussetzungen']
|
||||
data['Firmenbetreuer'] = self.data['Angebote'][offerings]['Firmenbetreuer']
|
||||
data['Lehrender'] = self.data['Angebote'][offerings]['Lehrender']
|
||||
data['ZeitraumVon'] = self.data['Angebote'][offerings]['ZeitraumVon']
|
||||
data['ZeitraumBis'] = self.data['Angebote'][offerings]['ZeitraumBis']
|
||||
data['Student'] = self.data['Angebote'][offerings]['Student']
|
||||
self.Save(data, 'Angebote')
|
||||
|
||||
#-------------------------------------------------------
|
||||
def GetDefault(self, category):
|
||||
#-------------------------------------------------------
|
||||
if(category == 'Studenten'):
|
||||
return {'Name':'', 'Vorname':'', 'Matrikelnummer':''}
|
||||
elif(category == 'Lehrender'):
|
||||
return {'Titel':'', 'Name':'', 'Vorname':'', 'Lehrgebiet':''}
|
||||
elif(category == 'Firmen'):
|
||||
return {'Name':'', 'Branche':'', 'Schwerpunkt':'', 'Sitz':'', 'Anzahl Mitarbeiter':''}
|
||||
elif(category == 'Angebote'):
|
||||
return {'Name':'', 'Firma':'', 'Beschreibung':'', 'Voraussetzungen':'', 'Firmenbetreuer':'', 'Status':'Angebot', 'Lehrender':'', 'ZeitraumVon':'', 'ZeitraumBis':'', 'Student':''}
|
||||
|
||||
#-------------------------------------------------------
|
||||
def IdNext(self, category):
|
||||
#-------------------------------------------------------
|
||||
path = 'data/' + category + '/last.json'
|
||||
if(os.path.isfile(path)):
|
||||
file = open(os.path.join('data', category, 'last.json'), 'r+')
|
||||
last = file.read()
|
||||
last = str(int(last)+1)
|
||||
file.seek(0)
|
||||
file.write(last)
|
||||
file.close()
|
||||
else:
|
||||
file = open(os.path.join('data', category, 'last.json'), 'w+')
|
||||
last = str(int(0))
|
||||
file.write(last)
|
||||
file.close()
|
||||
return last
|
||||
|
||||
# EOF
|
85
Praktikum2/ppm2/app/eval.py
Normal file
85
Praktikum2/ppm2/app/eval.py
Normal file
@ -0,0 +1,85 @@
|
||||
# coding: utf-8
|
||||
|
||||
import json
|
||||
import cherrypy
|
||||
from app import database
|
||||
|
||||
#-------------------------------------------------------
|
||||
class Eval(object):
|
||||
#-------------------------------------------------------
|
||||
|
||||
exposed = True # gilt für alle Methoden
|
||||
|
||||
#-------------------------------------------------------
|
||||
def __init__(self):
|
||||
#-------------------------------------------------------
|
||||
self.db = database.Database()
|
||||
|
||||
#-------------------------------------------------------
|
||||
def GET(self, cat=None):
|
||||
#-------------------------------------------------------
|
||||
self.db.CheckDates()
|
||||
self.db.ReadAll()
|
||||
data = {}
|
||||
Studenten = self.db.data['Studenten']
|
||||
Lehrender = self.db.data['Lehrender']
|
||||
Firmen = self.db.data['Firmen']
|
||||
Angebote = self.db.data['Angebote']
|
||||
|
||||
data['category'] = cat
|
||||
if(cat == 'Firmen'):
|
||||
for keyFirma, valueFirma in sorted(Firmen.items()):
|
||||
data[valueFirma['Name']] = {}
|
||||
data[valueFirma['Name']]['Name'] = valueFirma['Name']
|
||||
data[valueFirma['Name']]['Angebote'] = {}
|
||||
data[valueFirma['Name']]['Angebote']['Angebot'] = {}
|
||||
data[valueFirma['Name']]['Angebote']['aktuell'] = {}
|
||||
data[valueFirma['Name']]['Angebote']['abgeschlossen'] = {}
|
||||
for keyAngebote, valueAngebote in Angebote.items():
|
||||
if(valueAngebote['Firma'] == valueFirma['Name']):
|
||||
data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']] = {}
|
||||
data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']]['Name'] = valueAngebote['Name']
|
||||
if(valueAngebote['Student'] != ''):
|
||||
data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']]['Student'] = Studenten[valueAngebote['Student']]['Name']
|
||||
else:
|
||||
data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']]['Student'] = ''
|
||||
if(valueAngebote['Lehrender'] != ''):
|
||||
data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']]['Lehrender'] = Lehrender[valueAngebote['Lehrender']]['Name']
|
||||
else:
|
||||
data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']]['Lehrender'] = ''
|
||||
data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']]['ZeitraumVon'] = valueAngebote['ZeitraumVon']
|
||||
data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']]['ZeitraumBis'] = valueAngebote['ZeitraumBis']
|
||||
elif(cat == 'Studenten'):
|
||||
for keyStudent, valueStudent in Studenten.items():
|
||||
data[valueStudent['Name']] = {}
|
||||
data[valueStudent['Name']]['Angebote'] = {}
|
||||
data[valueStudent['Name']]['Angebote']['Angebot'] = {}
|
||||
data[valueStudent['Name']]['Angebote']['aktuell'] = {}
|
||||
data[valueStudent['Name']]['Angebote']['abgeschlossen'] = {}
|
||||
for keyAngebot, valueAngebot in Angebote.items():
|
||||
if(valueAngebot['Student'] == valueStudent['id']):
|
||||
data[valueStudent['Name']]['Angebote'][valueAngebot['Status']][keyAngebot] = {}
|
||||
data[valueStudent['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['Lehrender'] = Lehrender[valueAngebot['Lehrender']]['Name']
|
||||
data[valueStudent['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['Status'] = valueAngebot['Status']
|
||||
data[valueStudent['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['Praxisphase'] = valueAngebot['Name']
|
||||
data[valueStudent['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['Firma'] = valueAngebot['Firma']
|
||||
data[valueStudent['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['ZeitraumVon'] = valueAngebot['ZeitraumVon']
|
||||
data[valueStudent['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['ZeitraumBis'] = valueAngebot['ZeitraumBis']
|
||||
elif(cat == 'Lehrender'):
|
||||
for keyLehrende, valueLehrende in Lehrender.items():
|
||||
data[valueLehrende['Name']] = {}
|
||||
data[valueLehrende['Name']]['Angebote'] = {}
|
||||
data[valueLehrende['Name']]['Angebote']['Angebot'] = {}
|
||||
data[valueLehrende['Name']]['Angebote']['aktuell'] = {}
|
||||
data[valueLehrende['Name']]['Angebote']['abgeschlossen'] = {}
|
||||
for keyAngebot, valueAngebot in Angebote.items():
|
||||
if(valueAngebot['Lehrender'] == valueLehrende['id']):
|
||||
data[valueLehrende['Name']]['Angebote'][valueAngebot['Status']][keyAngebot] = {}
|
||||
data[valueLehrende['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['Student'] = Studenten[valueAngebot['Student']]['Name']
|
||||
data[valueLehrende['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['Status'] = valueAngebot['Status']
|
||||
data[valueLehrende['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['Praxisphase'] = valueAngebot['Name']
|
||||
data[valueLehrende['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['Firma'] = valueAngebot['Firma']
|
||||
data[valueLehrende['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['ZeitraumVon'] = valueAngebot['ZeitraumVon']
|
||||
data[valueLehrende['Name']]['Angebote'][valueAngebot['Status']][keyAngebot]['ZeitraumBis'] = valueAngebot['ZeitraumBis']
|
||||
print(data)
|
||||
return json.dumps(data)
|
37
Praktikum2/ppm2/app/templates.py
Normal file
37
Praktikum2/ppm2/app/templates.py
Normal file
@ -0,0 +1,37 @@
|
||||
# coding: utf-8
|
||||
|
||||
import json
|
||||
import os
|
||||
import codecs
|
||||
import cherrypy
|
||||
|
||||
#----------------------------------------------------------
|
||||
class Templates(object):
|
||||
#----------------------------------------------------------
|
||||
|
||||
exposed = True # gilt für alle Methoden
|
||||
|
||||
#-------------------------------------------------------
|
||||
def __init__(self):
|
||||
#-------------------------------------------------------
|
||||
pass
|
||||
|
||||
#-------------------------------------------------------
|
||||
def GET(self):
|
||||
#-------------------------------------------------------
|
||||
retVal = {
|
||||
'templates': {}
|
||||
}
|
||||
|
||||
files = os.listdir('templates')
|
||||
for fileName in files:
|
||||
if fileName != '.DS_Store':
|
||||
file = codecs.open(os.path.join('templates', fileName), 'rU', 'utf-8', errors='ignore')
|
||||
content = file.read()
|
||||
file.close()
|
||||
retVal["templates"][fileName] = content
|
||||
print(retVal)
|
||||
|
||||
return json.dumps(retVal)
|
||||
|
||||
# EOF
|
52
Praktikum2/ppm2/app/view.py.old
Normal file
52
Praktikum2/ppm2/app/view.py.old
Normal file
@ -0,0 +1,52 @@
|
||||
# import os.path
|
||||
# from mako.template import Template
|
||||
# from mako.lookup import TemplateLookup
|
||||
|
||||
# #----------------------------------------------------------
|
||||
# class View_cl(object):
|
||||
# #----------------------------------------------------------
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def __init__(self):
|
||||
# #-------------------------------------------------------
|
||||
# self.path = 'templates'
|
||||
# self.lookup = TemplateLookup(directories=['/'])
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def Create(self, template, data):
|
||||
# #-------------------------------------------------------
|
||||
# print("CreateView\n")
|
||||
# template = Template(filename=os.path.join(self.path, template), output_encoding='utf-8', lookup=self.lookup)
|
||||
# return template.render(data = data)
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def CreateIndex(self):
|
||||
# #-------------------------------------------------------
|
||||
# print("CreateIndex\n")
|
||||
# data = None
|
||||
# return self.Create('index.tpl', data)
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def CreateList(self, data):
|
||||
# #-------------------------------------------------------
|
||||
# return self.Create('list.tpl', data)
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def CreateListChoice(self, data):
|
||||
# #-------------------------------------------------------
|
||||
# return self.Create('listChoice.tpl', data)
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def CreateListEval(self, data):
|
||||
# #-------------------------------------------------------
|
||||
# return self.Create('listEval.tpl', data)
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def CreateDetail(self, data):
|
||||
# #-------------------------------------------------------
|
||||
# return self.Create('detail.tpl', data)
|
||||
|
||||
# #-------------------------------------------------------
|
||||
# def CreateDetailChoice(self, data):
|
||||
# #-------------------------------------------------------
|
||||
# return self.Create('detailChoice.tpl', data)
|
13
Praktikum2/ppm2/data/Angebote/23.json
Normal file
13
Praktikum2/ppm2/data/Angebote/23.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"Name": "Angebot IBM 1",
|
||||
"ZeitraumBis": "01.01.2018",
|
||||
"id": "23",
|
||||
"Firmenbetreuer": "Sepp Meine",
|
||||
"Firma": "IBM",
|
||||
"Voraussetzungen": "Keine",
|
||||
"Lehrender": "7",
|
||||
"Status": "aktuell",
|
||||
"Beschreibung": "Praxisphasenplatz bei IBM",
|
||||
"ZeitraumVon": "01.01.2017",
|
||||
"Student": "9"
|
||||
}
|
13
Praktikum2/ppm2/data/Angebote/26.json
Normal file
13
Praktikum2/ppm2/data/Angebote/26.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"id": "26",
|
||||
"ZeitraumVon": "02.02.2019",
|
||||
"Firma": "Apple",
|
||||
"Student": "10",
|
||||
"Beschreibung": "Beschreibung",
|
||||
"Name": "Name",
|
||||
"Lehrender": "5",
|
||||
"Firmenbetreuer": "Firmenbetreuer3",
|
||||
"Voraussetzungen": "Kein",
|
||||
"Status": "aktuell",
|
||||
"ZeitraumBis": "02.02.2020"
|
||||
}
|
13
Praktikum2/ppm2/data/Angebote/27.json
Normal file
13
Praktikum2/ppm2/data/Angebote/27.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ZeitraumBis": "02.02.2003",
|
||||
"Firma": "Apple",
|
||||
"ZeitraumVon": "02.02.2002",
|
||||
"Lehrender": "5",
|
||||
"id": "27",
|
||||
"Status": "abgeschlossen",
|
||||
"Student": "11",
|
||||
"Beschreibung": "Praxisphase Apple",
|
||||
"Firmenbetreuer": "Horst",
|
||||
"Voraussetzungen": "Keine",
|
||||
"Name": "Angebot Apple 2"
|
||||
}
|
13
Praktikum2/ppm2/data/Angebote/30.json
Normal file
13
Praktikum2/ppm2/data/Angebote/30.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ZeitraumBis": "",
|
||||
"Firmenbetreuer": "firmenbetreuer",
|
||||
"id": "30",
|
||||
"ZeitraumVon": "",
|
||||
"Name": "name",
|
||||
"Beschreibung": "beschreibung",
|
||||
"Student": "",
|
||||
"Lehrender": "",
|
||||
"Status": "Angebot",
|
||||
"Voraussetzungen": "voraussetzungen",
|
||||
"Firma": "IBM"
|
||||
}
|
1
Praktikum2/ppm2/data/Angebote/last.json
Normal file
1
Praktikum2/ppm2/data/Angebote/last.json
Normal file
@ -0,0 +1 @@
|
||||
27
|
8
Praktikum2/ppm2/data/Firmen/4.json
Normal file
8
Praktikum2/ppm2/data/Firmen/4.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"id": "4",
|
||||
"Branche": "IT",
|
||||
"Sitz": "Cupertino",
|
||||
"Schwerpunkt": "Informatik",
|
||||
"Anzahl Mitarbeiter": "110000",
|
||||
"Name": "Apple"
|
||||
}
|
8
Praktikum2/ppm2/data/Firmen/5.json
Normal file
8
Praktikum2/ppm2/data/Firmen/5.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"id": "5",
|
||||
"Branche": "IT",
|
||||
"Sitz": "Redmond",
|
||||
"Schwerpunkt": "Informatik",
|
||||
"Anzahl Mitarbeiter": "114000",
|
||||
"Name": "Microsoft"
|
||||
}
|
8
Praktikum2/ppm2/data/Firmen/6.json
Normal file
8
Praktikum2/ppm2/data/Firmen/6.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"id": "6",
|
||||
"Branche": "IT",
|
||||
"Sitz": "Armonk",
|
||||
"Schwerpunkt": "Elektrotechnik",
|
||||
"Anzahl Mitarbeiter": "377000",
|
||||
"Name": "IBM"
|
||||
}
|
1
Praktikum2/ppm2/data/Firmen/last.json
Normal file
1
Praktikum2/ppm2/data/Firmen/last.json
Normal file
@ -0,0 +1 @@
|
||||
6
|
7
Praktikum2/ppm2/data/Lehrender/5.json
Normal file
7
Praktikum2/ppm2/data/Lehrender/5.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"Titel": "Prof",
|
||||
"id": "5",
|
||||
"Lehrgebiet": "Informatik",
|
||||
"Name": "Heiner",
|
||||
"Vorname": "Theodor"
|
||||
}
|
7
Praktikum2/ppm2/data/Lehrender/6.json
Normal file
7
Praktikum2/ppm2/data/Lehrender/6.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"Titel": "Prof Dr",
|
||||
"id": "6",
|
||||
"Lehrgebiet": "Elektrotechnik",
|
||||
"Name": "Anton",
|
||||
"Vorname": "Emanuel"
|
||||
}
|
7
Praktikum2/ppm2/data/Lehrender/7.json
Normal file
7
Praktikum2/ppm2/data/Lehrender/7.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"Titel": "Prof",
|
||||
"id": "7",
|
||||
"Lehrgebiet": "Informatik",
|
||||
"Name": "Adalbert",
|
||||
"Vorname": "Bastian"
|
||||
}
|
7
Praktikum2/ppm2/data/Lehrender/8.json
Normal file
7
Praktikum2/ppm2/data/Lehrender/8.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"Titel": "Dr",
|
||||
"id": "8",
|
||||
"Lehrgebiet": "Elektrotechnik",
|
||||
"Name": "Leberecht",
|
||||
"Vorname": "Egon"
|
||||
}
|
1
Praktikum2/ppm2/data/Lehrender/last.json
Normal file
1
Praktikum2/ppm2/data/Lehrender/last.json
Normal file
@ -0,0 +1 @@
|
||||
13
|
6
Praktikum2/ppm2/data/Studenten/10.json
Normal file
6
Praktikum2/ppm2/data/Studenten/10.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"Vorname": "Timo",
|
||||
"Name": "Ben",
|
||||
"Matrikelnummer": "3",
|
||||
"id": "10"
|
||||
}
|
6
Praktikum2/ppm2/data/Studenten/11.json
Normal file
6
Praktikum2/ppm2/data/Studenten/11.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"Vorname": "Korbinian",
|
||||
"Name": "Moritz",
|
||||
"Matrikelnummer": "6",
|
||||
"id": "11"
|
||||
}
|
6
Praktikum2/ppm2/data/Studenten/12.json
Normal file
6
Praktikum2/ppm2/data/Studenten/12.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"Vorname": "Alfons",
|
||||
"Name": "Meine",
|
||||
"Matrikelnummer": "4",
|
||||
"id": "12"
|
||||
}
|
6
Praktikum2/ppm2/data/Studenten/13.json
Normal file
6
Praktikum2/ppm2/data/Studenten/13.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"id": "13",
|
||||
"Name": "Edmund",
|
||||
"Vorname": "Adalbert",
|
||||
"Matrikelnummer": "1"
|
||||
}
|
6
Praktikum2/ppm2/data/Studenten/9.json
Normal file
6
Praktikum2/ppm2/data/Studenten/9.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"Vorname": "Gregor",
|
||||
"Name": "Klemens",
|
||||
"Matrikelnummer": "2",
|
||||
"id": "9"
|
||||
}
|
1
Praktikum2/ppm2/data/Studenten/last.json
Normal file
1
Praktikum2/ppm2/data/Studenten/last.json
Normal file
@ -0,0 +1 @@
|
||||
14
|
50
Praktikum2/ppm2/ppm2.pyproj
Normal file
50
Praktikum2/ppm2/ppm2.pyproj
Normal file
@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{1747f32f-45d5-4d27-868d-c3fe710f4d86}</ProjectGuid>
|
||||
<ProjectHome />
|
||||
<StartupFile>server.py</StartupFile>
|
||||
<SearchPath />
|
||||
<WorkingDirectory>.</WorkingDirectory>
|
||||
<OutputPath>.</OutputPath>
|
||||
<ProjectTypeGuids>{888888a0-9f3d-457c-b088-3a5042f75d52}</ProjectTypeGuids>
|
||||
<LaunchProvider>Standard Python launcher</LaunchProvider>
|
||||
<InterpreterId />
|
||||
<InterpreterVersion />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Debug'" />
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'" />
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition=" '$(VisualStudioVersion)' == '' ">10.0</VisualStudioVersion>
|
||||
<PtvsTargetsFile>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets</PtvsTargetsFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="app\category.py" />
|
||||
<Compile Include="app\database.py" />
|
||||
<Compile Include="app\template.py" />
|
||||
<Compile Include="server.py" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="static\css\style.css" />
|
||||
<Content Include="static\html\detail.html" />
|
||||
<Content Include="static\html\detailChoice.html" />
|
||||
<Content Include="static\html\index.html" />
|
||||
<Content Include="static\html\listChoice.html" />
|
||||
<Content Include="static\html\listEval.html" />
|
||||
<Content Include="static\js\jquery-3.1.1.min.js" />
|
||||
<Content Include="static\js\ppm.js" />
|
||||
<Content Include="static\js\te.js" />
|
||||
<Content Include="static\js\tm.js" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="app" />
|
||||
<Folder Include="static\" />
|
||||
<Folder Include="static\css" />
|
||||
<Folder Include="static\html" />
|
||||
<Folder Include="static\js" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(PtvsTargetsFile)" Condition="Exists($(PtvsTargetsFile))" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" Condition="!Exists($(PtvsTargetsFile))" />
|
||||
</Project>
|
20
Praktikum2/ppm2/ppm2.sln
Normal file
20
Praktikum2/ppm2/ppm2.sln
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "ppm2", "ppm2.pyproj", "{1747F32F-45D5-4D27-868D-C3FE710F4D86}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{1747F32F-45D5-4D27-868D-C3FE710F4D86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1747F32F-45D5-4D27-868D-C3FE710F4D86}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
19
Praktikum2/ppm2/server.conf
Normal file
19
Praktikum2/ppm2/server.conf
Normal file
@ -0,0 +1,19 @@
|
||||
[global]
|
||||
tools.log_headers.on: True
|
||||
tools.sessions.on: False
|
||||
tools.encode.on: True
|
||||
tools.encode.encoding:"utf-8"
|
||||
|
||||
server.socket_port: 8080
|
||||
server.socket_timeout:60
|
||||
|
||||
server.thread_pool: 10
|
||||
server.environment: "production"
|
||||
log.screen: True
|
||||
|
||||
[/]
|
||||
tools.staticdir.root: cherrypy.Application.currentDir_s
|
||||
tools.staticdir.on = True
|
||||
tools.staticdir.dir = '.'
|
||||
tools.staticdir.index = 'static/html/index.html'
|
||||
|
54
Praktikum2/ppm2/server.py
Normal file
54
Praktikum2/ppm2/server.py
Normal file
@ -0,0 +1,54 @@
|
||||
# coding:utf-8
|
||||
|
||||
import os.path
|
||||
import cherrypy
|
||||
|
||||
from app import templates, category, choice, eval
|
||||
|
||||
#----------------------------------------------------------
|
||||
def main():
|
||||
#----------------------------------------------------------
|
||||
|
||||
# aktuelles Verzeichnis ermitteln, damit es in der Konfigurationsdatei als
|
||||
# Bezugspunkt verwendet werden kann
|
||||
try: # aktuelles Verzeichnis als absoluter Pfad
|
||||
currentDir_s = os.path.dirname(os.path.abspath(__file__))
|
||||
except:
|
||||
currentDir_s = os.path.dirname(os.path.abspath(sys.executable))
|
||||
cherrypy.Application.currentDir_s = currentDir_s
|
||||
|
||||
configFileName_s = 'server.conf' # im aktuellen Verzeichnis
|
||||
if os.path.exists(configFileName_s) == False:
|
||||
# Datei gibt es nicht
|
||||
configFileName_s = None
|
||||
|
||||
# autoreload und timeout_Monitor hier abschalten
|
||||
# für cherrypy-Versionen >= "3.1.0" !
|
||||
cherrypy.engine.autoreload.unsubscribe()
|
||||
cherrypy.engine.timeout_monitor.unsubscribe()
|
||||
|
||||
# Standardverhalten, Berücksichtigung der Konfigurationsangaben im configFile
|
||||
cherrypy.tree.mount(
|
||||
None, '/', configFileName_s
|
||||
)
|
||||
|
||||
cherrypy.tree.mount(
|
||||
category.Category(), '/category', {'/': {'request.dispatch': cherrypy.dispatch.MethodDispatcher()}}
|
||||
)
|
||||
cherrypy.tree.mount(
|
||||
choice.Choice(), '/choice', {'/': {'request.dispatch': cherrypy.dispatch.MethodDispatcher()}}
|
||||
)
|
||||
cherrypy.tree.mount(
|
||||
eval.Eval(), '/eval', {'/': {'request.dispatch': cherrypy.dispatch.MethodDispatcher()}}
|
||||
)
|
||||
cherrypy.tree.mount(
|
||||
templates.Templates(), '/templates', {'/': {'request.dispatch': cherrypy.dispatch.MethodDispatcher()}}
|
||||
)
|
||||
|
||||
cherrypy.engine.start()
|
||||
cherrypy.engine.block()
|
||||
|
||||
#----------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
#----------------------------------------------------------
|
||||
main()
|
1
Praktikum2/ppm2/static/css/style.css
Normal file
1
Praktikum2/ppm2/static/css/style.css
Normal file
@ -0,0 +1 @@
|
||||
body{font-family:"Open Sans",sans-serif;font-size:12pt;padding:0;margin:0;}.clSiteHeader{position:absolute;top:0;left:0;right:0;height:100px;line-height:100px;margin:0;padding:5px;font-size:40pt;text-align:center;text-shadow:black 3px 2px;font-family:"Open Sans",sans-serif;background-color:#084791;border:none;border-radius:60px;}.clSiteHeader a{text-decoration:none;color:white;}.clSiteHeader:hover{background-color:#0D71E4;cursor:pointer;}.clSiteHeader a:visited,a:active{color:white;text-decoration:none;}.clContent{position:absolute;top:150px;left:0;right:0;bottom:0;margin:0;padding:5px;background-repeat:no-repeat;background-position:bottom left;}.clContentHeader{position:absolute;top:20px;left:0;right:0;height:30px;line-height:30px;margin:0;padding:5px;font-size:18pt;text-align:center;}.clContentArea{position:absolute;top:80px;left:0;right:0;bottom:0px;margin:10px 0;margin-left:10px;padding:5px;background-attachment:#819FF7;}.clButtonArea{position:absolute;left:0;right:0;bottom:0;height:80px;line-height:80px;margin:0;padding:5px;text-align:center;background-color:#FFFFFF;}.clButtonArea a,input[type="submit"]{margin:0 5px;padding:3px 6px;font-size:14pt;text-decoration:none;border:2px solid;color:white;background-color:#084791;}.clButtonArea a:hover{color:white;background-color:#0D71E4;cursor:pointer;}.clButtonArea a:visited,a:active{color:white;}.clNavButton{display:inline-block;text-align:center;background-color:#084791;border:1px solid black;color:white;padding:15px 32px;text-decoration:none;font-size:16px;cursor:pointer;float:left;clear:left;width:20%;margin-left:38%;margin-right:30%;}.clNavButton:hover{background-color:#0D71E4;}#idList{table-layout:fixed;width:auto;border:2px solid;border-collapse:collapse;margin:auto;}#idList th{text-align:center;padding-left:5px;background-color:white;padding:3px;border:2px solid;}#idList td{padding:3px;border:2px solid;cursor:pointer;}#idForm .clContentArea{width:500px;margin:auto;}.selected{background-color:#0D71E4;color:white;}.clFormRow{position:relative;height:30px;margin-bottom:10px;}.clFormRow label{position:absolute;top:0;left:0;width:240px;text-align:center;}.clFormRow input{position:absolute;top:0;left:250px;width:250px;}.clFormRow select{position:absolute;top:0;left:250px;width:250px;}.clMenu{list-style-type:none;padding-left:0;margin-left:0;}h3{text-align:center;}
|
75
Praktikum2/ppm2/static/html/detail.html
Normal file
75
Praktikum2/ppm2/static/html/detail.html
Normal file
@ -0,0 +1,75 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
Praxisphasenmanager (PPM)
|
||||
</title>
|
||||
<meta charset="UTF-8" />
|
||||
<style type="text/css">
|
||||
@import url("/style.css");
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="idSiteHeader" class="clSiteHeader">
|
||||
<a href="/index" title="Zurück zur Startseite">Praxisphasenmanager (PPM)</a>
|
||||
</h1>
|
||||
|
||||
<form id="idForm" class="clContent" action="/save/?cat=${data['category']}" method="POST">
|
||||
<h2 id="idContentHeader" class="clContentHeader">
|
||||
${data['category']}: Ihre Daten
|
||||
</h2>
|
||||
<div id="idContentArea" class="clContentArea">
|
||||
<input type="hidden" value="${data['id']}" id="id" name="id" />
|
||||
|
||||
% if data['category'] != 'Angebote':
|
||||
% for field in data['content']:
|
||||
% if field!='id' and field!='Status':
|
||||
<div class="clFormRow">
|
||||
<label for="${field}">${field}</label>
|
||||
<input type="text" value=
|
||||
% if data['content'][field] != field:
|
||||
"${data['content'][field]}" id="${field}" name="${field}" />
|
||||
% else:
|
||||
"" id="${field}" name="${field}" />
|
||||
% endif
|
||||
</div>
|
||||
% endif
|
||||
% endfor
|
||||
% else:
|
||||
<input type="hidden" value="Angebot" id="Status" name="Status" />
|
||||
<input type="hidden" value="" id="Zeitraum" name="ZeitraumVon" />
|
||||
<input type="hidden" value="" id="Zeitraum" name="ZeitraumBis" />
|
||||
<input type="hidden" value="" id="Student" name="Student" />
|
||||
<input type="hidden" value="" id="Lehrender" name="Lehrender" />
|
||||
% for field in data['content']:
|
||||
% if field!='id' and field!='Status' and field!='ZeitraumVon' and field!='ZeitraumBis' and field!='Lehrender' and field!='Student':
|
||||
<div class="clFormRow">
|
||||
<label for="${field}">${field}</label>
|
||||
% if field!='Firma':
|
||||
<input type="text" value=
|
||||
% if data['content'][field] != field:
|
||||
"${data['content'][field]}" id="${field}" name="${field}" />
|
||||
% else:
|
||||
"" id="${field}" name="${field}" />
|
||||
% endif
|
||||
% else:
|
||||
<select name="Firma" form="idForm">
|
||||
% for option in data['Firmen']:
|
||||
<option value="${data['Firmen'][option]['Name']}">${data['Firmen'][option]['Name']}</option>
|
||||
% endfor
|
||||
</select>
|
||||
% endif
|
||||
</div>
|
||||
% endif
|
||||
% endfor
|
||||
% endif
|
||||
|
||||
<div id="idButtonArea" class="clButtonArea">
|
||||
<a href="/index" title="Zurück zur Startseite">Zurück zur Startseite</a>
|
||||
<a href="/category/?cat=${data['category']}" title="Zurueck zur Startseite">Zurück zur übersicht</a>
|
||||
<input type="submit" value="Speichern" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
66
Praktikum2/ppm2/static/html/detailChoice.html
Normal file
66
Praktikum2/ppm2/static/html/detailChoice.html
Normal file
@ -0,0 +1,66 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
Praxisphasenmanager (PPM)
|
||||
</title>
|
||||
<meta charset="UTF-8" />
|
||||
<style type="text/css">
|
||||
@import url("/style.css");
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="idSiteHeader" class="clSiteHeader">
|
||||
<a href="/index" title="Zurück zur Startseite">Praxisphasenmanager (PPM)</a>
|
||||
</h1>
|
||||
|
||||
<form id="idForm" class="clContent" action="/saveChoice" method="POST">
|
||||
<h2 id="idContentHeader" class="clContentHeader">
|
||||
Praxisphasenangebots Auswahl
|
||||
</h2>
|
||||
<div id="idContentArea" class="clContentArea">
|
||||
<input type="hidden" value="${data['id']}" id="id" name="id" />
|
||||
<input type="hidden" value="${data['Name']}" id="Name" name="Name" />
|
||||
<input type="hidden" value="${data['Firma']}" id="Firma" name="Firma" />
|
||||
<input type="hidden" value="${data['Beschreibung']}" id="Beschreibung" name="Beschreibung" />
|
||||
<input type="hidden" value="${data['Voraussetzungen']}" id="Voraussetzungen" name="Voraussetzungen" />
|
||||
<input type="hidden" value="${data['Firmenbetreuer']}" id="Firmenbetreuer" name="Firmenbetreuer" />
|
||||
<input type="hidden" value="aktuell" id="Status" name="Status" />
|
||||
|
||||
<div class="clFormRow">
|
||||
<label for="Student">Student</label>
|
||||
<select name="Student" form="idForm">
|
||||
% for option in data['Studenten']:
|
||||
<option value="${data['Studenten'][option]['id']}">${data['Studenten'][option]['Name']}</option>
|
||||
% endfor
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="clFormRow">
|
||||
<label for="Lehrender">Lehrender</label>
|
||||
<select name="Lehrender" form="idForm">
|
||||
% for option in data['Lehrender']:
|
||||
<option value="${data['Lehrender'][option]['id']}">${data['Lehrender'][option]['Name']}</option>
|
||||
% endfor
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="clFormRow">
|
||||
<label for="ZeitraumVon">Zeitraum: Von (D.M.Y)</label>
|
||||
<input type="text" value="" id="ZeitraumVon" name="ZeitraumVon" />
|
||||
</div>
|
||||
|
||||
<div class="clFormRow">
|
||||
<label for="ZeitraumBis">Zeitraum: Bis (D.M.Y)</label>
|
||||
<input type="text" value="" id="ZeitraumBis" name="ZeitraumBis" />
|
||||
</div>
|
||||
|
||||
<div id="idButtonArea" class="clButtonArea">
|
||||
<a href="/index" title="Zurück zur Startseite">Zurück zur Startseite</a>
|
||||
<a href="/choice" title="Zurück zur übersicht">Zurück zur übersicht</a>
|
||||
<input type="submit" value="Speichern" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
25
Praktikum2/ppm2/static/html/index.html
Normal file
25
Praktikum2/ppm2/static/html/index.html
Normal file
@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
Praxisphasenmanager (PPM)
|
||||
</title>
|
||||
<meta charset="UTF-8" />
|
||||
<style type="text/css">
|
||||
@import url("static/css/style.css");
|
||||
</style>
|
||||
<script type="text/javascript" src="/static/js/jquery-3.1.1.min.js"></script>
|
||||
<script type="text/javascript" src="/static/js/te.js"></script>
|
||||
<script type="text/javascript" src="/static/js/tm.js"></script>
|
||||
<script type="text/javascript" src="/static/js/ppm.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="idSiteHeader" class="clSiteHeader" data-action="index">
|
||||
<a title="Zurück zur Startseite">Praxisphasenmanager (PPM)</a>
|
||||
</h1>
|
||||
<div id="idContent" class="clContent">
|
||||
</div>
|
||||
</body>
|
||||
<footer>
|
||||
</footer>
|
||||
</html>
|
56
Praktikum2/ppm2/static/html/listChoice.html
Normal file
56
Praktikum2/ppm2/static/html/listChoice.html
Normal file
@ -0,0 +1,56 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
Praxisphasenmanager (PPM)
|
||||
</title>
|
||||
<meta charset="UTF-8" />
|
||||
<style type="text/css">
|
||||
@import url("/style.css");
|
||||
</style>
|
||||
<script src="/functionsChoice.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 id="idSiteHeader" class="clSiteHeader">
|
||||
<a href="/index" title="Zurück zur Startseite">Praxisphasenmanager (PPM)</a>
|
||||
</h1>
|
||||
<div id="idContent" class="clContent">
|
||||
<h2 id="idContentHeader" class="clContentHeader">
|
||||
Übersicht Praxisphasen Auswahl
|
||||
</h2>
|
||||
<div id="idContentArea" class="clContentArea">
|
||||
|
||||
<table id="idList">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Firma</th>
|
||||
<th>Beschreibung</th>
|
||||
<th>Voraussetzungen</th>
|
||||
<th>Firmenbetreuer</th>
|
||||
</tr>
|
||||
% if data['content']!= None:
|
||||
% for entries in data['content']:
|
||||
<tr id=${entries}>
|
||||
<td id=${entries}>${data['content'][entries]['Name']}</td>
|
||||
<td id=${entries}>${data['content'][entries]['Firma']}</td>
|
||||
<td id=${entries}>${data['content'][entries]['Beschreibung']}</td>
|
||||
<td id=${entries}>${data['content'][entries]['Voraussetzungen']}</td>
|
||||
<td id=${entries}>${data['content'][entries]['Firmenbetreuer']}</td>
|
||||
</tr id=${entries}>
|
||||
% endfor
|
||||
|
||||
% endif
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="idButtonArea" class="clButtonArea">
|
||||
<a href="/index" class="clButton">Startseite</a>
|
||||
<a class="clButton" id="Annehmen">Annehmen</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<footer>
|
||||
</footer>
|
||||
</html>
|
146
Praktikum2/ppm2/static/html/listEval.html
Normal file
146
Praktikum2/ppm2/static/html/listEval.html
Normal file
@ -0,0 +1,146 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
Praxisphasenmanager (PPM)
|
||||
</title>
|
||||
<meta charset="UTF-8" />
|
||||
<style type="text/css">
|
||||
@import url("/style.css");
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 id="idSiteHeader" class="clSiteHeader">
|
||||
<a href="/index" title="Zurück zur Startseite">Praxisphasenmanager (PPM)</a>
|
||||
</h1>
|
||||
<div id="idContent" class="clContent">
|
||||
<h2 id="idContentHeader" class="clContentHeader">
|
||||
Übersicht: ${data['category']}
|
||||
</h2>
|
||||
<div id="idContentArea" class="clContentArea">
|
||||
% if data['category'] == 'Firmen':
|
||||
% for firmen in data:
|
||||
% if firmen != 'category':
|
||||
<h3>${firmen}</h3>
|
||||
<table id="idList">
|
||||
<tr>
|
||||
<th>Status</th>
|
||||
<th>Student</th>
|
||||
<th>Lehrender</th>
|
||||
<th>Zeitraum: Von</th>
|
||||
<th>Zeitraum: Bis</th>
|
||||
</tr>
|
||||
% for aktuell in data[firmen]['Angebote']['aktuell']:
|
||||
<tr>
|
||||
<td>Aktuell</td>
|
||||
<td>${data[firmen]['Angebote']['aktuell'][aktuell]['Student']}</td>
|
||||
<td>${data[firmen]['Angebote']['aktuell'][aktuell]['Lehrender']}</td>
|
||||
<td>${data[firmen]['Angebote']['aktuell'][aktuell]['ZeitraumVon']}</td>
|
||||
<td>${data[firmen]['Angebote']['aktuell'][aktuell]['ZeitraumBis']}</td>
|
||||
</tr>
|
||||
% endfor
|
||||
% for abgeschlossen in data[firmen]['Angebote']['abgeschlossen']:
|
||||
<tr>
|
||||
<td>Abgeschlossen</td>
|
||||
<td>${data[firmen]['Angebote']['abgeschlossen'][abgeschlossen]['Student']}</td>
|
||||
<td>${data[firmen]['Angebote']['abgeschlossen'][abgeschlossen]['Lehrender']}</td>
|
||||
<td>${data[firmen]['Angebote']['abgeschlossen'][abgeschlossen]['ZeitraumVon']}</td>
|
||||
<td>${data[firmen]['Angebote']['abgeschlossen'][abgeschlossen]['ZeitraumBis']}</td>
|
||||
</tr>
|
||||
% endfor
|
||||
</table>
|
||||
% endif
|
||||
% endfor
|
||||
% endif
|
||||
|
||||
% if data['category'] == 'Studenten':
|
||||
% for studenten in data:
|
||||
% if studenten != 'category':
|
||||
<h3>${studenten}</h3>
|
||||
<table id="idList">
|
||||
<tr>
|
||||
<th>Lehrender</th>
|
||||
<th>Firma</th>
|
||||
<th>Praxisphase</th>
|
||||
<th>Status</th>
|
||||
<th>Zeitraum: Von</th>
|
||||
<th>Zeitraum: Bis</th>
|
||||
</tr>
|
||||
% for angebote in data[studenten]['Angebote']['aktuell']:
|
||||
<tr>
|
||||
<td>${data[studenten]['Angebote']['aktuell'][angebote]['Lehrender']}</td>
|
||||
<td>${data[studenten]['Angebote']['aktuell'][angebote]['Firma']}</td>
|
||||
<td>${data[studenten]['Angebote']['aktuell'][angebote]['Praxisphase']}</td>
|
||||
<td>${data[studenten]['Angebote']['aktuell'][angebote]['Status']}</td>
|
||||
<td>${data[studenten]['Angebote']['aktuell'][angebote]['ZeitraumVon']}</td>
|
||||
<td>${data[studenten]['Angebote']['aktuell'][angebote]['ZeitraumBis']}</td>
|
||||
</tr>
|
||||
% endfor
|
||||
% for angebote in data[studenten]['Angebote']['abgeschlossen']:
|
||||
<tr>
|
||||
<td>${data[studenten]['Angebote']['abgeschlossen'][angebote]['Lehrender']}</td>
|
||||
<td>${data[studenten]['Angebote']['abgeschlossen'][angebote]['Firma']}</td>
|
||||
<td>${data[studenten]['Angebote']['abgeschlossen'][angebote]['Praxisphase']}</td>
|
||||
<td>${data[studenten]['Angebote']['abgeschlossen'][angebote]['Status']}</td>
|
||||
<td>${data[studenten]['Angebote']['abgeschlossen'][angebote]['ZeitraumVon']}</td>
|
||||
<td>${data[studenten]['Angebote']['abgeschlossen'][angebote]['ZeitraumBis']}</td>
|
||||
</tr>
|
||||
% endfor
|
||||
|
||||
|
||||
</table>
|
||||
% endif
|
||||
% endfor
|
||||
% endif
|
||||
|
||||
% if data['category'] == 'Lehrender':
|
||||
% for Lehrender in data:
|
||||
% if Lehrender != 'category':
|
||||
<h3>${Lehrender}</h3>
|
||||
<table id="idList">
|
||||
<tr>
|
||||
<th>Student</th>
|
||||
<th>Firma</th>
|
||||
<th>Praxisphase</th>
|
||||
<th>Status</th>
|
||||
<th>Zeitraum: Von</th>
|
||||
<th>Zeitraum: Bis</th>
|
||||
</tr>
|
||||
% if data[Lehrender] != NULL:
|
||||
% for angebote in data[Lehrender]['Angebote']['aktuell']:
|
||||
<tr>
|
||||
<td>${data[Lehrender]['Angebote']['aktuell'][angebote]['Student']}</td>
|
||||
<td>${data[Lehrender]['Angebote']['aktuell'][angebote]['Firma']}</td>
|
||||
<td>${data[Lehrender]['Angebote']['aktuell'][angebote]['Praxisphase']}</td>
|
||||
<td>${data[Lehrender]['Angebote']['aktuell'][angebote]['Status']}</td>
|
||||
<td>${data[Lehrender]['Angebote']['aktuell'][angebote]['ZeitraumVon']}</td>
|
||||
<td>${data[Lehrender]['Angebote']['aktuell'][angebote]['ZeitraumBis']}</td>
|
||||
</tr>
|
||||
% endfor
|
||||
% for angebote in data[Lehrender]['Angebote']['abgeschlossen']:
|
||||
<tr>
|
||||
<td>${data[Lehrender]['Angebote']['abgeschlossen'][angebote]['Student']}</td>
|
||||
<td>${data[Lehrender]['Angebote']['abgeschlossen'][angebote]['Firma']}</td>
|
||||
<td>${data[Lehrender]['Angebote']['abgeschlossen'][angebote]['Praxisphase']}</td>
|
||||
<td>${data[Lehrender]['Angebote']['abgeschlossen'][angebote]['Status']}</td>
|
||||
<td>${data[Lehrender]['Angebote']['abgeschlossen'][angebote]['ZeitraumVon']}</td>
|
||||
<td>${data[Lehrender]['Angebote']['abgeschlossen'][angebote]['ZeitraumBis']}</td>
|
||||
</tr>
|
||||
% endfor
|
||||
% endif
|
||||
</table>
|
||||
% endif
|
||||
% endfor
|
||||
% endif
|
||||
</div>
|
||||
|
||||
<div id="idButtonArea" class="clButtonArea">
|
||||
<a href="/index" class="clButton">Startseite</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<footer>
|
||||
<!--<script src="/functions.js" type="text/javascript"></script>-->
|
||||
</footer>
|
||||
</html>
|
4
Praktikum2/ppm2/static/js/jquery-3.1.1.min.js
vendored
Normal file
4
Praktikum2/ppm2/static/js/jquery-3.1.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
164
Praktikum2/ppm2/static/js/ppm.js
Normal file
164
Praktikum2/ppm2/static/js/ppm.js
Normal file
@ -0,0 +1,164 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// PPM - Hauptfunktion
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class PPM
|
||||
{
|
||||
constructor ()
|
||||
{
|
||||
this.BodyDataAction();
|
||||
|
||||
this.TemplateManager_o = new TemplateManager_cl();
|
||||
this.TemplateManager_o;
|
||||
|
||||
console.log("PPM LOADED");
|
||||
}
|
||||
|
||||
BodyDataAction ()
|
||||
{
|
||||
$('body').on('click', '[data-action]', function() {
|
||||
var action = $(this).data('action');
|
||||
|
||||
PPM_o.Menu(action);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
BodyTableSelect ()
|
||||
{
|
||||
$('#idList tr').click(function(){
|
||||
$(".selected").removeClass('selected');
|
||||
$(this).addClass('selected');
|
||||
this.selectedId = $(this).attr('id');
|
||||
console.log("SELECT ID: ", this.selectedId);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
Menu (message)
|
||||
{
|
||||
var selectedId = $(".selected").attr('id');
|
||||
switch (message)
|
||||
{
|
||||
case 'index':
|
||||
|
||||
this.LoadContent('/category/', 'index.tpl');
|
||||
break;
|
||||
|
||||
case 'categoryStudenten':
|
||||
|
||||
this.LoadContent('/category/?cat=Studenten', 'list.tpl');
|
||||
break
|
||||
|
||||
case 'categoryLehrender':
|
||||
|
||||
this.LoadContent('/category/?cat=Lehrender', 'list.tpl');
|
||||
break
|
||||
|
||||
case 'categoryFirmen':
|
||||
|
||||
this.LoadContent('/category/?cat=Firmen', 'list.tpl');
|
||||
break
|
||||
|
||||
case 'choice':
|
||||
|
||||
this.LoadContent('/choice', 'listChoice.tpl');
|
||||
break
|
||||
|
||||
case 'evalStudenten':
|
||||
|
||||
this.LoadContent('/eval/?cat=Studenten', 'listEval.tpl');
|
||||
break
|
||||
|
||||
case 'evalLehrender':
|
||||
|
||||
this.LoadContent('/eval/?cat=Lehrender', 'listEval.tpl');
|
||||
break
|
||||
|
||||
case 'evalFirmen':
|
||||
|
||||
this.LoadContent('/eval/?cat=Firmen', 'listEval.tpl');
|
||||
break
|
||||
|
||||
case 'NewStudenten':
|
||||
|
||||
console.log("NewStudenten");
|
||||
break
|
||||
|
||||
case 'NewLehrender':
|
||||
|
||||
console.log("NewLehrender");
|
||||
break
|
||||
|
||||
case 'NewFirmen':
|
||||
|
||||
console.log("NewFirmen");
|
||||
break
|
||||
|
||||
case 'ModifyStudenten':
|
||||
console.log("ModifyStudenten: ", selectedId);
|
||||
break
|
||||
|
||||
case 'ModifyLehrenden':
|
||||
|
||||
console.log("ModifyLehrenden", selectedId);
|
||||
break
|
||||
|
||||
case 'ModifyFirmen':
|
||||
|
||||
console.log("ModifyFirmen", selectedId);
|
||||
break
|
||||
|
||||
case 'DeleteStudenten':
|
||||
|
||||
console.log("DeleteStudenten", selectedId);
|
||||
break
|
||||
|
||||
case 'DeleteLehrenden':
|
||||
|
||||
console.log("DeleteLehrenden", selectedId);
|
||||
break
|
||||
|
||||
case 'DeleteFirmen':
|
||||
|
||||
console.log("DeleteFirmen", selectedId);
|
||||
break
|
||||
|
||||
default:
|
||||
|
||||
alert ('[PPM] Unbekannte Anfrage: ' + message);
|
||||
}
|
||||
}
|
||||
|
||||
LoadContent ( path, template )
|
||||
{
|
||||
$.ajax({
|
||||
dataType: "json",
|
||||
url: path,
|
||||
type: 'GET',
|
||||
context: this
|
||||
})
|
||||
.done(function (json) {
|
||||
//console.log("JSON: ", json);
|
||||
|
||||
var result = this.TemplateManager_o.execute_px( template, json );
|
||||
//console.log("RESULT: ", result);
|
||||
|
||||
//$( ".clContent" ).replaceWith(result);
|
||||
$( ".clContent" ).empty();
|
||||
$( ".clContent" ).append(result);
|
||||
this.BodyTableSelect();
|
||||
console.log("TM DONE");
|
||||
})
|
||||
.fail(function(jqXHR_opl, textStatus_spl) {
|
||||
alert( "[PPM] Fehler bei Anforderung: " + textStatus_spl );
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$(function() {
|
||||
console.log("ONLOAD");
|
||||
PPM_o = new PPM();
|
||||
PPM_o.Menu("index");
|
||||
});
|
266
Praktikum2/ppm2/static/js/te.js
Normal file
266
Praktikum2/ppm2/static/js/te.js
Normal file
@ -0,0 +1,266 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Template-Engine
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
'use strict'
|
||||
|
||||
class Generator_cl {
|
||||
constructor () {
|
||||
this.reset_px();
|
||||
}
|
||||
reset_px () {
|
||||
this.code_a = ['var result_a = [];\n'];
|
||||
}
|
||||
write_px (text_spl) {
|
||||
// Escape-Zeichen bei Strings ergänzen
|
||||
var text_s = text_spl.replace(/"/g, '\\"');
|
||||
text_s = text_s.replace(/'/g, "\\'");
|
||||
this.code_a.push('result_a.push("' + text_s + '");\n');
|
||||
}
|
||||
code_px (code_spl) {
|
||||
if (code_spl.startsWith('if')) {
|
||||
this.code_a.push('if (' + code_spl.substr(2) + ') {\n');
|
||||
} else if (code_spl.startsWith('else')) {
|
||||
this.code_a.push('} else {\n');
|
||||
} else if (code_spl.startsWith('endif')) {
|
||||
this.code_a.push('}\n');
|
||||
} else if (code_spl.startsWith('for')) {
|
||||
this.code_a.push('for (' + code_spl.substr(3) + ') {\n');
|
||||
} else if (code_spl.startsWith('endfor')) {
|
||||
this.code_a.push('}\n');
|
||||
} else {
|
||||
this.code_a.push(code_spl + '\n');
|
||||
}
|
||||
}
|
||||
substitute_px (subst_spl) {
|
||||
let value_s = subst_spl == null ? '' : String(subst_spl);
|
||||
this.code_a.push('result_a.push(' + value_s + ');\n');
|
||||
}
|
||||
generate_px () {
|
||||
var result_s = this.code_a.join('') + ' return result_a.join("");';
|
||||
var f_o = new Function ('context', result_s);
|
||||
return f_o;
|
||||
}
|
||||
}
|
||||
|
||||
class TemplateCompiler_cl {
|
||||
constructor () {
|
||||
this.gen_o = new Generator_cl();
|
||||
this.reset_px();
|
||||
}
|
||||
reset_px () {
|
||||
this.gen_o.reset_px();
|
||||
this.preservePreWS_b = false;
|
||||
this.preservePostWS_b = false;
|
||||
}
|
||||
setPreWS_px (on_bpl) {
|
||||
if ((on_bpl == undefined) || (on_bpl == false)) {
|
||||
this.preservePreWS_b = false;
|
||||
} else {
|
||||
this.preservePreWS_b = true;
|
||||
}
|
||||
}
|
||||
setPostWS_px (on_bpl) {
|
||||
if ((on_bpl == undefined) || (on_bpl == false)) {
|
||||
this.preservePostWS_b = false;
|
||||
} else {
|
||||
this.preservePostWS_b = true;
|
||||
}
|
||||
}
|
||||
compile_px (source_spl) {
|
||||
var state_i = 0;
|
||||
var pos_i = 0;
|
||||
var len_i = source_spl.length;
|
||||
var text_s = '';
|
||||
var code_s = '';
|
||||
var subst_s = '';
|
||||
this.gen_o.reset_px();
|
||||
|
||||
var doubletest_f = function (char_spl) {
|
||||
var status_b = false;
|
||||
if ((pos_i + 1) < len_i) {
|
||||
if ((source_spl[pos_i] == char_spl) && (source_spl[pos_i+1] == char_spl)) {
|
||||
status_b = true;
|
||||
}
|
||||
}
|
||||
return status_b;
|
||||
}
|
||||
|
||||
while (pos_i < len_i) {
|
||||
switch (state_i) {
|
||||
case 0:
|
||||
// outside
|
||||
if (source_spl[pos_i] == '@') { // ECMA 5!
|
||||
if (doubletest_f('@') == false) {
|
||||
state_i = 2;
|
||||
code_s = '';
|
||||
} else {
|
||||
// als normales Zeichen verarbeiten, ein Zeichen überlesen
|
||||
state_i = 1;
|
||||
text_s = '@';
|
||||
pos_i++;
|
||||
}
|
||||
} else if (source_spl[pos_i] == '#') {
|
||||
if (doubletest_f('#') == false) {
|
||||
state_i = 3;
|
||||
subst_s = '';
|
||||
} else {
|
||||
// als normales Zeichen verarbeiten, ein Zeichen überlesen
|
||||
state_i = 1;
|
||||
text_s = '#';
|
||||
pos_i++;
|
||||
}
|
||||
} else if ((source_spl[pos_i] == ' ') || (source_spl[pos_i] == '\t')) {
|
||||
state_i = 4;
|
||||
text_s = '';
|
||||
pos_i--; // Zeichen erneut verarbeiten
|
||||
} else {
|
||||
state_i = 1;
|
||||
text_s = '';
|
||||
pos_i--; // Zeichen erneut verarbeiten
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
// inText
|
||||
if (source_spl[pos_i] == '@') {
|
||||
if (doubletest_f('@') == false) {
|
||||
// Textende, neuer Code
|
||||
state_i = 0;
|
||||
this.gen_o.write_px(text_s);
|
||||
pos_i--; // Zeichen erneut verarbeiten
|
||||
} else {
|
||||
// als normales Zeichen verarbeiten, ein Zeichen überlesen
|
||||
text_s += '@';
|
||||
pos_i++;
|
||||
}
|
||||
} else if (source_spl[pos_i] == '#') {
|
||||
if (doubletest_f('#') == false) {
|
||||
// Textende, neue Substitution
|
||||
state_i = 0;
|
||||
this.gen_o.write_px(text_s);
|
||||
pos_i--; // Zeichen erneut verarbeiten
|
||||
// Textende, neuer Code
|
||||
} else {
|
||||
// als normales Zeichen verarbeiten, ein Zeichen überlesen
|
||||
text_s += '#';
|
||||
pos_i++;
|
||||
}
|
||||
} else if ((source_spl[pos_i] == ' ') || (source_spl[pos_i] == '\t')) {
|
||||
// Textende
|
||||
state_i = 0;
|
||||
this.gen_o.write_px(text_s);
|
||||
pos_i--; // Zeichen erneut verarbeiten
|
||||
} else {
|
||||
// sammeln
|
||||
if ((source_spl[pos_i] != '\n') && (source_spl[pos_i] != '\r')) {
|
||||
text_s += source_spl[pos_i];
|
||||
} else if (source_spl[pos_i] == '\n') {
|
||||
text_s += '\\n';
|
||||
} else {
|
||||
text_s += '\\r';
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
// inCode
|
||||
if (source_spl[pos_i] == '@') {
|
||||
if (doubletest_f('@') == false) {
|
||||
// zu Ende, erzeugen
|
||||
this.gen_o.code_px(code_s);
|
||||
state_i = 5; //0
|
||||
} else {
|
||||
// als normales Zeichen verarbeiten, ein Zeichen überlesen
|
||||
code_s += '@';
|
||||
pos_i++;
|
||||
}
|
||||
} else {
|
||||
// sammeln
|
||||
code_s += source_spl[pos_i];
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
// inSubst
|
||||
// Verdopplung # hier nicht zulässig!
|
||||
if (source_spl[pos_i] == '#') {
|
||||
// zu Ende, erzeugen
|
||||
this.gen_o.substitute_px(subst_s);
|
||||
state_i = 0;
|
||||
} else {
|
||||
// sammeln
|
||||
subst_s += source_spl[pos_i];
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
// pre-code-whitespace
|
||||
switch (source_spl[pos_i]) {
|
||||
case ' ':
|
||||
case '\t':
|
||||
// sammeln
|
||||
text_s += source_spl[pos_i];
|
||||
break;
|
||||
default:
|
||||
state_i = 0;
|
||||
if (source_spl[pos_i] != '@') {
|
||||
this.gen_o.write_px(text_s);
|
||||
} else {
|
||||
if (doubletest_f('@') == false) {
|
||||
// Whitespace vor Code-Beginn erkannt
|
||||
if (this.preservePreWS_b == true) {
|
||||
// trotzdem ausgeben
|
||||
this.gen_o.write_px(text_s);
|
||||
}
|
||||
} // ansonsten wie normales Zeichen behandeln
|
||||
}
|
||||
pos_i--; // Zeichen erneut verarbeiten
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
// post-code-whitespace
|
||||
switch (source_spl[pos_i]) {
|
||||
case '\n':
|
||||
text_s += '\\n';
|
||||
state_i = 0;
|
||||
break;
|
||||
case '\r':
|
||||
text_s += '\\r';
|
||||
state_i = 0;
|
||||
break;
|
||||
case ' ':
|
||||
case '\t':
|
||||
// ggf. sammeln
|
||||
text_s += source_spl[pos_i];
|
||||
break;
|
||||
default:
|
||||
// Whitespace nach Code erkannt
|
||||
if (this.preservePostWS_b == true) {
|
||||
// trotzdem ausgeben
|
||||
this.gen_o.write_px(text_s);
|
||||
}
|
||||
state_i = 0;
|
||||
pos_i--; // Zeichen erneut verarbeiten
|
||||
}
|
||||
break;
|
||||
}
|
||||
pos_i++;
|
||||
}
|
||||
// welcher Zustand liegt abschließend vor?
|
||||
if (state_i == 1) {
|
||||
this.gen_o.write_px(text_s);
|
||||
} else if (state_i == 2) {
|
||||
this.gen_o.code_px(code_s);
|
||||
} else if (state_i == 3) {
|
||||
this.gen_o.substitute_px(subst_s);
|
||||
} else if (state_i == 4) {
|
||||
if (this.preservePreWS_b == true) {
|
||||
this.gen_o.write_px(text_s);
|
||||
}
|
||||
} else if (state_i == 5) {
|
||||
if (this.preservePostWS_b == true) {
|
||||
this.gen_o.write_px(text_s);
|
||||
}
|
||||
}
|
||||
|
||||
return this.gen_o.generate_px();
|
||||
}
|
||||
}
|
||||
// EOF
|
61
Praktikum2/ppm2/static/js/tm.js
Normal file
61
Praktikum2/ppm2/static/js/tm.js
Normal file
@ -0,0 +1,61 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Template-Manager
|
||||
// - Laden und Bereitstellen von Template-Quellen
|
||||
//------------------------------------------------------------------------------
|
||||
// depends-on:
|
||||
// jquery
|
||||
// te
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
'use strict'
|
||||
|
||||
class TemplateManager_cl {
|
||||
constructor () {
|
||||
this.templates_o = {};
|
||||
this.compiled_o = {};
|
||||
this.teCompiler_o = new TemplateCompiler_cl();
|
||||
// Templates als Ressource anfordern und speichern
|
||||
var path_s = "/templates/";
|
||||
$.ajax({
|
||||
dataType: "json",
|
||||
url: path_s,
|
||||
type: 'GET',
|
||||
context: this
|
||||
})
|
||||
.done(function (data_opl) {
|
||||
this.templates_o = data_opl['templates'];
|
||||
})
|
||||
.fail(function(jqXHR_opl, textStatus_spl) {
|
||||
alert( "[tm] Fehler bei Anforderung: " + textStatus_spl );
|
||||
});
|
||||
}
|
||||
get_px (name_spl) {
|
||||
alert (name_spl);
|
||||
alert (this.templates_o);
|
||||
if (name_spl in this.templates_o) {
|
||||
return this.templates_o[name_spl];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
execute_px (name_spl, data_opl) {
|
||||
var compiled_o = null;
|
||||
if (name_spl in this.compiled_o) {
|
||||
compiled_o = this.compiled_o[name_spl];
|
||||
} else {
|
||||
// Übersetzen und ausführen
|
||||
if (name_spl in this.templates_o) {
|
||||
this.teCompiler_o.reset_px();
|
||||
compiled_o = this.teCompiler_o.compile_px(this.templates_o[name_spl]);
|
||||
this.compiled_o[name_spl] = compiled_o;
|
||||
}
|
||||
}
|
||||
if (compiled_o != null) {
|
||||
return compiled_o(data_opl);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// EOF
|
12
Praktikum2/ppm2/templates/index.tpl
Normal file
12
Praktikum2/ppm2/templates/index.tpl
Normal file
@ -0,0 +1,12 @@
|
||||
<h2 id="idContentHeader" class="clContentHeader">Module</h2>
|
||||
<div class="clContentArea">
|
||||
<ul class="clMenu" id="clMenu">
|
||||
<li><a class="clNavButton" data-action="categoryStudenten">Datenpflege: Studenten</a></li>
|
||||
<li><a class="clNavButton" data-action="categoryLehrender">Datenpflege: Lehrender</a></li>
|
||||
<li><a class="clNavButton" data-action="categoryFirmen">Datenpflege: Firmenverzeichnis</a></li>
|
||||
<li><a class="clNavButton" data-action="choice">Auswahl: Praxisphasen</a></li>
|
||||
<li><a class="clNavButton" data-action="evalStudenten">Auswertung: Studenten</a></li>
|
||||
<li><a class="clNavButton" data-action="evalLehrender">Auswertung: Lehrenden</a></li>
|
||||
<li><a class="clNavButton" data-action="evalFirmen">Auswertung: Firmen</a></li>
|
||||
</ul>
|
||||
</div>
|
47
Praktikum2/ppm2/templates/list.tpl
Normal file
47
Praktikum2/ppm2/templates/list.tpl
Normal file
@ -0,0 +1,47 @@
|
||||
<h2 id="idContentHeader" class="clContentHeader">
|
||||
Übersicht: #context['category']#
|
||||
</h2>
|
||||
|
||||
<div id="idContentArea" class="clContentArea">
|
||||
|
||||
<table id="idList">
|
||||
<tr>
|
||||
@if context['content'] != 'None'@
|
||||
@for heading in context['headings']@
|
||||
@if context['headings'][heading] != 'id' && context['headings'][heading] != 'Status' && context['headings'][heading] != 'ZeitraumVon' &&context['headings'][heading] != 'ZeitraumBis' && context['headings'][heading] != 'Student' && context['headings'][heading] != 'Lehrender'@
|
||||
<th>#context['headings'][heading]#</th>
|
||||
@endif@
|
||||
@endfor@
|
||||
@else@
|
||||
<td>Bisher kein Inhalt</td>
|
||||
@endif@
|
||||
</tr>
|
||||
@if context['content'] != 'None'@
|
||||
@for entries in context['content']@
|
||||
<tr id=#entries#>
|
||||
@if context['category'] == 'Angebote'@
|
||||
@if context['content'][entries]['Status'] == 'Angebot'@
|
||||
@for entry in context['content'][entries]@
|
||||
@if entry!='id' && entry!='Status' && entry!='ZeitraumVon' && entry!='ZeitraumBis' && entry!='Student' && entry!='Lehrender'@
|
||||
<td id=#entries#>#context['content'][entries][entry]#</td>
|
||||
@endif@
|
||||
@endfor@
|
||||
@endif@
|
||||
@else@
|
||||
@for entry in context['content'][entries]@
|
||||
@if entry != 'id'@
|
||||
<td id=#entries#>#context['content'][entries][entry]#</td>
|
||||
@endif@
|
||||
@endfor@
|
||||
@endif@
|
||||
</tr id=#entries#>
|
||||
@endfor@
|
||||
@endif@
|
||||
</table>
|
||||
|
||||
<div id="idButtonArea" class="clButtonArea">
|
||||
<a class="clButton" data-action="index">Startseite</a>
|
||||
<a class="clButton" data-action="New#context['category']#">Neu</a>
|
||||
<a class="clButton" data-action="Modify#context['category']#">Bearbeiten</a>
|
||||
<a class="clButton" data-action="Delete#context['category']#">Loeschen</a>
|
||||
</div>
|
33
Praktikum2/ppm2/templates/listChoice.tpl
Normal file
33
Praktikum2/ppm2/templates/listChoice.tpl
Normal file
@ -0,0 +1,33 @@
|
||||
<h2 id="idContentHeader" class="clContentHeader">
|
||||
Übersicht Praxisphasen Auswahl
|
||||
</h2>
|
||||
<div id="idContentArea" class="clContentArea">
|
||||
|
||||
<table id="idList">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Firma</th>
|
||||
<th>Beschreibung</th>
|
||||
<th>Voraussetzungen</th>
|
||||
<th>Firmenbetreuer</th>
|
||||
</tr>
|
||||
@if context['content']!= 'None'@
|
||||
@for entries in context['content']@
|
||||
<tr id=${entries}>
|
||||
<td id=#entries#>#context['content'][entries]['Name']#</td>
|
||||
<td id=#entries#>#context['content'][entries]['Firma']#</td>
|
||||
<td id=#entries#>#context['content'][entries]['Beschreibung']#</td>
|
||||
<td id=#entries#>#context['content'][entries]['Voraussetzungen']#</td>
|
||||
<td id=#entries#>#context['content'][entries]['Firmenbetreuer']#</td>
|
||||
</tr id=#entries#>
|
||||
@endfor@
|
||||
|
||||
@endif@
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="idButtonArea" class="clButtonArea">
|
||||
<a class="clButton" data-action="index">Startseite</a>
|
||||
<a class="clButton" id="Annehmen">Annehmen</a>
|
||||
</div>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user