diff --git a/Praktikum2/AufgabePrak2A.pdf b/Praktikum2/AufgabePrak2A.pdf index c30bad1..37d4990 100644 Binary files a/Praktikum2/AufgabePrak2A.pdf and b/Praktikum2/AufgabePrak2A.pdf differ diff --git a/Praktikum2/ppm1/app/__pycache__/application.cpython-35.pyc b/Praktikum2/ppm1/app/__pycache__/application.cpython-35.pyc index 7b1db4d..6a35050 100644 Binary files a/Praktikum2/ppm1/app/__pycache__/application.cpython-35.pyc and b/Praktikum2/ppm1/app/__pycache__/application.cpython-35.pyc differ diff --git a/Praktikum2/ppm1/app/__pycache__/database.cpython-35.pyc b/Praktikum2/ppm1/app/__pycache__/database.cpython-35.pyc index 96cdd88..e5665dd 100644 Binary files a/Praktikum2/ppm1/app/__pycache__/database.cpython-35.pyc and b/Praktikum2/ppm1/app/__pycache__/database.cpython-35.pyc differ diff --git a/Praktikum2/ppm1/app/__pycache__/view.cpython-35.pyc b/Praktikum2/ppm1/app/__pycache__/view.cpython-35.pyc index a9040be..4e41b53 100644 Binary files a/Praktikum2/ppm1/app/__pycache__/view.cpython-35.pyc and b/Praktikum2/ppm1/app/__pycache__/view.cpython-35.pyc differ diff --git a/Praktikum2/ppm1/app/application.py b/Praktikum2/ppm1/app/application.py index 6db7bb9..15d0869 100644 --- a/Praktikum2/ppm1/app/application.py +++ b/Praktikum2/ppm1/app/application.py @@ -35,12 +35,26 @@ class Application_cl(object): return self.GenerateList(cat) @cherrypy.expose + #------------------------------------------------------- + def choice(self): + #------------------------------------------------------- + print("Choice \n") + return self.GenerateListChoice() + @cherrypy.expose + + #------------------------------------------------------- + def eval(self, cat): + #------------------------------------------------------- + print("Eval \n") + return self.GenerateListEval(cat) + @cherrypy.expose + #------------------------------------------------------- def detail(self, cat=None, id=None): #------------------------------------------------------- if(cat!=None): if(id!=None): - print("ID!=None Cat=", cat, " id=", id) + print("Cat=", cat, " id=", id) return self.GenerateDetail(cat, id) else: print("ID=None Cat=", cat) @@ -49,6 +63,14 @@ class Application_cl(object): return self.GenerateIndex() @cherrypy.expose + #------------------------------------------------------- + def detailchoice(self, id): + #------------------------------------------------------- + print("id=", id) + return self.GenerateDetailChoice(id) + + @cherrypy.expose + #------------------------------------------------------- def save(self, cat=None, **data): #------------------------------------------------------- @@ -91,29 +113,114 @@ class Application_cl(object): data['headings'] = {} data['category'] = category data['content'] = self.db.data[category] - print(data, "\n") if(len(data['content']) != 0): print(len(data['content'])) contentFirst = list(data['content'].keys())[0] data['headings'] = list(data['content'][contentFirst].keys()) - print(data, "\n") - + print(data) return self.view.CreateList(data) + #------------------------------------------------------- + def GenerateListChoice(self): + #------------------------------------------------------- + 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): #------------------------------------------------------- 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): + #------------------------------------------------------- + data = {} + data['id'] = id + data = self.db.data['Angebote'][id] + data['Studenten'] = self.db.data['Studenten'] + data['Lehrende'] = self.db.data['Lehrende'] + print(data, "\n") + return self.view.CreateDetailChoice(data) + + #------------------------------------------------------- + def GenerateListEval(self, cat): + #------------------------------------------------------- + data = {} + Studenten = self.db.data['Studenten'] + Lehrende = self.db.data['Lehrende'] + Firmen = self.db.data['Firmen'] + Angebote = self.db.data['Angebote'] + + data['category'] = cat + if(cat == 'Firmen'): + for keyFirma, valueFirma in Firmen.items(): + data[valueFirma['Name']] = {} + data[valueFirma['Name']]['Name'] = valueFirma['Name'] + for keyAngebote, valueAngebote in Angebote.items(): + data[valueFirma['Name']]['Angebote'] = {} + data[valueFirma['Name']]['Angebote']['Angebot'] = {} + data[valueFirma['Name']]['Angebote']['aktuell'] = {} + data[valueFirma['Name']]['Angebote']['abgeschlossen'] = {} + + if(valueAngebote['Firma'] == valueFirma['Name']): + data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']] = {} + data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']]['Name'] = valueAngebote['Name'] + data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']]['Student'] = Studenten[valueAngebote['Student']]['Name'] + data[valueFirma['Name']]['Angebote'][valueAngebote['Status']][valueAngebote['Name']]['Lehrende'] = Lehrende[valueAngebote['Lehrende']]['Name'] + 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']]['Name'] = valueStudent['Name'] + for keyAngebot, valueAngebot in Angebote.items(): + if(valueAngebot['Student'] == valueStudent['id']): + data[valueStudent['Name']]['Lehrende'] = Lehrende[valueAngebot['Lehrende']]['Name'] + data[valueStudent['Name']]['Status'] = valueAngebot['Status'] + data[valueStudent['Name']]['Praxisphase'] = valueAngebot['Name'] + data[valueStudent['Name']]['Firma'] = valueAngebot['Firma'] + data[valueStudent['Name']]['ZeitraumVon'] = valueAngebot['ZeitraumVon'] + data[valueStudent['Name']]['ZeitraumBis'] = valueAngebot['ZeitraumBis'] + elif(cat == 'Lehrende'): + for keyLehrende, valueLehrende in Lehrende.items(): + data[valueLehrende['Name']] = {} + data[valueLehrende['Name']]['Name'] = valueLehrende['Name'] + for keyAngebot, valueAngebot in Angebote.items(): + if(valueAngebot['Lehrende'] == valueLehrende['id']): + data[valueLehrende['Name']]['Student'] = Studenten[valueAngebot['Student']]['Name'] + data[valueLehrende['Name']]['Status'] = valueAngebot['Status'] + data[valueLehrende['Name']]['Praxisphase'] = valueAngebot['Name'] + data[valueLehrende['Name']]['Firma'] = valueAngebot['Firma'] + data[valueLehrende['Name']]['ZeitraumVon'] = valueAngebot['ZeitraumVon'] + data[valueLehrende['Name']]['ZeitraumBis'] = valueAngebot['ZeitraumBis'] + + print(data) + return self.view.CreateListEval(data) + + #------------------------------------------------------- def GenerateSave(self, dataTmp, category): #------------------------------------------------------- diff --git a/Praktikum2/ppm1/app/database.py b/Praktikum2/ppm1/app/database.py index b252136..462e665 100644 --- a/Praktikum2/ppm1/app/database.py +++ b/Praktikum2/ppm1/app/database.py @@ -20,14 +20,12 @@ class Database_cl(object): def __init__(self): #------------------------------------------------------- self.data = {} - self.data['students'] = {} - self.data['teachers'] = {} - self.data['companies'] = {} - self.data['offerings'] = {} - self.Read('students') - self.Read('teachers') - self.Read('companies') - self.Read('offerings') + self.data['Studenten'] = {} + self.data['Lehrende'] = {} + self.data['Firmen'] = {} + self.data['Angebote'] = {} + self.ReadAll() + #------------------------------------------------------- def Read(self, category): @@ -43,10 +41,19 @@ class Database_cl(object): id = fileName[:-5] self.data[category][id] = json.loads(fileContent) + #------------------------------------------------------- + def ReadAll(self): + #------------------------------------------------------- + self.Read('Studenten') + self.Read('Lehrende') + 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 @@ -68,14 +75,14 @@ class Database_cl(object): 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.data[category][id] = data + 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.data[category][id] = data + self.Read(category) status_b = True return status_b @@ -84,6 +91,22 @@ class Database_cl(object): def Delete(self, category, id): #------------------------------------------------------- status_b = False + if(category == 'Studenten'): + for angebote in self.data['Angebote']: + if(self.data['Angebote'][angebote]['Student'] == id): + os.remove(os.path.join('data', 'Angebote', angebote+'.json')) + elif(category == 'Lehrende'): + for angebote in self.data['Angebote']: + if(self.data['Angebote'][angebote]['Lehrende'] == id): + os.remove(os.path.join('data', 'Angebote', angebote+'.json')) + 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): + os.remove(os.path.join('data', 'Angebote', angebote+'.json')) + if id in self.data[category]: os.remove(os.path.join('data', category, id+'.json')) del self.data[category][id] @@ -93,14 +116,14 @@ class Database_cl(object): #------------------------------------------------------- def GetDefault(self, category): #------------------------------------------------------- - if(category == 'students'): - return {'name':'name', 'vorname':'vorname', 'matrikelnummer':'matrikelnummer'} - elif(category == 'teachers'): - return {'titel':'titel', 'name':'name', 'vorname':'vorname', 'lehrgebiet':'lehrgebiet'} - elif(category == 'companies'): - return {'name':'name', 'branche':'branche', 'schwerpunkt':'schwerpunkt', 'sitz':'sitz', 'anzahlMitarbeiter':'anzahlMitarbeiter'} - elif(category == 'offerings'): - return {'name':'name', 'company':'company', 'beschreibung':'beschreibung', 'voraussetzungen':'voraussetzungen', 'firmenbetreuer':'firmenbetreuer'} + if(category == 'Studenten'): + return {'Name':'', 'Vorname':'', 'Matrikelnummer':''} + elif(category == 'Lehrende'): + 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): diff --git a/Praktikum2/ppm1/app/view.py b/Praktikum2/ppm1/app/view.py index 7669c48..a481e64 100644 --- a/Praktikum2/ppm1/app/view.py +++ b/Praktikum2/ppm1/app/view.py @@ -31,7 +31,22 @@ class View_cl(object): #------------------------------------------------------- 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) \ No newline at end of file + return self.Create('detail.tpl', data) + + #------------------------------------------------------- + def CreateDetailChoice(self, data): + #------------------------------------------------------- + return self.Create('detailChoice.tpl', data) \ No newline at end of file diff --git a/Praktikum2/ppm1/data/Angebote/10.json b/Praktikum2/ppm1/data/Angebote/10.json new file mode 100644 index 0000000..e6fb3db --- /dev/null +++ b/Praktikum2/ppm1/data/Angebote/10.json @@ -0,0 +1,13 @@ +{ + "ZeitraumVon": "01.01.2000", + "Beschreibung": "Beschreibung", + "Voraussetzungen": "Voraussetzungen", + "id": "10", + "Firmenbetreuer": "Firmenbetreuer", + "ZeitraumBis": "02.02.2000", + "Student": "2", + "Name": "Name", + "Status": "aktuell", + "Lehrende": "2", + "Firma": "Name" +} \ No newline at end of file diff --git a/Praktikum2/ppm1/data/Angebote/last.json b/Praktikum2/ppm1/data/Angebote/last.json new file mode 100644 index 0000000..9a03714 --- /dev/null +++ b/Praktikum2/ppm1/data/Angebote/last.json @@ -0,0 +1 @@ +10 \ No newline at end of file diff --git a/Praktikum2/ppm1/data/Firmen/2.json b/Praktikum2/ppm1/data/Firmen/2.json new file mode 100644 index 0000000..760bbe7 --- /dev/null +++ b/Praktikum2/ppm1/data/Firmen/2.json @@ -0,0 +1,8 @@ +{ + "Sitz": "Sitz", + "Name": "Name", + "id": "2", + "Anzahl Mitarbeiter": "10", + "Schwerpunkt": "Schwerpunkt", + "Branche": "Branche" +} \ No newline at end of file diff --git a/Praktikum2/ppm1/data/Firmen/last.json b/Praktikum2/ppm1/data/Firmen/last.json new file mode 100644 index 0000000..d8263ee --- /dev/null +++ b/Praktikum2/ppm1/data/Firmen/last.json @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/Praktikum2/ppm1/data/Lehrende/2.json b/Praktikum2/ppm1/data/Lehrende/2.json new file mode 100644 index 0000000..6e8840d --- /dev/null +++ b/Praktikum2/ppm1/data/Lehrende/2.json @@ -0,0 +1,7 @@ +{ + "id": "2", + "Name": "Name", + "Lehrgebiet": "Lehrgebiet", + "Titel": "Titel", + "Vorname": "Vorname" +} \ No newline at end of file diff --git a/Praktikum2/ppm1/data/Lehrende/last.json b/Praktikum2/ppm1/data/Lehrende/last.json new file mode 100644 index 0000000..d8263ee --- /dev/null +++ b/Praktikum2/ppm1/data/Lehrende/last.json @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/Praktikum2/ppm1/data/Studenten/2.json b/Praktikum2/ppm1/data/Studenten/2.json new file mode 100644 index 0000000..0eb9459 --- /dev/null +++ b/Praktikum2/ppm1/data/Studenten/2.json @@ -0,0 +1,6 @@ +{ + "Name": "Name", + "id": "2", + "Matrikelnummer": "1234", + "Vorname": "Vorname" +} \ No newline at end of file diff --git a/Praktikum2/ppm1/data/Studenten/last.json b/Praktikum2/ppm1/data/Studenten/last.json new file mode 100644 index 0000000..d8263ee --- /dev/null +++ b/Praktikum2/ppm1/data/Studenten/last.json @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/Praktikum2/ppm1/data/companies/last.json b/Praktikum2/ppm1/data/companies/last.json deleted file mode 100644 index c227083..0000000 --- a/Praktikum2/ppm1/data/companies/last.json +++ /dev/null @@ -1 +0,0 @@ -0 \ No newline at end of file diff --git a/Praktikum2/ppm1/data/offerings/last.json b/Praktikum2/ppm1/data/offerings/last.json deleted file mode 100644 index c227083..0000000 --- a/Praktikum2/ppm1/data/offerings/last.json +++ /dev/null @@ -1 +0,0 @@ -0 \ No newline at end of file diff --git a/Praktikum2/ppm1/data/students/last.json b/Praktikum2/ppm1/data/students/last.json deleted file mode 100644 index 597975b..0000000 --- a/Praktikum2/ppm1/data/students/last.json +++ /dev/null @@ -1 +0,0 @@ -35 \ No newline at end of file diff --git a/Praktikum2/ppm1/data/teachers/last.json b/Praktikum2/ppm1/data/teachers/last.json deleted file mode 100644 index c227083..0000000 --- a/Praktikum2/ppm1/data/teachers/last.json +++ /dev/null @@ -1 +0,0 @@ -0 \ No newline at end of file diff --git a/Praktikum2/ppm1/doc/documentation.md b/Praktikum2/ppm1/doc/documentation.md new file mode 100644 index 0000000..27141f1 --- /dev/null +++ b/Praktikum2/ppm1/doc/documentation.md @@ -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 \ No newline at end of file diff --git a/Praktikum2/ppm1/static/functions.js b/Praktikum2/ppm1/static/functions.js index e6781de..e0b34b8 100644 --- a/Praktikum2/ppm1/static/functions.js +++ b/Praktikum2/ppm1/static/functions.js @@ -11,10 +11,10 @@ function select(category, mode) { } else { - if(mode == 0){ + if(mode == 0) { window.location.href = '/detail/?cat=' + category + '&id=' + id; } - else { + 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; @@ -24,6 +24,16 @@ function select(category, mode) { 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; + } + } } } diff --git a/Praktikum2/ppm1/static/style.css b/Praktikum2/ppm1/static/style.css index 10ad1ad..a45f1df 100644 --- a/Praktikum2/ppm1/static/style.css +++ b/Praktikum2/ppm1/static/style.css @@ -188,4 +188,11 @@ body { left: 250px; width: 250px; } + +.clFormRow select { + position: absolute; + top: 0; + left: 250px; + width: 250px; +} /* EOF */ \ No newline at end of file diff --git a/Praktikum2/ppm1/templates/detail.tpl b/Praktikum2/ppm1/templates/detail.tpl index 20133c3..d776ce4 100644 --- a/Praktikum2/ppm1/templates/detail.tpl +++ b/Praktikum2/ppm1/templates/detail.tpl @@ -16,27 +16,52 @@